Skip to content

Commit 0bdc863

Browse files
committed
Merge branch 'main' into task/extract-buildModuleSchema
2 parents e1f7cd1 + ad5e3f6 commit 0bdc863

File tree

79 files changed

+1031
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1031
-1263
lines changed

.circleci/config.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,11 @@ jobs:
760760
description: The Android build type. Must be one of "Debug", "Release".
761761
type: enum
762762
enum: ["Debug", "Release"]
763-
newarchitecture:
764-
type: boolean
765-
default: false
763+
architecture:
764+
default: "OldArch"
765+
description: Which React Native architecture to use. Must be one of "NewArch", "OldArch".
766+
type: enum
767+
enum: [ "NewArch", "OldArch" ]
766768
jsengine:
767769
default: "Hermes"
768770
description: Which JavaScript engine to use. Must be one of "Hermes", "JSC".
@@ -775,17 +777,6 @@ jobs:
775777
- run_yarn
776778
- attach_workspace:
777779
at: .
778-
- when:
779-
condition:
780-
equal: ["JSC", << parameters.jsengine >>]
781-
steps:
782-
- run:
783-
name: Set enableHermes in buld.gradle to false
784-
command: |
785-
node ./scripts/set-rn-engine.js -e jsc
786-
echo "Hermes disabled."
787-
grep enableHermes: template/android/app/build.gradle
788-
789780
- run:
790781
name: Create Android template project
791782
command: |
@@ -796,10 +787,20 @@ jobs:
796787
yarn
797788
798789
- run:
799-
name: Build the template application for << parameters.flavor >> with New Architecture set to << parameters.newarchitecture >>, and using the << parameters.jsengine>> JS engine.
790+
name: Build the template application for << parameters.flavor >> with Architecture set to << parameters.architecture >>, and using the << parameters.jsengine>> JS engine.
800791
command: |
801792
cd /tmp/$PROJECT_NAME/android/
802-
./gradlew assemble<< parameters.flavor >> -PnewArchEnabled=<< parameters.newarchitecture >> -PREACT_NATIVE_MAVEN_LOCAL_REPO=/root/react-native/maven-local
793+
if [[ << parameters.architecture >> == "NewArch" ]]; then
794+
export ORG_GRADLE_PROJECT_newArchEnabled=true
795+
else
796+
export ORG_GRADLE_PROJECT_newArchEnabled=false
797+
fi
798+
if [[ << parameters.jsengine >> == "Hermes" ]]; then
799+
export ORG_GRADLE_PROJECT_hermesEnabled=true
800+
else
801+
export ORG_GRADLE_PROJECT_hermesEnabled=false
802+
fi
803+
./gradlew assemble<< parameters.flavor >> -PREACT_NATIVE_MAVEN_LOCAL_REPO=/root/react-native/maven-local
803804
804805
# -------------------------
805806
# JOBS: Test iOS Template
@@ -1602,7 +1603,7 @@ workflows:
16021603
- build_npm_package
16031604
matrix:
16041605
parameters:
1605-
newarchitecture: [true, false]
1606+
architecture: ["NewArch", "OldArch"]
16061607
jsengine: ["Hermes", "JSC"]
16071608
flavor: ["Debug", "Release"]
16081609
- test_buck

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ untyped-import
7474
untyped-type-import
7575

7676
[version]
77-
^0.190.1
77+
^0.191.0

.flowconfig.android

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ untyped-import
7474
untyped-type-import
7575

7676
[version]
77-
^0.190.1
77+
^0.191.0

BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ rn_library(
742742
"//xplat/js:node_modules__abort_19controller",
743743
"//xplat/js:node_modules__anser",
744744
"//xplat/js:node_modules__base64_19js",
745+
"//xplat/js:node_modules__deprecated_19react_19native_19prop_19types",
745746
"//xplat/js:node_modules__event_19target_19shim",
746747
"//xplat/js:node_modules__invariant",
747748
"//xplat/js:node_modules__memoize_19one",

Libraries/Animated/useAnimatedValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function useAnimatedValue(
1717
initialValue: number,
1818
config?: ?AnimatedValueConfig,
1919
): Animated.Value {
20-
const ref = useRef(null);
20+
const ref = useRef<null | Animated.Value>(null);
2121
if (ref.current == null) {
2222
ref.current = new Animated.Value(initialValue, config);
2323
}

Libraries/AppDelegate/RCTAppDelegate.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
* - (UIViewController *)createRootViewController;
4444
* New Architecture:
4545
* - (BOOL)concurrentRootEnabled
46+
* - (BOOL)turboModuleEnabled;
47+
* - (BOOL)fabricEnabled;
4648
* - (NSDictionary *)prepareInitialProps
4749
* - (Class)getModuleClassFromName:(const char *)name
4850
* - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
@@ -106,12 +108,23 @@
106108
@property (nonatomic, strong) RCTTurboModuleManager *turboModuleManager;
107109
@property (nonatomic, strong) RCTSurfacePresenterBridgeAdapter *bridgeAdapter;
108110

109-
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
111+
/// This method controls whether the `concurrentRoot` feature of React18 is turned on or off.
110112
///
111113
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
112114
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
113115
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
114116
- (BOOL)concurrentRootEnabled;
115117

118+
/// This method controls whether the `turboModules` feature of the New Architecture is turned on or off.
119+
///
120+
/// @note: This is required to be rendering on Fabric (i.e. on the New Architecture).
121+
/// @return: `true` if the Turbo Native Module are enabled. Otherwise, it returns `false`.
122+
- (BOOL)turboModuleEnabled;
123+
124+
/// This method controls whether the App will use the Fabric renderer of the New Architecture or not.
125+
///
126+
/// @return: `true` if the Fabric Renderer is enabled. Otherwise, it returns `false`.
127+
- (BOOL)fabricEnabled;
128+
116129
@end
117130
#endif

Libraries/AppDelegate/RCTAppDelegate.mm

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ @implementation RCTAppDelegate
2929

3030
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
3131
{
32-
RCTAppSetupPrepareApp(application);
32+
BOOL enableTM = NO;
33+
#if RCT_NEW_ARCH_ENABLED
34+
enableTM = self.turboModuleEnabled;
35+
#endif
36+
37+
RCTAppSetupPrepareApp(application, enableTM);
3338

3439
if (!self.bridge) {
3540
self.bridge = [self createBridgeWithDelegate:self launchOptions:launchOptions];
@@ -94,7 +99,11 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
9499
moduleName:(NSString *)moduleName
95100
initProps:(NSDictionary *)initProps
96101
{
97-
return RCTAppSetupDefaultRootView(bridge, moduleName, initProps);
102+
BOOL enableFabric = NO;
103+
#if RCT_NEW_ARCH_ENABLED
104+
enableFabric = self.fabricEnabled;
105+
#endif
106+
return RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);
98107
}
99108

100109
- (UIViewController *)createRootViewController
@@ -138,6 +147,18 @@ - (Class)getModuleClassFromName:(const char *)name
138147
return RCTAppSetupDefaultModuleFromClass(moduleClass);
139148
}
140149

150+
#pragma mark - New Arch Enabled settings
151+
152+
- (BOOL)turboModuleEnabled
153+
{
154+
return YES;
155+
}
156+
157+
- (BOOL)fabricEnabled
158+
{
159+
return YES;
160+
}
161+
141162
#endif
142163

143164
@end

Libraries/Components/TextInput/TextInput.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,13 @@ const ExportedForwardRef: React.AbstractComponent<
16501650
);
16511651
});
16521652

1653+
/**
1654+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
1655+
* releases. This is deprecated and will be removed in the future.
1656+
*/
1657+
ExportedForwardRef.propTypes =
1658+
require('deprecated-react-native-prop-types').TextInputPropTypes;
1659+
16531660
// $FlowFixMe[prop-missing]
16541661
ExportedForwardRef.State = {
16551662
currentlyFocusedInput: TextInputState.currentlyFocusedInput,

Libraries/Image/Image.android.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ Image.queryCache = queryCache;
325325
* comment and run Flow. */
326326
Image.resolveAssetSource = resolveAssetSource;
327327

328+
/**
329+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
330+
* releases. This is deprecated and will be removed in the future.
331+
*/
332+
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
333+
328334
const styles = StyleSheet.create({
329335
base: {
330336
overflow: 'hidden',

Libraries/Image/Image.ios.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ Image.queryCache = queryCache;
260260
* delete this comment and run Flow. */
261261
Image.resolveAssetSource = resolveAssetSource;
262262

263+
/**
264+
* Switch to `deprecated-react-native-prop-types` for compatibility with future
265+
* releases. This is deprecated and will be removed in the future.
266+
*/
267+
Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes;
268+
263269
const styles = StyleSheet.create({
264270
base: {
265271
overflow: 'hidden',

0 commit comments

Comments
 (0)