-
Notifications
You must be signed in to change notification settings - Fork 24k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functions to check whether the New Arch is enabled at runtime #42090
Conversation
This pull request was exported from Phabricator. Differential Revision: D52445107 |
Base commit: af8c56a |
eda576c
to
f33e680
Compare
This pull request was exported from Phabricator. Differential Revision: D52445107 |
…cebook#42090) Summary: This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Differential Revision: D52445107
f33e680
to
d13aeba
Compare
…cebook#42090) Summary: This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Differential Revision: D52445107
This pull request was exported from Phabricator. Differential Revision: D52445107 |
d13aeba
to
545ab3a
Compare
This pull request was exported from Phabricator. Differential Revision: D52445107 |
…cebook#42090) Summary: This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Reviewed By: cortinico Differential Revision: D52445107
545ab3a
to
2866ccd
Compare
…cebook#42090) Summary: This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Reviewed By: cortinico Differential Revision: D52445107
This pull request was exported from Phabricator. Differential Revision: D52445107 |
Summary: This change adds an extra function to customise the RootView in both Bridge and Bridgeless mode. To nudge users in a migration, we also add a warning message for next version that should push our users to migrate away from the old implementation to the new one. *The Warning is shown ONLY when the user do customise the rootView*. For users which were not customising the Root View, the warning will not appear. The documentation of the new method plus the warning should guide the users toward the right migration path. ## Changelog [iOS][Added] - Added the customiseRootView method which is called in both bridge and bridgeless. Added also a warning for 0.74 with instructions on how to migrate. Reviewed By: cortinico Differential Revision: D52442598
…cebook#42090) Summary: This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Reviewed By: cortinico Differential Revision: D52445107
2866ccd
to
3ca1694
Compare
This pull request was exported from Phabricator. Differential Revision: D52445107 |
This pull request has been merged in f1a7f08. |
…cebook#42090) Summary: Pull Request resolved: facebook#42090 This change is the last pieces of removing `RCT_NEW_ARCH_ENABLED` flag and defragmenting the build setup on iOS. Before, 3rd party libraries had to use the `#if RCT_NEW_ARCH_ENABLED` flag to compile in and out segment of code depending on whether the new architecture was turned on or not. After the recent changes, we can now expose the `RCTIsNewArchEnabled()` function to read whether the New Arch is enabled at runtime or not. This will promote better code practices as we can replace ugly, compile time, `#if-#else-#endif`s with a more readable and natural regular obj-c code. We can also use inheritance to have different implementation based on the architecture. To use the new function, a 3rd party library have to: 1. `#import <React/RCTUtils.h>` (if they use the `install_modules_dependencies` function we provide, they can already do it) 2. invoke `RCTIsNewArchEnabled()` which returns a BOOL. 3. implement the code accordingly, depending on the New arch state. **Note:** we implemented also the `RCTSetNewArchEnabled` function. This is called as soon as React Native is initialized in the `RCTAppDelegate`. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored. ## Changelog: [iOS][Added] - Added the `RCTIsNewArchEnabled()` to check whether the New Arch is enabled at runtime. Reviewed By: cortinico Differential Revision: D52445107 fbshipit-source-id: 1b432832912d33c85687b4c37f9e360ce9699f59
Summary:
This change is the last pieces of removing
RCT_NEW_ARCH_ENABLED
flag and defragmenting the build setup on iOS.Before, 3rd party libraries had to use the
#if RCT_NEW_ARCH_ENABLED
flag to compile in and out segment of code depending on whether the new architecture was turned on or not.After the recent changes, we can now expose the
RCTIsNewArchEnabled()
function to read whether the New Arch is enabled at runtime or not.This will promote better code practices as we can replace ugly, compile time,
#if-#else-#endif
s with a more readable and natural regular obj-c code.We can also use inheritance to have different implementation based on the architecture.
To use the new function, a 3rd party library have to:
#import <React/RCTUtils.h>
(if they use theinstall_modules_dependencies
function we provide, they can already do it)RCTIsNewArchEnabled()
which returns a BOOL.Note: we implemented also the
RCTSetNewArchEnabled
function. This is called as soon as React Native is initialized in theRCTAppDelegate
. The method can be called only once per React Native lifecycle. Subsequent calls to that method are ignored.Changelog:
[iOS][Added] - Added the
RCTIsNewArchEnabled()
to check whether the New Arch is enabled at runtime.Differential Revision: D52445107