Граф коммитов

47 Коммитов

Автор SHA1 Сообщение Дата
Eric Edouard 8993ffc82e Added border curve style prop ("Squircle" effect - iOS only) (#33783)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
NOTE: PR is based on https://github.com/facebook/react-native/pull/32017 which went stale for quite a long time but can now safely be closed

![](https://preview.redd.it/nuvl4746ys471.png?width=960&crop=smart&auto=webp&s=084a517a645364ac246b70b7fa8e0f2470cc7af3)

Since iOS 13+, it is possible to change the corner curve property on iOS in order to smoothen border radius and make it more "rounded" (also called "squircle")
Here's an [article](https://medium.com/arthurofbabylon/a-smooth-corner-radius-in-ios-54b80aa2d372) explaining in details what it is.
This property is also built in figma, but currently there is no way to implement this directly with react-native despite it being available natively on iOS.

Many open source react-native libraries were created in order to simulate this behaviour:
[react-native-super-ellipse-mask](https://github.com/everdrone/react-native-super-ellipse-mask)
[react-native-squircle-view](https://github.com/everdrone/react-native-squircle-view)
[react-native-figma-squircle](https://github.com/tienphaw/react-native-figma-squircle)

But they rely on creating an SVG shape with the smoothed corners and masking the view behind. This makes it not very performant (flickering on mounting was a common side-effect)

This PR aims at implementing the property natively.

PR for the docs update: https://github.com/facebook/react-native-website/pull/2785

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] - Added `borderCurve` style prop for smooth border radius (squircle effect)

Pull Request resolved: https://github.com/facebook/react-native/pull/33783

Test Plan:
We used the RNTester app and added an example with `cornerCurve ` set to `'continuous'` (only on iOS).

As the difference is quite subtle, we also made some more tests to better illustrate the difference (these are not in the RN-tester app):

![IMG_0810](https://user-images.githubusercontent.com/19872411/133893536-26207c53-aade-4583-9eef-7a1739b6907b.PNG)

We overlapped two views with `position: absolute`, the one in the background has a red background and has `cornerRadius` set to `false`, and the one in the foreground is set to `true`. We can clearly see where the borders differs on the corners.

Reviewed By: sammy-SC

Differential Revision: D37883631

Pulled By: cipolleschi

fbshipit-source-id: 09f06de9628fa326323eba63875de30102c4a59e
2022-07-21 04:11:30 -07:00
Dustin Shahidehpour cf2e27c388 Remove APPLETVOS variants from targets.
Summary:
After D37553813, there are no more TV apps in `fbsource`. Thus, we can begin the sequential teardown of all of the `APPLETVOS` variants in the codebase, which should migrating to `select()` and buck parse times a bit faster.

#nocancel

Reviewed By: natestedman

Differential Revision: D37594789

fbshipit-source-id: 830e40266654f948f39f5d10c32a080e970cf9d7
2022-07-05 17:50:10 -07:00
Rick Hanlon 118cf68914 React Native sync for revisions bd4784c...d300ceb
Summary:
This sync includes the following changes:
- **[dd4950c90](https://github.com/facebook/react/commit/dd4950c90 )**: [Flight] Implement useId hook ([#24172](https://github.com/facebook/react/pull/24172)) //<Josh Story>//
- **[26a5b3c7f](https://github.com/facebook/react/commit/26a5b3c7f )**: Explicitly set `highWaterMark` to 0 for `ReadableStream` ([#24641](https://github.com/facebook/react/pull/24641)) //<Josh Larson>//
- **[aec575914](https://github.com/facebook/react/commit/aec575914 )**: [Fizz] Send errors down to client ([#24551](https://github.com/facebook/react/pull/24551)) //<Josh Story>//
- **[a2766387e](https://github.com/facebook/react/commit/a2766387e )**: [Fizz] Improve text separator byte efficiency ([#24630](https://github.com/facebook/react/pull/24630)) //<Josh Story>//
- **[f7860538a](https://github.com/facebook/react/commit/f7860538a )**: Fix typo in useSyncExternalStore main entry point error ([#24631](https://github.com/facebook/react/pull/24631)) //<François Chalifour>//
- **[1bed20731](https://github.com/facebook/react/commit/1bed20731 )**: Add a module map option to the Webpack Flight Client ([#24629](https://github.com/facebook/react/pull/24629)) //<Sebastian Markbåge>//
- **[b2763d3ea](https://github.com/facebook/react/commit/b2763d3ea )**: Move hydration code out of normal Suspense path ([#24532](https://github.com/facebook/react/pull/24532)) //<Andrew Clark>//
- **[357a61324](https://github.com/facebook/react/commit/357a61324 )**: [DevTools][Transition Tracing] Added support for Suspense Boundaries ([#23365](https://github.com/facebook/react/pull/23365)) //<Luna Ruan>//
- **[2c8a1452b](https://github.com/facebook/react/commit/2c8a1452b )**: Fix ignored setState in Safari when iframe is touched ([#24459](https://github.com/facebook/react/pull/24459)) //<dan>//
- **[62662633d](https://github.com/facebook/react/commit/62662633d )**: Remove enableFlipOffscreenUnhideOrder ([#24545](https://github.com/facebook/react/pull/24545)) //<Ricky>//
- **[34da5aa69](https://github.com/facebook/react/commit/34da5aa69 )**: Only treat updates to lazy as a new mount in legacy mode ([#24530](https://github.com/facebook/react/pull/24530)) //<Ricky>//
- **[46a6d77e3](https://github.com/facebook/react/commit/46a6d77e3 )**: Unify JSResourceReference Interfaces ([#24507](https://github.com/facebook/react/pull/24507)) //<Timothy Yung>//
- **[6cbf0f7fa](https://github.com/facebook/react/commit/6cbf0f7fa )**: Fork ReactSymbols ([#24484](https://github.com/facebook/react/pull/24484)) //<Ricky>//
- **[a10a9a6b5](https://github.com/facebook/react/commit/a10a9a6b5 )**: Add test for hiding children after layout destroy ([#24483](https://github.com/facebook/react/pull/24483)) //<Ricky>//
- **[b4eb0ad71](https://github.com/facebook/react/commit/b4eb0ad71 )**: Do not replay erroring beginWork with invokeGuardedCallback when suspended or previously errored ([#24480](https://github.com/facebook/react/pull/24480)) //<Josh Story>//
- **[99eef9e2d](https://github.com/facebook/react/commit/99eef9e2d )**: Hide children of Offscreen after destroy effects ([#24446](https://github.com/facebook/react/pull/24446)) //<Ricky>//
- **[ce1386028](https://github.com/facebook/react/commit/ce1386028 )**: Remove enablePersistentOffscreenHostContainer flag ([#24460](https://github.com/facebook/react/pull/24460)) //<Andrew Clark>//
- **[72b7462fe](https://github.com/facebook/react/commit/72b7462fe )**: Bump local package.json versions for 18.1 release ([#24447](https://github.com/facebook/react/pull/24447)) //<Andrew Clark>//
- **[22edb9f77](https://github.com/facebook/react/commit/22edb9f77 )**: React `version` field should match package.json ([#24445](https://github.com/facebook/react/pull/24445)) //<Andrew Clark>//
- **[6bf3deef5](https://github.com/facebook/react/commit/6bf3deef5 )**: Upgrade react-shallow-renderer to support react 18 ([#24442](https://github.com/facebook/react/pull/24442)) //<Michael サイトー 中村 Bashurov>//

Changelog:
[General][Changed] - React Native sync for revisions bd4784c...d300ceb

jest_e2e[run_all_tests]

Reviewed By: cortinico, kacieb

Differential Revision: D36874368

fbshipit-source-id: c0ee015f4ef2fa56e57f7a1f6bc37dd05c949877
2022-06-06 10:58:29 -07:00
Shubho Sadhu 39e81a1703 Revert D36707915: Create Apple MSYS Mailbox Provider TurboModule
Differential Revision:
D36707915 (528414cc89)

Original commit changeset: 9a246f238efd

Original Phabricator Diff: D36707915 (528414cc89)

fbshipit-source-id: a581b745abd781a97d5ffde303db69ba3e23c51c
2022-06-02 19:36:46 -07:00
Jake Holland 528414cc89 Create Apple MSYS Mailbox Provider TurboModule
Summary: Creates a base TurboModule for Catalyst.

Reviewed By: ann-ss

Differential Revision: D36707915

fbshipit-source-id: 9a246f238efdcdde45e0332f7b868478deadf50e
2022-06-02 16:41:12 -07:00
Moti Zilberman 55a1cfedc5 Exclude *._reactvr.js from Buck
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D36805013

fbshipit-source-id: c8c0fafe2a60e4d5f21e99b1c34bcc2b45d302d9
2022-06-01 06:27:57 -07:00
Michael Lee (Engineering) 2d66bd4851 Rename the folly `headers_only` target to warn
Summary:
This target is not a good idea for a number of reasons:
1. It groups up multiple targets which breaks the dependency graph
2. It does not handle dependency remapping correctly
3. It has no mirror into fbcode

We should warn people this is a bad idea

Reviewed By: alexmalyshev

Differential Revision: D36519357

fbshipit-source-id: d60ca3237c7710118732578fecd1b2fc8903321b
2022-05-26 08:17:27 -07:00
Rick Hanlon 93b50be8c2 Replace use-subscripton with use-sync-external-store (#33770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33770

React has replaced use-subscription with the React 18 compatible use-sync-external-store.

Changelog:
[General][Changed] - Replace use-subscripton with use-sync-external-store

Reviewed By: ryancat

Differential Revision: D35592432

fbshipit-source-id: cc2016f66940e53f3614e110bafb02240bae1ae4
2022-05-05 19:58:19 -07:00
Chris Olszewski daa105aba5 Fixup typo in pfh labels
Summary:
Now that the PFH node has been renamed this updates the pfh label.

Produced via `xbgs -l -e '"pfh:ReactNative_CommonInfrastructurePlaceholde"' | xargs sed -i 's/"pfh:ReactNative_CommonInfrastructurePlaceholde"/"pfh:ReactNative_CommonInfrastructurePlaceholder"/'`

Reviewed By: jkeljo

Differential Revision: D35374087

fbshipit-source-id: 61590f69de5a69ec3b8a0478f6dd43409de3c70b
2022-04-05 12:15:05 -07:00
Chris Olszewski ceae48c0f7 Add pfh labels to targets
Summary:
While it would be better to be able to do all of the ownership metadata at the Buck macro level, that proved to be more work than expected.

This diff adds the corresponding pfh label to all targets in `xplat/js/react-native-github` that have a Supermodule label. Once the migration is complete the Supermodules labels will be able to be removed.

Reviewed By: cortinico

Differential Revision: D35221544

fbshipit-source-id: d87d5e266dfb5e6ee087251dc34dff5db299bbaf
2022-03-30 14:37:03 -07:00
Wei Han 0353852297 fix //xplat/js/react-native-github:codegen_rn_components_schema_rncore (#33518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33518

Changelog: [Internal]

When building with buck2, `setup_env_vars.sh` cannot be found. exporting setup_env_vars.sh and adding it as a dep to `write_to_json` fixes it.

Reviewed By: d16r

Differential Revision: D35188154

fbshipit-source-id: e1e1be4c83a57e443a181efaf1af3e6c8e6452f9
2022-03-30 14:12:50 -07:00
Paige Sun 6ee70a9cae 5/n Allow CKComponents to embed Fabric surfaces
Summary:
Changelog: [Fabric][iOS] Allow CKComponents to embed Fabric surfaces too.

Previously RCTSurfaceHostingComponent, a CKComponent, could only initialize the legacy RCTSurface. Now it can initialize RCTFabricSurface too, when a RCTSurfacePresenter is passed in.

Reviewed By: RSNara

Differential Revision: D35163595

fbshipit-source-id: e11a9334b0282e0728a38cc1c96de48a694e9e3d
2022-03-29 11:52:49 -07:00
Genki Kondo c231d5e371 VirtualizedList optimization - memoize FlatList._renderer
Summary:
Problem:
All CellRenderers rerender every time the containing VirtualizedList is rerendered. This is due to the following:
- Lambda is created for each CellRenderer's onLayout prop on every VirtualizedList render (fixed in D35061321 (19cf70266e))
- CellRenderer's parentProps prop changes on every VirtualizedList render (fixed in D35062323 (adb2962fee))
- FlatList recreates renderItem/ListItemComponent in FlatList._renderer (addressed in this diff)

Changelog:
[Internal] - VirtualizedList optimization - memoize FlatList._renderer

Reviewed By: ryancat

Differential Revision: D35067472

fbshipit-source-id: 124629d94821f35b8943730839fbe72f547e80fd
2022-03-24 13:14:37 -07:00
Paige Sun 6e03945c7f Use @synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder hack
Summary:
Changelog: [iOS][Internal] Use synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder

Remove the `RCTWeakViewHolder` hack, since it can be replaced with `viewRegistry_DEPRECATED viewForReactTag`.

Reviewed By: RSNara

Differential Revision: D34468082

fbshipit-source-id: be41ed2df6ee195409724f6069fd99a793dca01a
2022-02-25 13:45:22 -08:00
Paige Sun 94b1b8a573 1/5 Refactor CxxBridge: Introduce RCTBridgeModuleDecorator to attach @synthesize ivars to RCTTurboModules, in Bridge mode
Summary:
Changelog: [iOS][Internal] Refactor CxxBridge: Introduce RCTBridgeModuleDecorator to attach synthesize ivars to RCTTurboModules, in Bridge mode

This doesn't change any logic. RCTBridgeModuleDecorator was created to consolidate several nearly identical implementations of the `attachInteropAPIsToModule` method to one place.

Most importantly, it allows us to attach interop APIs in RCTBridgeModuleDecorator to RCTViewManagers in diff 4/4, using  `attachInteropAPIsToModule`. Before this stack, these four synthesize ivars in RCTViewManagers are nil in Bridgeless mode, and point to instances in Bridge mode.

# Context
These are used in RCTBridgeModules to access APIs for view managers. These APIs are necessary and compatible with Bridgeless mode.

*  synthesize viewRegistry_DEPRECATED
*  synthesize bundleManager
*  synthesize callableJSModules
*  synthesize moduleRegistry

Reviewed By: RSNara

Differential Revision: D34437802

fbshipit-source-id: b773d511cf877d4896436fabf4893c978e5f8dd9
2022-02-25 08:50:34 -08:00
Amy Lee 16feabf676 Address some RN build warnings
Summary:
Addresses build warnings for some additional compiler flags.

Changelog: [Internal]

Reviewed By: nlutsenko

Differential Revision: D34299822

fbshipit-source-id: d3d873fb600990a869cb0e6fbe9fff4ebc8c5d0e
2022-02-17 19:18:11 -08:00
Phillip Pan 113f8257ce lift out prerendering logic into its own module
Summary: this is to break any unique dependencies this module is bringing in from the original module it was in.

Reviewed By: sammy-SC

Differential Revision: D33935581

fbshipit-source-id: 2ccf5b4a9d1dca1e6059cafb888091e450f6f980
2022-02-04 21:51:02 -08:00
Tim Yung 3e229f27bc RN: Remove `propTypes` from Image, Text, and TextInput
Summary:
Removes the `propTypes` member from the `Image`, `Text`, and `TextInput` components.

They have been deprecated since React Native v0.66.

Changelog:
[General][Removed] - Removed `Image.propTypes`, `Text.propTypes`, and `TextInput.propTypes`.

Reviewed By: kacieb

Differential Revision: D33750298

fbshipit-source-id: 085f83ad838196bdd531b097b8ce5957270c3ad1
2022-02-01 16:19:01 -08:00
Tim Yung 23717c6381 RN: Remove DeprecatedPropTypes
Summary:
Removes all of the `DeprecatedPropTypes` modules from React Native.

Any call sites that were deep-linking to these modules and still requires them can instead import them from the `deprecated-react-native-prop-types` package.

Since this also removes the last reference to `prop-types`, this diff also removes the `prop-types` dependency from `react-native`. 🥳

Changelog:
[General][Removed] DeprecatedPropTypes (deep-link) modules removed from React Native.

Reviewed By: kacieb

Differential Revision: D33671645

fbshipit-source-id: 91829a556b272bbd17ee94806fc548af753593db
2022-01-20 18:17:03 -08:00
Phillip Pan 891a1c12f1 introduce get_rn_ios_target_sdk_version()
Summary:
feels like this should be shared across oss

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D32940936

fbshipit-source-id: 76fa8fdac5a768586f7f3e916af2c57685a70e12
2021-12-09 04:08:41 -08:00
Paige Sun 60e60a9b3d Refactor: Assign string label to each case in RCTPLTag enum for startup performance logging
Summary:
`_labelsForTags` is an array with string labels used only for local profiling, that we had to manually keep it in sync with `RCTPLTag`. Refactor so labels are assigned with switch instead.

Changelog: [iOS] Refactor: Assign string label to each case in RCTPLTag enum for startup performance logging

Reviewed By: fkgozali

Differential Revision: D32889043

fbshipit-source-id: 81da592a160a31b91e78289be0990cc2ff960f29
2021-12-08 14:51:04 -08:00
Sota Ogo 0ff02f9a41 Add log function binding to Facebook App
Summary:
Adding the RCTLog binding to Facebook app. More context is in D30271863 (c317a709d5)

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31299188

fbshipit-source-id: 5234242e2f82262f9d2538e6c689f4a3738f37bb
2021-11-29 14:42:10 -08:00
Phillip Pan 749a9207b6 introduce RCTMockDef
Summary:
here's a way we can mock C apis - however i am not sure if the flag i'm using is correct

used in D31949237

Changelog:
[General][Added] - add macros to be able to stub C functions in tests

Reviewed By: RSNara

Differential Revision: D31949238

fbshipit-source-id: 0f18a65f810f1b855dbc844f11f5a304c1e5ecea
2021-11-23 22:33:54 -08:00
Phillip Pan 31b64c2615 kill RCTFabricSurfaceHostingView
Summary:
after D32591685, no one is using this. delete

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D32591686

fbshipit-source-id: 11ffb8cbf0fef605b7aefa47347db3ccc6e7d7fe
2021-11-23 02:29:25 -08:00
Phillip Pan 9fc3fc83ac introduce RCTViewUtils
Summary:
Changelog: [Internal]

in this diff, i convert the following method to a C function.
https://www.internalfb.com/code/fbsource/[c58818169205f1e0fa816968efdb4c3fac8333e9]/xplat/js/react-native-github/React/Views/RCTView.h?lines=43

besides for testing demonstration purposes later in the stack, C functions are a superior choice to static class methods because they incur less binary size cost (see section 4.3 of https://swolchok.github.io/objcperf/ if you're curious, and https://fb.workplace.com/groups/aexpixfn/posts/1909150855887748 for the impact of a conversion)

Reviewed By: RSNara

Differential Revision: D31949241

fbshipit-source-id: dd40871d48f1de168d360168c4dd60015145d7e3
2021-11-09 20:42:13 -08:00
Rachel Lang 88ebec9e65 6/n Boilerplate C++-only TurboModule iOS
Summary:
C++-only TurboModules, not to be confused with [TurboModules](https://www.internalfb.com/intern/wiki/React_Native/Building_Product_Experiences/Intro_to_Native_Modules/), directly allows you to call C++ from JS instead of going through the native layer. Referred to modification of C++-only TurboModule D30158226 and https://fburl.com/code/rcf73a42 for C++ to JS call (jsInvoker is an object that can schedule work on the JavaScript thread)

This example shows JS to C++ call and storing a JS function in C++ to call later.

Notes:

* To use the module, import the C++ module directly in objc.
* Meanwhile, create a js spec and use it in RN code. Spec methods don't need to be marked as optional.
* C++ and js spec will be linked when built

Reviewed By: RSNara

Differential Revision: D32080496

fbshipit-source-id: 9c214ca22c18f793d5f8b54997d129bdfa73e61a
2021-11-04 15:58:49 -07:00
Moshe Berman fdd744f013 Enable complete_nullability on //xplat/js/react-native-github:RCTTypeSafety (#32473)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/32473

Reviewed By: AdamCmiel

Differential Revision: D31775069

fbshipit-source-id: f3aaee36c1ca8a209610f8b66c7adc90bd2b8c7e
2021-10-26 17:14:24 -07:00
Tim Yung 3f629049ba RN: Deprecate Prop Types
Summary:
Deprecates `prop-types` from React Native.

Existing use cases will be presented with a warning to migrate to the newly published `deprecated-react-native-prop-types` module.

In a subsequent release, these will be removed from React Native.

Changelog:
[General][Changed] - Accessing `Image.propTypes`, `Text.propTypes`, `TextInput.propTypes`, `ColorPropType`, `EdgeInsetsPropType`, `PointPropType`, or `ViewPropTypes` now emits a deprecation warning.

Reviewed By: kacieb

Differential Revision: D29019309

fbshipit-source-id: 21e518e588fa05c498cc75ba81f69cfa8a9d0613
2021-10-21 17:45:47 -07:00
James Donald f09beeabeb Merge base AppleTVOS flags into base Apple flags (take #5)
Summary:
Previous iterations of this diff that were reverted: D30678341 (800945982f), D30868627 (abd0f387cd),
D31024459 (0a46e5efad), D31147242 (92c1bee5f9).

With the power of selects, we can move the base AppleTVOS flags into the regular
base Apple flags.

Changelog: [Internal]

skip-frl-buck-targeting

Reviewed By: mzlee

Differential Revision: D31216242

fbshipit-source-id: 93ee2afda41af06fe210ba6a4a5459a438d6c3f8
2021-09-28 21:05:03 -07:00
James Donald 6ea3df0507 Revert D31147242: Merge base AppleTVOS flags into base Apple flags (take #4)
Differential Revision:
D31147242 (92c1bee5f9)

Original commit changeset: deef1f1b39eb

fbshipit-source-id: d4d3c7546e4e2bcf59a72c7c865ee7d9218ab0d6
2021-09-27 13:35:25 -07:00
Alex Malyshev 92c1bee5f9 Merge base AppleTVOS flags into base Apple flags (take #4)
Summary:
Previous iterations of this diff that were reverted: D30678341 (800945982f), D30868627 (abd0f387cd),
D31024459 (0a46e5efad).

With the power of selects, we can move the base AppleTVOS flags into the regular
base Apple flags.

Changelog: [Internal]

Reviewed By: mzlee

Differential Revision: D31147242

fbshipit-source-id: deef1f1b39eb21772ab7ddd2ef1f19814e1f72d5
2021-09-27 13:18:31 -07:00
Tong Liu e20335a2ac Revert D31024459: Merge base AppleTVOS flags into base Apple flags (take #3)
Differential Revision:
D31024459 (0a46e5efad)

Original commit changeset: be85296cda36

fbshipit-source-id: ceb8e5a3cda57a40a876b07133d8021942308878
2021-09-21 17:50:56 -07:00
Alex Malyshev 0a46e5efad Merge base AppleTVOS flags into base Apple flags (take #3)
Summary:
Previous iterations of this diff that were reverted: D30678341 (800945982f), D30868627 (abd0f387cd).

With the power of selects, we can move the base AppleTVOS flags into the regular
base Apple flags.

While I'm here, drop the third `p` in `get_application_apppletvos_flags()` as
it's driving me insane.

Note - This puts get_visibility_option() on all Apple builds.  I believe this is
the right thing to do as everything except macOS static libraries already do it,
and it shouldn't affect binaries.

Changelog: [Internal]

Reviewed By: mzlee, jdonald

Differential Revision: D31024459

fbshipit-source-id: be85296cda3612836c1c74632dc52f6e3f89512e
2021-09-20 09:27:46 -07:00
Ramanpreet Nara 564b944e56 Ensure RCTJSThread is initialized in Bridgeless mode
Summary:
## Context
When Venice is enabled app-wide, we won't be creating/initializing the bridge. This means that RCTBridge +(void)initialize; won't execute:

https://www.internalfb.com/code/fbsource/[d8b25a1907ee55baa21e02a69ecab0f7a9442b8e]/xplat/js/react-native-github/React/Base/RCTBridge.m?lines=167%2C171-180

## Problem
When RCTBridge initialize isn't executed, we won't initialize RCTJSThread to kCFNull. RCTJSThread will be nil.

NativeModules like RCTEventDispatcher use RCTJSThread to indicate that their methods must be executed on the JavaScript thread:

https://www.internalfb.com/code/fbsource/[44976912ae618619a394f063c4c942ef020b86e8]/xplat/js/react-native-github/React/CoreModules/RCTEventDispatcher.mm?lines=198-201

If RCTJSThread is nil, these NativeModules will fail to initialize w/ the TurboModule system:

https://www.internalfb.com/code/fbsource/[f6a04f529ac1354b2973bd3553d12aef28ff24f2][blame]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm?lines=584-589%2C595%2C599%2C610-618

How:
1. The TurboModuleManager will see that each of these NativeModules has a methodQueue getter (line 587 above).
2. It'll invoke that getter (line 588), and get a nil methodQueue out, when **that methodQueue should be kCFNull**.
3. Because the TurboModuleManager gets a nil method queue from the getter, !methodQueue will pass (line 595).
4. So, TurboModuleManager try to create and assign a method queue to these modules (line 611), which'll raise an error (line 613), because none of these modules synthesize the methodQueue (b/c they expose a getter to methodQueue instead).

## Changes
We need to initialize RCTJSThread to kCFNull in all cases, to prevent this breakage. So, I moved RCTJSThread into its own header: RCTJSThread.h. RCTJSThread.h exports a function that initializes the RCTJSThread constant: _RCTInitializeJSThreadConstantInternal. This function gets invoked inside RCTHost initialize, and RCTBridge initialize.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog: [Internal]

Reviewed By: p-sun, mdvacca

Differential Revision: D30910515

fbshipit-source-id: 2dd9b0cfcda92c497bb497f12f9fb847da563f47
2021-09-19 16:23:53 -07:00
Kosie van der Merwe 4bf42dd0c6 Revert D30868627: Merge base AppleTVOS flags into base Apple flags (take #2)
Differential Revision:
D30868627 (abd0f387cd)

Original commit changeset: 86441ff40db1

fbshipit-source-id: eb040f8174f8f0f05943dcd5ae1e2077318810ff
2021-09-16 18:23:03 -07:00
Alex Malyshev abd0f387cd Merge base AppleTVOS flags into base Apple flags (take #2)
Summary:
Previous iteraton of this diff that was reverted is D30678341 (800945982f).

With the power of selects, we can move the base AppleTVOS flags into the regular
base Apple flags.

While I'm here, drop the third `p` in `get_application_apppletvos_flags()` as
it's driving me insane.

Note - This puts get_visibility_option() on all Apple builds.  I believe this is
the right thing to do as everything except macOS static libraries already do it,
and it shouldn't affect binaries.

Changelog: [Internal]

Reviewed By: aniketmathur

Differential Revision: D30868627

fbshipit-source-id: 86441ff40db15dd7cb3ac800d248ce1e074c2773
2021-09-16 10:41:41 -07:00
Tim Yung 504cbf1282 RN: Check `ReactSafeMobileConfig` Dependents for MobileConfig References
Summary:
Modifies `js1 build buckfiles` to also parse files that depend on `ReactSafeMobileConfig` for MobileConfig references.

That module was introduced in {D30470489}.

This fixes a bug where the MobileConfig reference in `ReactNativeInternalFeatureFlags` is not being correctly defined via Metro Buck.

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D30815779

fbshipit-source-id: 156b0838fe47e7ab42c62258a1401875690813a6
2021-09-09 13:29:02 -07:00
Alex Malyshev c807b69778 Revert D30678341: Merge base AppleTVOS flags into base Apple flags
Differential Revision:
D30678341 (800945982f)

Original commit changeset: be30ba1989b2

fbshipit-source-id: 3165cb4c4f6c479ffd5b27ff79b0cc17e6bf736b
2021-09-08 13:50:12 -07:00
Alex Malyshev 800945982f Merge base AppleTVOS flags into base Apple flags
Summary:
With the power of selects, we can move the base AppleTVOS flags into the regular
base Apple flags.

While I'm here, drop the third `p` in `get_application_apppletvos_flags()` as
it's driving me insane.

Note - This puts get_visibility_option() on all Apple builds.  I believe this is
the right thing to do as everything except macOS static libraries already do it,
and it shouldn't affect binaries.

Changelog: [Internal]

Reviewed By: aniketmathur

Differential Revision: D30678341

fbshipit-source-id: be30ba1989b2cadbf8aedd68c4101d346c36da6c
2021-09-08 09:14:19 -07:00
Adlai Holler 4ac42d88ef Optimize font handling on iOS (#31764)
Summary:
Few issues I saw when profiling RNTester:
- Repeatedly calling `-lowercaseString` during `weightOfFont` causes a TON of extra memory traffic, for no reason.
- `NSCache` is thread-safe, so no need for a mutex.
- Using `stringWithFormat:` for the cache key is slow. Use `NSValue` to store the data directly instead.
- Calling `-fontDescriptor` in `isItalicFont` and `isCondensedFont` is overly expensive and unnecessary.
- `+fontNamesForFamilyName:` is insanely expensive. Wrap it in a cache.

Unscientific test on RNTester iPhone 11 Pro, memory & time. Before:
<img width="1656" alt="Screen Shot 2021-06-23 at 7 40 06 AM" src="https://user-images.githubusercontent.com/2466893/123092882-f4f55100-d3f8-11eb-906f-d25086049a18.png">
<img width="1656" alt="Screen Shot 2021-06-23 at 7 41 30 AM" src="https://user-images.githubusercontent.com/2466893/123092886-f6267e00-d3f8-11eb-89f6-cfd2cae9f7b6.png">

After:
<img width="1455" alt="Screen Shot 2021-06-23 at 9 02 54 AM" src="https://user-images.githubusercontent.com/2466893/123101899-7d2c2400-d402-11eb-97f8-2ee97ee69ec4.png">
<img width="1455" alt="Screen Shot 2021-06-23 at 8 59 44 AM" src="https://user-images.githubusercontent.com/2466893/123101892-7bfaf700-d402-11eb-9a10-def46b37b87f.png">

Changelog:
[iOS][Changed] - Optimized font handling

Pull Request resolved: https://github.com/facebook/react-native/pull/31764

Reviewed By: appden

Differential Revision: D30241725

Pulled By: yungsters

fbshipit-source-id: 342e4f6e5492926acd2afc7d645e6878846369fc
2021-08-26 22:47:41 -07:00
Moti Zilberman 8d153729c5 Fix Buck package boundary violation involving RCTEventDispatcher.h (#31965)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31965

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30030580

fbshipit-source-id: 3b4140a831c7ad7282aae0ff79c54014dcd82615
2021-08-05 07:18:38 -07:00
Andrew Clark a169009095 React Native sync for revisions 419cc9c...19092ac
Summary:
This sync includes the following changes:
- **[19092ac8c](https://github.com/facebook/react/commit/19092ac8c )**: Re-add old Fabric Offscreen impl behind flag ([#22018](https://github.com/facebook/react/pull/22018)) //<Andrew Clark>//
- **[215db465a](https://github.com/facebook/react/commit/215db465a )**: [Fabric] Add `flex: 1` to Offscreen view container ([#22019](https://github.com/facebook/react/pull/22019)) //<Andrew Clark>//
- **[8a37b0ef3](https://github.com/facebook/react/commit/8a37b0ef3 )**: typos fixed ([#21955](https://github.com/facebook/react/pull/21955)) //<Sinan Sonmez (Chaush)>//
- **[e3049bb85](https://github.com/facebook/react/commit/e3049bb85 )**: DevTools scheduling profiler: Add React component measures ([#22013](https://github.com/facebook/react/pull/22013)) //<Brian Vaughn>//
- **[27bf6f9a8](https://github.com/facebook/react/commit/27bf6f9a8 )**: Scheduling profiler UX changes ([#21990](https://github.com/facebook/react/pull/21990)) //<Brian Vaughn>//
- **[f0d354efc](https://github.com/facebook/react/commit/f0d354efc )**: [Fabric] Fix reparenting bug in legacy Suspense mount ([#21995](https://github.com/facebook/react/pull/21995)) //<Andrew Clark>//
- **[34308b5ad](https://github.com/facebook/react/commit/34308b5ad )**: Tidy up early bailout logic at start of begin phase ([#21852](https://github.com/facebook/react/pull/21852)) //<Andrew Clark>//
- **[321087d13](https://github.com/facebook/react/commit/321087d13 )**: [Fizz] Don't add aborted segments to the completedSegments list ([#21976](https://github.com/facebook/react/pull/21976)) //<Sebastian Markbåge>//
- **[4cc8ec64c](https://github.com/facebook/react/commit/4cc8ec64c )**: Separate unit tests for ReactFabricHostComponent ([#21969](https://github.com/facebook/react/pull/21969)) //<Timothy Yung>//
- **[d4d786493](https://github.com/facebook/react/commit/d4d786493 )**: Fix `ReactFabricHostComponent` methods if detached ([#21967](https://github.com/facebook/react/pull/21967)) //<Timothy Yung>//
- **[392253a77](https://github.com/facebook/react/commit/392253a77 )**: [Fabric] Use container node to toggle the visibility of Offscreen and Suspense trees ([#21960](https://github.com/facebook/react/pull/21960)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 419cc9c...19092ac

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D30092460

fbshipit-source-id: 9f118db2419a9a5db26a9b873868f91ab88f2f89
2021-08-04 13:47:11 -07:00
Moti Zilberman 260c5a393f Move RCTTestApple into packages/rn-tester
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30056021

fbshipit-source-id: 9012ca6934f95946ff157ca472aa6a6e84d7d7e9
2021-08-04 13:03:21 -07:00
Moti Zilberman 30d37cfd39 Move RNTester unit/integration test Buck targets to GitHub
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30032476

fbshipit-source-id: d1f9a39a6d2fc92f69b9ee931c2a0f3ba37687f6
2021-08-04 13:03:21 -07:00
Moti Zilberman b26ae3e0c9 Move RCT* Buck targets to GitHub
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30030454

fbshipit-source-id: 02a4c36f5c5ca519e4de3d1a3d79708d0d0b6d01
2021-08-04 13:03:21 -07:00
Moti Zilberman df9cd05621 Update OSS Buck definitions (#31948)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31948

Changelog: [Internal]

Adds necessary shims to bring our BUCK files closer to parsing/building correctly in open source. This is part of fixing the Buck-based tests on CircleCI which were broken by d4ee734f32.

Reviewed By: sammy-SC

Differential Revision: D30072866

fbshipit-source-id: 4aebd9f67dd0a102516603915d9a021032611279
2021-08-04 03:13:19 -07:00
Moti Zilberman dc15c48434 fbshipit-source-id: 909b2667480ed96ae376896d966f6c27f5e73964 2021-08-04 01:27:28 -07:00