react-native 0.71.0 → 0.71.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/Libraries/Alert/Alert.d.ts +1 -0
  2. package/Libraries/AppDelegate/RCTAppDelegate.h +5 -12
  3. package/Libraries/AppDelegate/RCTAppDelegate.mm +5 -2
  4. package/Libraries/Blob/React-RCTBlob.podspec +4 -0
  5. package/Libraries/Components/TextInput/TextInput.d.ts +15 -0
  6. package/Libraries/Components/View/ViewAccessibility.d.ts +13 -0
  7. package/Libraries/Core/ReactNativeVersion.js +1 -1
  8. package/Libraries/Lists/VirtualizedList.js +13 -10
  9. package/Libraries/StyleSheet/processAspectRatio.js +12 -2
  10. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +11 -0
  11. package/Libraries/TurboModule/TurboModuleRegistry.d.ts +2 -4
  12. package/React/Base/RCTVersion.m +1 -1
  13. package/React/CoreModules/RCTAlertController.m +30 -3
  14. package/React/CoreModules/RCTDevLoadingView.mm +14 -0
  15. package/React/CoreModules/React-CoreModules.podspec +1 -0
  16. package/React/Views/RCTModalHostViewManager.m +16 -12
  17. package/React-Core.podspec +21 -6
  18. package/ReactAndroid/build.gradle +20 -5
  19. package/ReactAndroid/gradle.properties +1 -1
  20. package/ReactAndroid/hermes-engine/build.gradle +6 -5
  21. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +10 -11
  22. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  23. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +25 -0
  24. package/ReactCommon/ReactCommon.podspec +7 -1
  25. package/ReactCommon/cxxreact/React-cxxreact.podspec +4 -0
  26. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  27. package/ReactCommon/hermes/React-hermes.podspec +1 -0
  28. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +4 -0
  29. package/package.json +17 -14
  30. package/sdks/hermes-engine/hermes-engine.podspec +1 -1
  31. package/sdks/hermesc/osx-bin/hermesc +0 -0
  32. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  33. package/template/_node-version +1 -1
  34. package/template/android/app/build.gradle +2 -2
  35. package/template/ios/HelloWorld/AppDelegate.mm +4 -0
  36. package/template/ios/Podfile +9 -0
  37. package/template/package.json +6 -6
  38. package/types/index.d.ts +1 -1
@@ -77,6 +77,7 @@ export interface AlertStatic {
77
77
  type?: AlertType,
78
78
  defaultValue?: string,
79
79
  keyboardType?: string,
80
+ options?: AlertOptions,
80
81
  ) => void;
81
82
  }
82
83
 
@@ -9,13 +9,8 @@
9
9
  #import <React/RCTBridgeDelegate.h>
10
10
  #import <UIKit/UIKit.h>
11
11
 
12
- #if RCT_NEW_ARCH_ENABLED
13
- // When the new architecture is enabled, the RCTAppDelegate imports some additional headers
14
- #import <React/RCTCxxBridgeDelegate.h>
15
- #import <React/RCTSurfacePresenterBridgeAdapter.h>
16
- #import <ReactCommon/RCTTurboModuleManager.h>
17
-
18
- #endif
12
+ @class RCTSurfacePresenterBridgeAdapter;
13
+ @class RCTTurboModuleManager;
19
14
 
20
15
  /**
21
16
  * The RCTAppDelegate is an utility class that implements some base configurations for all the React Native apps.
@@ -60,6 +55,7 @@
60
55
  @property (nonatomic, strong) UIWindow *window;
61
56
  @property (nonatomic, strong) RCTBridge *bridge;
62
57
  @property (nonatomic, strong) NSString *moduleName;
58
+ @property (nonatomic, strong) NSDictionary *initialProps;
63
59
 
64
60
  /**
65
61
  * It creates a `RCTBridge` using a delegate and some launch options.
@@ -98,11 +94,7 @@
98
94
  */
99
95
  - (UIViewController *)createRootViewController;
100
96
 
101
- @end
102
-
103
97
  #if RCT_NEW_ARCH_ENABLED
104
- /// Extension that makes the RCTAppDelegate conform to New Architecture delegates
105
- @interface RCTAppDelegate () <RCTTurboModuleManagerDelegate, RCTCxxBridgeDelegate>
106
98
 
107
99
  /// The TurboModule manager
108
100
  @property (nonatomic, strong) RCTTurboModuleManager *turboModuleManager;
@@ -126,5 +118,6 @@
126
118
  /// @return: `true` if the Fabric Renderer is enabled. Otherwise, it returns `false`.
127
119
  - (BOOL)fabricEnabled;
128
120
 
129
- @end
130
121
  #endif
122
+
123
+ @end
@@ -11,13 +11,16 @@
11
11
 
12
12
  #if RCT_NEW_ARCH_ENABLED
13
13
  #import <React/CoreModulesPlugins.h>
14
+ #import <React/RCTCxxBridgeDelegate.h>
14
15
  #import <React/RCTFabricSurfaceHostingProxyRootView.h>
15
16
  #import <React/RCTSurfacePresenter.h>
17
+ #import <React/RCTSurfacePresenterBridgeAdapter.h>
18
+ #import <ReactCommon/RCTTurboModuleManager.h>
16
19
  #import <react/config/ReactNativeConfig.h>
17
20
 
18
21
  static NSString *const kRNConcurrentRoot = @"concurrentRoot";
19
22
 
20
- @interface RCTAppDelegate () {
23
+ @interface RCTAppDelegate () <RCTTurboModuleManagerDelegate, RCTCxxBridgeDelegate> {
21
24
  std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
22
25
  facebook::react::ContextContainer::Shared _contextContainer;
23
26
  }
@@ -81,7 +84,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
81
84
 
82
85
  - (NSDictionary *)prepareInitialProps
83
86
  {
84
- NSMutableDictionary *initProps = [NSMutableDictionary new];
87
+ NSMutableDictionary *initProps = self.initialProps ? [self.initialProps mutableCopy] : [NSMutableDictionary new];
85
88
 
86
89
  #ifdef RCT_NEW_ARCH_ENABLED
87
90
  initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
@@ -45,4 +45,8 @@ Pod::Spec.new do |s|
45
45
  s.dependency "React-Core/RCTBlobHeaders", version
46
46
  s.dependency "React-Core/RCTWebSocket", version
47
47
  s.dependency "React-RCTNetwork", version
48
+
49
+ if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
50
+ s.dependency "hermes-engine"
51
+ end
48
52
  end
@@ -45,6 +45,16 @@ export type KeyboardTypeOptions =
45
45
  | KeyboardTypeAndroid
46
46
  | KeyboardTypeIOS;
47
47
 
48
+ export type InputModeOptions =
49
+ | 'none'
50
+ | 'text'
51
+ | 'decimal'
52
+ | 'numeric'
53
+ | 'tel'
54
+ | 'search'
55
+ | 'email'
56
+ | 'url';
57
+
48
58
  export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
49
59
  export type ReturnKeyTypeAndroid = 'none' | 'previous';
50
60
  export type ReturnKeyTypeIOS =
@@ -588,6 +598,11 @@ export interface TextInputProps
588
598
  */
589
599
  keyboardType?: KeyboardTypeOptions | undefined;
590
600
 
601
+ /**
602
+ * Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType.
603
+ */
604
+ inputMode?: InputModeOptions | undefined;
605
+
591
606
  /**
592
607
  * Limits the maximum number of characters that can be entered.
593
608
  * Use this instead of implementing the logic in JS to avoid flicker.
@@ -251,6 +251,12 @@ export interface AccessibilityPropsAndroid {
251
251
  | 'no'
252
252
  | 'no-hide-descendants'
253
253
  | undefined;
254
+
255
+ /**
256
+ * A reference to another element `nativeID` used to build complex forms. The value of `accessibilityLabelledBy` should match the `nativeID` of the related element.
257
+ * @platform android
258
+ */
259
+ accessibilityLabelledBy?: string | string[] | undefined;
254
260
  }
255
261
 
256
262
  export interface AccessibilityPropsIOS {
@@ -290,6 +296,13 @@ export interface AccessibilityPropsIOS {
290
296
  * @platform ios
291
297
  */
292
298
  accessibilityIgnoresInvertColors?: boolean | undefined;
299
+
300
+ /**
301
+ * By using the accessibilityLanguage property, the screen reader will understand which language to use while reading the element's label, value and hint. The provided string value must follow the BCP 47 specification (https://www.rfc-editor.org/info/bcp47).
302
+ * https://reactnative.dev/docs/accessibility#accessibilitylanguage-ios
303
+ * @platform ios
304
+ */
305
+ accessibilityLanguage?: string | undefined;
293
306
  }
294
307
 
295
308
  export type Role =
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 71,
15
- patch: 0,
15
+ patch: 2,
16
16
  prerelease: null,
17
17
  };
@@ -860,16 +860,19 @@ export default class VirtualizedList extends StateSafePureComponent<
860
860
  <ListEmptyComponent />
861
861
  )): any);
862
862
  cells.push(
863
- React.cloneElement(element, {
864
- key: '$empty',
865
- onLayout: event => {
866
- this._onLayoutEmpty(event);
867
- if (element.props.onLayout) {
868
- element.props.onLayout(event);
869
- }
870
- },
871
- style: StyleSheet.compose(inversionStyle, element.props.style),
872
- }),
863
+ <VirtualizedListCellContextProvider
864
+ cellKey={this._getCellKey() + '-empty'}
865
+ key="$empty">
866
+ {React.cloneElement(element, {
867
+ onLayout: (event: LayoutEvent) => {
868
+ this._onLayoutEmpty(event);
869
+ if (element.props.onLayout) {
870
+ element.props.onLayout(event);
871
+ }
872
+ },
873
+ style: StyleSheet.compose(inversionStyle, element.props.style),
874
+ })}
875
+ </VirtualizedListCellContextProvider>,
873
876
  );
874
877
  }
875
878
 
@@ -12,10 +12,20 @@
12
12
 
13
13
  const invariant = require('invariant');
14
14
 
15
- function processAspectRatio(aspectRatio: number | string): ?number {
15
+ function processAspectRatio(aspectRatio?: number | string): ?number {
16
16
  if (typeof aspectRatio === 'number') {
17
17
  return aspectRatio;
18
18
  }
19
+ if (typeof aspectRatio !== 'string') {
20
+ if (__DEV__) {
21
+ invariant(
22
+ !aspectRatio,
23
+ 'aspectRatio must either be a number, a ratio string or `auto`. You passed: %s',
24
+ aspectRatio,
25
+ );
26
+ }
27
+ return;
28
+ }
19
29
 
20
30
  const matches = aspectRatio.split('/').map(s => s.trim());
21
31
 
@@ -34,7 +44,7 @@ function processAspectRatio(aspectRatio: number | string): ?number {
34
44
  if (__DEV__) {
35
45
  invariant(
36
46
  !hasNonNumericValues && (matches.length === 1 || matches.length === 2),
37
- 'aspectRatio must either be a number, a ratio or `auto`. You passed: %s',
47
+ 'aspectRatio must either be a number, a ratio string or `auto`. You passed: %s',
38
48
  aspectRatio,
39
49
  );
40
50
  }
@@ -168,6 +168,8 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
168
168
 
169
169
  @implementation RCTBackedTextViewDelegateAdapter {
170
170
  __weak UITextView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
171
+ NSAttributedString *_lastStringStateWasUpdatedWith;
172
+ BOOL _ignoreNextTextInputCall;
171
173
  BOOL _textDidChangeIsComing;
172
174
  UITextRange *_previousSelectedTextRange;
173
175
  }
@@ -254,12 +256,21 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
254
256
 
255
257
  - (void)textViewDidChange:(__unused UITextView *)textView
256
258
  {
259
+ if (_ignoreNextTextInputCall && [_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
260
+ _ignoreNextTextInputCall = NO;
261
+ return;
262
+ }
263
+ _lastStringStateWasUpdatedWith = _backedTextInputView.attributedText;
257
264
  _textDidChangeIsComing = NO;
258
265
  [_backedTextInputView.textInputDelegate textInputDidChange];
259
266
  }
260
267
 
261
268
  - (void)textViewDidChangeSelection:(__unused UITextView *)textView
262
269
  {
270
+ if (![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
271
+ [self textViewDidChange:_backedTextInputView];
272
+ _ignoreNextTextInputCall = YES;
273
+ }
263
274
  [self textViewProbablyDidChangeSelection];
264
275
  }
265
276
 
@@ -9,7 +9,5 @@
9
9
 
10
10
  import {TurboModule} from './RCTExport';
11
11
 
12
- export const TurboModuleRegistry: {
13
- get<T extends TurboModule>(name: string): T | null;
14
- getEnforcing<T extends TurboModule>(name: string): T;
15
- };
12
+ export function get<T extends TurboModule>(name: string): T | null;
13
+ export function getEnforcing<T extends TurboModule>(name: string): T;
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(71),
26
- RCTVersionPatch: @(0),
26
+ RCTVersionPatch: @(2),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -20,10 +20,24 @@
20
20
  - (UIWindow *)alertWindow
21
21
  {
22
22
  if (_alertWindow == nil) {
23
- _alertWindow = [[UIWindow alloc] initWithFrame:RCTSharedApplication().keyWindow.bounds];
24
- _alertWindow.rootViewController = [UIViewController new];
25
- _alertWindow.windowLevel = UIWindowLevelAlert + 1;
23
+ _alertWindow = [self getUIWindowFromScene];
24
+
25
+ if (_alertWindow == nil) {
26
+ UIWindow *keyWindow = RCTSharedApplication().keyWindow;
27
+ if (keyWindow) {
28
+ _alertWindow = [[UIWindow alloc] initWithFrame:keyWindow.bounds];
29
+ } else {
30
+ // keyWindow is nil, so we cannot create and initialize _alertWindow
31
+ NSLog(@"Unable to create alert window: keyWindow is nil");
32
+ }
33
+ }
34
+
35
+ if (_alertWindow) {
36
+ _alertWindow.rootViewController = [UIViewController new];
37
+ _alertWindow.windowLevel = UIWindowLevelAlert + 1;
38
+ }
26
39
  }
40
+
27
41
  return _alertWindow;
28
42
  }
29
43
 
@@ -49,4 +63,17 @@
49
63
  _alertWindow = nil;
50
64
  }
51
65
 
66
+ - (UIWindow *)getUIWindowFromScene
67
+ {
68
+ if (@available(iOS 13.0, *)) {
69
+ for (UIScene *scene in RCTSharedApplication().connectedScenes) {
70
+ if (scene.activationState == UISceneActivationStateForegroundActive &&
71
+ [scene isKindOfClass:[UIWindowScene class]]) {
72
+ return [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
73
+ }
74
+ }
75
+ }
76
+ return nil;
77
+ }
78
+
52
79
  @end
@@ -110,6 +110,20 @@ RCT_EXPORT_MODULE()
110
110
  return;
111
111
  }
112
112
 
113
+ // Input validation
114
+ if (message == nil || [message isEqualToString:@""]) {
115
+ NSLog(@"Error: message cannot be nil or empty");
116
+ return;
117
+ }
118
+ if (color == nil) {
119
+ NSLog(@"Error: color cannot be nil");
120
+ return;
121
+ }
122
+ if (backgroundColor == nil) {
123
+ NSLog(@"Error: backgroundColor cannot be nil");
124
+ return;
125
+ }
126
+
113
127
  dispatch_async(dispatch_get_main_queue(), ^{
114
128
  self->_showDate = [NSDate date];
115
129
  if (!self->_window && !RCTRunningInTestEnvironment()) {
@@ -44,4 +44,5 @@ Pod::Spec.new do |s|
44
44
  s.dependency "React-RCTImage", version
45
45
  s.dependency "ReactCommon/turbomodule/core", version
46
46
  s.dependency "React-jsi", version
47
+ s.dependency 'React-RCTBlob'
47
48
  end
@@ -75,13 +75,15 @@ RCT_EXPORT_MODULE()
75
75
  modalHostView.onShow(nil);
76
76
  }
77
77
  };
78
- if (_presentationBlock) {
79
- _presentationBlock([modalHostView reactViewController], viewController, animated, completionBlock);
80
- } else {
81
- [[modalHostView reactViewController] presentViewController:viewController
82
- animated:animated
83
- completion:completionBlock];
84
- }
78
+ dispatch_async(dispatch_get_main_queue(), ^{
79
+ if (self->_presentationBlock) {
80
+ self->_presentationBlock([modalHostView reactViewController], viewController, animated, completionBlock);
81
+ } else {
82
+ [[modalHostView reactViewController] presentViewController:viewController
83
+ animated:animated
84
+ completion:completionBlock];
85
+ }
86
+ });
85
87
  }
86
88
 
87
89
  - (void)dismissModalHostView:(RCTModalHostView *)modalHostView
@@ -93,11 +95,13 @@ RCT_EXPORT_MODULE()
93
95
  [[self.bridge moduleForClass:[RCTModalManager class]] modalDismissed:modalHostView.identifier];
94
96
  }
95
97
  };
96
- if (_dismissalBlock) {
97
- _dismissalBlock([modalHostView reactViewController], viewController, animated, completionBlock);
98
- } else {
99
- [viewController.presentingViewController dismissViewControllerAnimated:animated completion:completionBlock];
100
- }
98
+ dispatch_async(dispatch_get_main_queue(), ^{
99
+ if (self->_dismissalBlock) {
100
+ self->_dismissalBlock([modalHostView reactViewController], viewController, animated, completionBlock);
101
+ } else {
102
+ [viewController.presentingViewController dismissViewControllerAnimated:animated completion:completionBlock];
103
+ }
104
+ });
101
105
  }
102
106
 
103
107
  - (RCTShadowView *)shadowView
@@ -75,12 +75,20 @@ Pod::Spec.new do |s|
75
75
 
76
76
  s.subspec "Default" do |ss|
77
77
  ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
78
- ss.exclude_files = "React/CoreModules/**/*",
79
- "React/DevSupport/**/*",
80
- "React/Fabric/**/*",
81
- "React/FBReactNativeSpec/**/*",
82
- "React/Tests/**/*",
83
- "React/Inspector/**/*"
78
+ exclude_files = [
79
+ "React/CoreModules/**/*",
80
+ "React/DevSupport/**/*",
81
+ "React/Fabric/**/*",
82
+ "React/FBReactNativeSpec/**/*",
83
+ "React/Tests/**/*",
84
+ "React/Inspector/**/*"
85
+ ]
86
+ # If we are using Hermes (the default is use hermes, so USE_HERMES can be nil), we don't have jsc installed
87
+ # So we have to exclude the JSCExecutorFactory
88
+ if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
89
+ exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
90
+ end
91
+ ss.exclude_files = exclude_files
84
92
  ss.private_header_files = "React/Cxx*/*.h"
85
93
  end
86
94
 
@@ -114,4 +122,11 @@ Pod::Spec.new do |s|
114
122
  s.dependency "React-jsiexecutor", version
115
123
  s.dependency "Yoga"
116
124
  s.dependency "glog"
125
+
126
+ if ENV['USE_HERMES'] == "0"
127
+ s.dependency 'React-jsc'
128
+ else
129
+ s.dependency 'React-hermes'
130
+ s.dependency 'hermes-engine'
131
+ end
117
132
  end
@@ -39,6 +39,16 @@ def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File(
39
39
  def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
40
40
  def reactNativeRootDir = projectDir.parent
41
41
 
42
+ // We put the publishing version from gradle.properties inside ext. so other
43
+ // subprojects can access it as well.
44
+ ext.publishing_version = VERSION_NAME
45
+
46
+ // This is the version of CMake we're requesting to the Android SDK to use.
47
+ // If missing it will be downloaded automatically. Only CMake versions shipped with the
48
+ // Android SDK are supported (you can find them listed in the SDK Manager of Android Studio).
49
+ def cmakeVersion = System.getenv("CMAKE_VERSION") ?: "3.22.1"
50
+ ext.cmake_version = cmakeVersion
51
+
42
52
  // You need to have following folders in this directory:
43
53
  // - boost_1_76_0
44
54
  // - double-conversion-1.1.6
@@ -217,15 +227,15 @@ final def preparePrefab = tasks.register("preparePrefab", PreparePrefabHeadersTa
217
227
  new Pair("../ReactCommon/cxxreact/", "cxxreact/"),
218
228
  ]
219
229
  ),
230
+ new PrefabPreprocessingEntry(
231
+ "jsinspector",
232
+ new Pair("../ReactCommon/jsinspector/", "jsinspector/"),
233
+ ),
220
234
  ]
221
235
  )
222
236
  it.outputDir.set(prefabHeadersDir)
223
237
  }
224
238
 
225
- // We put the publishing version from gradle.properties inside ext. so other
226
- // subprojects can access it as well.
227
- ext.publishing_version = VERSION_NAME
228
-
229
239
  task createNativeDepsDirectories {
230
240
  downloadsDir.mkdirs()
231
241
  thirdPartyNdkDir.mkdirs()
@@ -474,7 +484,8 @@ android {
474
484
  "react_render_scheduler",
475
485
  "react_render_mounting",
476
486
  "hermes_executor",
477
- "jscexecutor"
487
+ "jscexecutor",
488
+ "jsinspector"
478
489
  }
479
490
  }
480
491
  ndk {
@@ -484,6 +495,7 @@ android {
484
495
 
485
496
  externalNativeBuild {
486
497
  cmake {
498
+ version cmakeVersion
487
499
  path "src/main/jni/CMakeLists.txt"
488
500
  }
489
501
  }
@@ -600,6 +612,9 @@ android {
600
612
  jscexecutor {
601
613
  headers(new File(prefabHeadersDir, "jscexecutor").absolutePath)
602
614
  }
615
+ jsinspector {
616
+ headers(new File(prefabHeadersDir, "jsinspector").absolutePath)
617
+ }
603
618
  }
604
619
 
605
620
  publishing {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.71.0
1
+ VERSION_NAME=0.71.2
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -16,18 +16,19 @@ plugins {
16
16
 
17
17
  group = "com.facebook.react"
18
18
  version = parent.publishing_version
19
+ def cmakeVersion = parent.cmake_version
19
20
 
20
- def cmakeVersion = "3.18.1"
21
21
  /**
22
22
  * We use the bundled version of CMake in the Android SDK if available, to don't force Android
23
23
  * users to install CMake externally.
24
24
  */
25
25
  def findCmakePath(cmakeVersion) {
26
- if (System.getenv("ANDROID_SDK_ROOT")) {
27
- return "${System.getenv("ANDROID_SDK_ROOT")}/cmake/${cmakeVersion}/bin/cmake"
26
+ def cmakeRelativePath = "/cmake/${cmakeVersion}/bin/cmake"
27
+ if (System.getenv("ANDROID_SDK_ROOT") && new File("${System.getenv("ANDROID_SDK_ROOT")}/${cmakeRelativePath}").exists()) {
28
+ return "${System.getenv("ANDROID_SDK_ROOT")}/${cmakeRelativePath}"
28
29
  }
29
- if (System.getenv("ANDROID_HOME")) {
30
- return "${System.getenv("ANDROID_HOME")}/cmake/${cmakeVersion}/bin/cmake"
30
+ if (System.getenv("ANDROID_HOME") && new File("${System.getenv("ANDROID_HOME")}/${cmakeRelativePath}").exists()) {
31
+ return "${System.getenv("ANDROID_HOME")}/${cmakeRelativePath}"
31
32
  }
32
33
  return "cmake"
33
34
  }
@@ -15,6 +15,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
15
15
  import android.app.Activity;
16
16
  import android.content.Context;
17
17
  import android.graphics.Canvas;
18
+ import android.graphics.Insets;
18
19
  import android.graphics.Point;
19
20
  import android.graphics.Rect;
20
21
  import android.os.Build;
@@ -33,8 +34,6 @@ import android.view.WindowManager;
33
34
  import android.widget.FrameLayout;
34
35
  import androidx.annotation.Nullable;
35
36
  import androidx.annotation.RequiresApi;
36
- import androidx.core.graphics.Insets;
37
- import androidx.core.view.WindowInsetsCompat;
38
37
  import com.facebook.common.logging.FLog;
39
38
  import com.facebook.infer.annotation.Assertions;
40
39
  import com.facebook.infer.annotation.ThreadConfined;
@@ -776,7 +775,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
776
775
 
777
776
  @VisibleForTesting
778
777
  /* package */ void simulateCheckForKeyboardForTesting() {
779
- if (Build.VERSION.SDK_INT >= 23) {
778
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
780
779
  getCustomGlobalLayoutListener().checkForKeyboardEvents();
781
780
  } else {
782
781
  getCustomGlobalLayoutListener().checkForKeyboardEventsLegacy();
@@ -907,9 +906,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
907
906
  return;
908
907
  }
909
908
 
910
- // WindowInsetsCompat IME measurement is reliable for API level 23+.
911
- // https://developer.android.com/jetpack/androidx/releases/core#1.5.0-alpha02
912
- if (Build.VERSION.SDK_INT >= 23) {
909
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
913
910
  checkForKeyboardEvents();
914
911
  } else {
915
912
  checkForKeyboardEventsLegacy();
@@ -919,19 +916,21 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
919
916
  checkForDeviceDimensionsChanges();
920
917
  }
921
918
 
922
- @RequiresApi(api = Build.VERSION_CODES.M)
919
+ @RequiresApi(api = Build.VERSION_CODES.R)
923
920
  private void checkForKeyboardEvents() {
924
921
  getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
925
922
  WindowInsets rootInsets = getRootView().getRootWindowInsets();
926
- WindowInsetsCompat compatRootInsets = WindowInsetsCompat.toWindowInsetsCompat(rootInsets);
923
+ if (rootInsets == null) {
924
+ return;
925
+ }
927
926
 
928
- boolean keyboardIsVisible = compatRootInsets.isVisible(WindowInsetsCompat.Type.ime());
927
+ boolean keyboardIsVisible = rootInsets.isVisible(WindowInsets.Type.ime());
929
928
  if (keyboardIsVisible != mKeyboardIsVisible) {
930
929
  mKeyboardIsVisible = keyboardIsVisible;
931
930
 
932
931
  if (keyboardIsVisible) {
933
- Insets imeInsets = compatRootInsets.getInsets(WindowInsetsCompat.Type.ime());
934
- Insets barInsets = compatRootInsets.getInsets(WindowInsetsCompat.Type.systemBars());
932
+ Insets imeInsets = rootInsets.getInsets(WindowInsets.Type.ime());
933
+ Insets barInsets = rootInsets.getInsets(WindowInsets.Type.systemBars());
935
934
  int height = imeInsets.bottom - barInsets.bottom;
936
935
 
937
936
  int softInputMode = ((Activity) getContext()).getWindow().getAttributes().softInputMode;
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 71,
20
- "patch", 0,
20
+ "patch", 2,
21
21
  "prerelease", null);
22
22
  }
@@ -585,6 +585,10 @@ public class ReactEditText extends AppCompatEditText
585
585
  new SpannableStringBuilder(reactTextUpdate.getText());
586
586
 
587
587
  manageSpans(spannableStringBuilder, reactTextUpdate.mContainsMultipleFragments);
588
+
589
+ // Mitigation for https://github.com/facebook/react-native/issues/35936 (S318090)
590
+ stripAbsoluteSizeSpans(spannableStringBuilder);
591
+
588
592
  mContainsImages = reactTextUpdate.containsImages();
589
593
 
590
594
  // When we update text, we trigger onChangeText code that will
@@ -658,6 +662,27 @@ public class ReactEditText extends AppCompatEditText
658
662
  }
659
663
  }
660
664
 
665
+ private void stripAbsoluteSizeSpans(SpannableStringBuilder sb) {
666
+ // We have already set a font size on the EditText itself. We can safely remove sizing spans
667
+ // which are the same as the set font size, and not otherwise overlapped.
668
+ final int effectiveFontSize = mTextAttributes.getEffectiveFontSize();
669
+ ReactAbsoluteSizeSpan[] spans = sb.getSpans(0, sb.length(), ReactAbsoluteSizeSpan.class);
670
+
671
+ outerLoop:
672
+ for (ReactAbsoluteSizeSpan span : spans) {
673
+ ReactAbsoluteSizeSpan[] overlappingSpans =
674
+ sb.getSpans(sb.getSpanStart(span), sb.getSpanEnd(span), ReactAbsoluteSizeSpan.class);
675
+
676
+ for (ReactAbsoluteSizeSpan overlappingSpan : overlappingSpans) {
677
+ if (span.getSize() != effectiveFontSize) {
678
+ continue outerLoop;
679
+ }
680
+ }
681
+
682
+ sb.removeSpan(span);
683
+ }
684
+ }
685
+
661
686
  private static boolean sameTextForSpan(
662
687
  final Editable oldText,
663
688
  final SpannableStringBuilder newText,
@@ -19,7 +19,7 @@ end
19
19
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
20
20
  folly_version = '2021.07.22.00'
21
21
  boost_compiler_flags = '-Wno-documentation'
22
-
22
+ using_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
23
23
  Pod::Spec.new do |s|
24
24
  s.name = "ReactCommon"
25
25
  s.module_name = "ReactCommon"
@@ -49,6 +49,9 @@ Pod::Spec.new do |s|
49
49
  s.dependency "React-logger", version
50
50
  ss.dependency "DoubleConversion"
51
51
  ss.dependency "glog"
52
+ if using_hermes
53
+ ss.dependency "hermes-engine"
54
+ end
52
55
 
53
56
  ss.subspec "bridging" do |sss|
54
57
  sss.dependency "React-jsi", version
@@ -56,6 +59,9 @@ Pod::Spec.new do |s|
56
59
  sss.exclude_files = "react/bridging/tests"
57
60
  sss.header_dir = "react/bridging"
58
61
  sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
62
+ if using_hermes
63
+ sss.dependency "hermes-engine"
64
+ end
59
65
  end
60
66
 
61
67
  ss.subspec "core" do |sss|
@@ -46,4 +46,8 @@ Pod::Spec.new do |s|
46
46
  s.dependency "React-perflogger", version
47
47
  s.dependency "React-jsi", version
48
48
  s.dependency "React-logger", version
49
+
50
+ if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
51
+ s.dependency 'hermes-engine'
52
+ end
49
53
  end
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 71;
20
- int32_t Patch = 0;
20
+ int32_t Patch = 2;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -52,4 +52,5 @@ Pod::Spec.new do |s|
52
52
  s.dependency "glog"
53
53
  s.dependency "RCT-Folly/Futures", folly_version
54
54
  s.dependency "hermes-engine"
55
+ s.dependency "React-jsi"
55
56
  end
@@ -40,4 +40,8 @@ Pod::Spec.new do |s|
40
40
  s.dependency "RCT-Folly", folly_version
41
41
  s.dependency "DoubleConversion"
42
42
  s.dependency "glog"
43
+
44
+ if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
45
+ s.dependency 'hermes-engine'
46
+ end
43
47
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.71.0",
3
+ "version": "0.71.2",
4
4
  "bin": "./cli.js",
5
5
  "description": "A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
  "prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
86
86
  "format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
87
87
  "update-lock": "npx yarn-deduplicate",
88
- "docker-setup-android": "docker pull reactnativecommunity/react-native-android:6.1",
88
+ "docker-setup-android": "docker pull reactnativecommunity/react-native-android:6.2",
89
89
  "docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .",
90
90
  "test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh",
91
91
  "test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh",
@@ -98,16 +98,18 @@
98
98
  "test-e2e-local-clean": "node ./scripts/test-e2e-local-clean.js",
99
99
  "test-ios": "./scripts/objc-test.sh test",
100
100
  "test-typescript": "dtslint types",
101
- "test-typescript-offline": "dtslint --localTs node_modules/typescript/lib types"
101
+ "test-typescript-offline": "dtslint --localTs node_modules/typescript/lib types",
102
+ "bump-all-updated-packages": "node ./scripts/monorepo/bump-all-updated-packages",
103
+ "align-package-versions": "node ./scripts/monorepo/align-package-versions.js"
102
104
  },
103
105
  "peerDependencies": {
104
106
  "react": "18.2.0"
105
107
  },
106
108
  "dependencies": {
107
109
  "@jest/create-cache-key-function": "^29.2.1",
108
- "@react-native-community/cli": "10.0.0",
109
- "@react-native-community/cli-platform-android": "10.0.0",
110
- "@react-native-community/cli-platform-ios": "10.0.0",
110
+ "@react-native-community/cli": "10.1.3",
111
+ "@react-native-community/cli-platform-android": "10.1.3",
112
+ "@react-native-community/cli-platform-ios": "10.1.1",
111
113
  "@react-native/assets": "1.0.0",
112
114
  "@react-native/normalize-color": "2.1.0",
113
115
  "@react-native/polyfills": "2.0.0",
@@ -120,15 +122,15 @@
120
122
  "jest-environment-node": "^29.2.1",
121
123
  "jsc-android": "^250230.2.1",
122
124
  "memoize-one": "^5.0.0",
123
- "metro-react-native-babel-transformer": "0.73.5",
124
- "metro-runtime": "0.73.5",
125
- "metro-source-map": "0.73.5",
125
+ "metro-react-native-babel-transformer": "0.73.7",
126
+ "metro-runtime": "0.73.7",
127
+ "metro-source-map": "0.73.7",
126
128
  "mkdirp": "^0.5.1",
127
129
  "nullthrows": "^1.1.1",
128
130
  "pretty-format": "^26.5.2",
129
131
  "promise": "^8.3.0",
130
132
  "react-devtools-core": "^4.26.1",
131
- "react-native-gradle-plugin": "^0.71.12",
133
+ "react-native-gradle-plugin": "^0.71.14",
132
134
  "react-refresh": "^0.4.0",
133
135
  "react-shallow-renderer": "^16.15.0",
134
136
  "regenerator-runtime": "^0.13.2",
@@ -144,10 +146,11 @@
144
146
  "hermes-eslint": "0.8.0",
145
147
  "react": "18.2.0",
146
148
  "react-test-renderer": "18.2.0",
147
- "@babel/core": "^7.14.0",
149
+ "@babel/core": "^7.20.0",
148
150
  "@babel/eslint-parser": "^7.18.2",
149
- "@babel/generator": "^7.14.0",
151
+ "@babel/generator": "^7.20.0",
150
152
  "@babel/plugin-transform-regenerator": "^7.0.0",
153
+ "@babel/preset-flow": "^7.18.0",
151
154
  "@definitelytyped/dtslint": "^0.0.127",
152
155
  "@react-native-community/eslint-config": "*",
153
156
  "@react-native-community/eslint-plugin": "*",
@@ -176,8 +179,8 @@
176
179
  "jest": "^29.2.1",
177
180
  "jest-junit": "^10.0.0",
178
181
  "jscodeshift": "^0.13.1",
179
- "metro-babel-register": "0.73.5",
180
- "metro-memory-fs": "0.73.5",
182
+ "metro-babel-register": "0.73.7",
183
+ "metro-memory-fs": "0.73.7",
181
184
  "mkdirp": "^0.5.1",
182
185
  "mock-fs": "^5.1.4",
183
186
  "prettier": "^2.4.1",
@@ -43,7 +43,7 @@ elsif isNightly
43
43
  destination_path = download_nightly_hermes(react_native_path, version)
44
44
  # set tarball as hermes engine
45
45
  source[:http] = "file://#{destination_path}"
46
- elsif File.exists?(hermestag_file) && isInCI
46
+ elsif File.exist?(hermestag_file) && isInCI
47
47
  Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source but fetched from tag...'.yellow if Object.const_defined?("Pod::UI")
48
48
  hermestag = File.read(hermestag_file).strip
49
49
  source[:git] = git
Binary file
Binary file
@@ -1 +1 @@
1
- 16
1
+ 18
@@ -12,9 +12,9 @@ react {
12
12
  // The root of your project, i.e. where "package.json" lives. Default is '..'
13
13
  // root = file("../")
14
14
  // The folder where the react-native NPM package is. Default is ../node_modules/react-native
15
- // reactNativeDir = file("../node-modules/react-native")
15
+ // reactNativeDir = file("../node_modules/react-native")
16
16
  // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17
- // codegenDir = file("../node-modules/react-native-codegen")
17
+ // codegenDir = file("../node_modules/react-native-codegen")
18
18
  // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
19
19
  // cliFile = file("../node_modules/react-native/cli.js")
20
20
 
@@ -7,6 +7,10 @@
7
7
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8
8
  {
9
9
  self.moduleName = @"HelloWorld";
10
+ // You can add your custom initial props in the dictionary below.
11
+ // They will be passed down to the ViewController used by React Native.
12
+ self.initialProps = @{};
13
+
10
14
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
11
15
  }
12
16
 
@@ -4,6 +4,15 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
4
4
  platform :ios, min_ios_version_supported
5
5
  prepare_react_native_project!
6
6
 
7
+ # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
8
+ # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
9
+ #
10
+ # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
11
+ # ```js
12
+ # module.exports = {
13
+ # dependencies: {
14
+ # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
15
+ # ```
7
16
  flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
8
17
 
9
18
  linkage = ENV['USE_FRAMEWORKS']
@@ -11,13 +11,13 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.71.0"
14
+ "react-native": "0.71.2"
15
15
  },
16
16
  "devDependencies": {
17
- "@babel/core": "^7.12.9",
18
- "@babel/preset-env": "^7.14.0",
19
- "@babel/runtime": "^7.12.5",
20
- "@react-native-community/eslint-config": "^3.0.0",
17
+ "@babel/core": "^7.20.0",
18
+ "@babel/preset-env": "^7.20.0",
19
+ "@babel/runtime": "^7.20.0",
20
+ "@react-native-community/eslint-config": "^3.2.0",
21
21
  "@tsconfig/react-native": "^2.0.2",
22
22
  "@types/jest": "^29.2.1",
23
23
  "@types/react": "^18.0.24",
@@ -25,7 +25,7 @@
25
25
  "babel-jest": "^29.2.1",
26
26
  "eslint": "^8.19.0",
27
27
  "jest": "^29.2.1",
28
- "metro-react-native-babel-preset": "0.73.5",
28
+ "metro-react-native-babel-preset": "0.73.7",
29
29
  "prettier": "^2.4.1",
30
30
  "react-test-renderer": "18.2.0",
31
31
  "typescript": "4.8.4"
package/types/index.d.ts CHANGED
@@ -139,7 +139,7 @@ export * from '../Libraries/StyleSheet/StyleSheetTypes';
139
139
  export * from '../Libraries/StyleSheet/processColor';
140
140
  export * from '../Libraries/Text/Text';
141
141
  export * from '../Libraries/TurboModule/RCTExport';
142
- export * from '../Libraries/TurboModule/TurboModuleRegistry';
142
+ export * as TurboModuleRegistry from '../Libraries/TurboModule/TurboModuleRegistry';
143
143
  export * from '../Libraries/Types/CoreEventTypes';
144
144
  export * from '../Libraries/Utilities/Appearance';
145
145
  export * from '../Libraries/Utilities/BackHandler';