react-native 0.72.3 → 0.72.5

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 (52) hide show
  1. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +1 -0
  2. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +1 -0
  3. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -0
  4. package/Libraries/Components/TextInput/TextInput.d.ts +15 -0
  5. package/Libraries/Components/TextInput/TextInput.js +8 -3
  6. package/Libraries/Core/ReactNativeVersion.js +1 -1
  7. package/Libraries/ReactNative/AppContainer.js +32 -9
  8. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -0
  9. package/React/Base/RCTBundleURLProvider.h +33 -2
  10. package/React/Base/RCTBundleURLProvider.mm +78 -15
  11. package/React/Base/RCTVersion.m +1 -1
  12. package/React/CoreModules/RCTTiming.mm +5 -0
  13. package/ReactAndroid/gradle.properties +1 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +19 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +37 -10
  16. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java +6 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +4 -0
  19. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +6 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java +19 -0
  21. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +65 -0
  22. package/ReactAndroid/src/main/jni/CMakeLists.txt +5 -0
  23. package/ReactCommon/React-Fabric.podspec +1 -1
  24. package/ReactCommon/ReactCommon.podspec +1 -1
  25. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  26. package/ReactCommon/jsc/JSCRuntime.cpp +10 -0
  27. package/ReactCommon/react/debug/React-debug.podspec +1 -1
  28. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
  29. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
  30. package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +15 -1
  31. package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h +1 -0
  32. package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +2 -0
  33. package/ReactCommon/react/renderer/core/RawPropsParser.cpp +1 -0
  34. package/ReactCommon/react/renderer/core/RawPropsPrimitives.h +4 -4
  35. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
  36. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
  37. package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +9 -5
  38. package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +1 -1
  39. package/ReactCommon/react/utils/React-utils.podspec +1 -1
  40. package/package.json +8 -8
  41. package/scripts/cocoapods/__tests__/test_utils/XcodebuildMock.rb +26 -0
  42. package/scripts/cocoapods/__tests__/utils-test.rb +115 -18
  43. package/scripts/cocoapods/helpers.rb +16 -0
  44. package/scripts/cocoapods/jsengine.rb +1 -1
  45. package/scripts/cocoapods/utils.rb +97 -8
  46. package/scripts/react_native_pods.rb +6 -2
  47. package/sdks/.hermesversion +1 -1
  48. package/sdks/hermes-engine/utils/build-apple-framework.sh +8 -1
  49. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -0
  50. package/sdks/hermesc/osx-bin/hermesc +0 -0
  51. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  52. package/template/package.json +3 -3
@@ -86,6 +86,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
86
86
  process: require('../../StyleSheet/processColor').default,
87
87
  },
88
88
  pointerEvents: true,
89
+ isInvertedVirtualizedList: true,
89
90
  },
90
91
  }
91
92
  : {
@@ -41,6 +41,7 @@ export type ScrollViewNativeProps = $ReadOnly<{
41
41
  endFillColor?: ?ColorValue,
42
42
  fadingEdgeLength?: ?number,
43
43
  indicatorStyle?: ?('default' | 'black' | 'white'),
44
+ isInvertedVirtualizedList?: ?boolean,
44
45
  keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'),
45
46
  maintainVisibleContentPosition?: ?$ReadOnly<{
46
47
  minIndexForVisible: number,
@@ -46,6 +46,7 @@ const ScrollViewViewConfig = {
46
46
  fadingEdgeLength: true,
47
47
  indicatorStyle: true,
48
48
  inverted: true,
49
+ isInvertedVirtualizedList: true,
49
50
  keyboardDismissMode: true,
50
51
  maintainVisibleContentPosition: true,
51
52
  maximumZoomScale: true,
@@ -70,6 +70,15 @@ export type ReturnKeyTypeOptions =
70
70
  | ReturnKeyTypeAndroid
71
71
  | ReturnKeyTypeIOS;
72
72
 
73
+ export type EnterKeyHintTypeAndroid = 'previous';
74
+ export type EnterKeyHintTypeIOS = 'enter';
75
+ export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
76
+
77
+ export type EnterKeyHintTypeOptions =
78
+ | EnterKeyHintType
79
+ | EnterKeyHintTypeAndroid
80
+ | EnterKeyHintTypeIOS;
81
+
73
82
  type DataDetectorTypes =
74
83
  | 'phoneNumber'
75
84
  | 'link'
@@ -779,6 +788,12 @@ export interface TextInputProps
779
788
  */
780
789
  returnKeyType?: ReturnKeyTypeOptions | undefined;
781
790
 
791
+ /**
792
+ * Determines what text should be shown to the return key on virtual keyboards.
793
+ * Has precedence over the returnKeyType prop.
794
+ */
795
+ enterKeyHint?: EnterKeyHintTypeOptions | undefined;
796
+
782
797
  /**
783
798
  * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
784
799
  * The default value is false.
@@ -223,13 +223,16 @@ export type TextContentType =
223
223
  | 'oneTimeCode';
224
224
 
225
225
  export type enterKeyHintType =
226
- | 'enter'
226
+ // Cross Platform
227
227
  | 'done'
228
228
  | 'go'
229
229
  | 'next'
230
- | 'previous'
231
230
  | 'search'
232
- | 'send';
231
+ | 'send'
232
+ // Android-only
233
+ | 'previous'
234
+ // iOS-only
235
+ | 'enter';
233
236
 
234
237
  type PasswordRules = string;
235
238
 
@@ -1344,6 +1347,7 @@ function InternalTextInput(props: Props): React.Node {
1344
1347
 
1345
1348
  const config = React.useMemo(
1346
1349
  () => ({
1350
+ hitSlop: props.hitSlop,
1347
1351
  onPress: (event: PressEvent) => {
1348
1352
  if (props.editable !== false) {
1349
1353
  if (inputRef.current != null) {
@@ -1358,6 +1362,7 @@ function InternalTextInput(props: Props): React.Node {
1358
1362
  }),
1359
1363
  [
1360
1364
  props.editable,
1365
+ props.hitSlop,
1361
1366
  props.onPressIn,
1362
1367
  props.onPressOut,
1363
1368
  props.rejectResponderTermination,
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 72,
15
- patch: 3,
15
+ patch: 5,
16
16
  prerelease: null,
17
17
  };
@@ -17,6 +17,8 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
17
17
  import {RootTagContext, createRootTag} from './RootTag';
18
18
  import * as React from 'react';
19
19
 
20
+ const reactDevToolsHook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
21
+
20
22
  type Props = $ReadOnly<{|
21
23
  children?: React.Node,
22
24
  fabric?: boolean,
@@ -47,9 +49,21 @@ class AppContainer extends React.Component<Props, State> {
47
49
  };
48
50
  _mainRef: ?React.ElementRef<typeof View>;
49
51
  _subscription: ?EventSubscription = null;
52
+ _reactDevToolsAgentListener: ?() => void = null;
50
53
 
51
54
  static getDerivedStateFromError: any = undefined;
52
55
 
56
+ mountReactDevToolsOverlays(): void {
57
+ const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
58
+ const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
59
+
60
+ const TraceUpdateOverlay =
61
+ require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
62
+ const traceUpdateOverlay = <TraceUpdateOverlay />;
63
+
64
+ this.setState({devtoolsOverlay, traceUpdateOverlay});
65
+ }
66
+
53
67
  componentDidMount(): void {
54
68
  if (__DEV__) {
55
69
  if (!this.props.internal_excludeInspector) {
@@ -71,16 +85,21 @@ class AppContainer extends React.Component<Props, State> {
71
85
  this.setState({inspector});
72
86
  },
73
87
  );
74
- if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__ != null) {
75
- const DevtoolsOverlay =
76
- require('../Inspector/DevtoolsOverlay').default;
77
- const devtoolsOverlay = (
78
- <DevtoolsOverlay inspectedView={this._mainRef} />
88
+
89
+ if (reactDevToolsHook != null) {
90
+ if (reactDevToolsHook.reactDevtoolsAgent) {
91
+ // In case if this is not the first AppContainer rendered and React DevTools are already attached
92
+ this.mountReactDevToolsOverlays();
93
+ return;
94
+ }
95
+
96
+ this._reactDevToolsAgentListener = () =>
97
+ this.mountReactDevToolsOverlays();
98
+
99
+ reactDevToolsHook.on(
100
+ 'react-devtools',
101
+ this._reactDevToolsAgentListener,
79
102
  );
80
- const TraceUpdateOverlay =
81
- require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
82
- const traceUpdateOverlay = <TraceUpdateOverlay />;
83
- this.setState({devtoolsOverlay, traceUpdateOverlay});
84
103
  }
85
104
  }
86
105
  }
@@ -90,6 +109,10 @@ class AppContainer extends React.Component<Props, State> {
90
109
  if (this._subscription != null) {
91
110
  this._subscription.remove();
92
111
  }
112
+
113
+ if (reactDevToolsHook != null && this._reactDevToolsAgentListener != null) {
114
+ reactDevToolsHook.off('react-devtools', this._reactDevToolsAgentListener);
115
+ }
93
116
  }
94
117
 
95
118
  render(): React.Node {
@@ -190,6 +190,7 @@ export interface TransformsStyle {
190
190
  | SkewYTransform
191
191
  | MatrixTransform
192
192
  )[]
193
+ | string
193
194
  | undefined;
194
195
  /**
195
196
  * @deprecated Use matrix in transform prop instead.
@@ -101,6 +101,7 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
101
101
 
102
102
  @property (nonatomic, assign) BOOL enableMinification;
103
103
  @property (nonatomic, assign) BOOL enableDev;
104
+ @property (nonatomic, assign) BOOL inlineSourceMap;
104
105
 
105
106
  /**
106
107
  * The scheme/protocol used of the packager, the default is the http protocol
@@ -125,13 +126,32 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
125
126
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
126
127
  packagerHost:(NSString *)packagerHost
127
128
  enableDev:(BOOL)enableDev
128
- enableMinification:(BOOL)enableMinification;
129
+ enableMinification:(BOOL)enableMinification
130
+ __deprecated_msg(
131
+ "Use `jsBundleURLForBundleRoot:packagerHost:enableDev:enableMinification:inlineSourceMap:` instead");
132
+
133
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
134
+ packagerHost:(NSString *)packagerHost
135
+ packagerScheme:(NSString *)scheme
136
+ enableDev:(BOOL)enableDev
137
+ enableMinification:(BOOL)enableMinification
138
+ modulesOnly:(BOOL)modulesOnly
139
+ runModule:(BOOL)runModule
140
+ __deprecated_msg(
141
+ "Use jsBundleURLForBundleRoot:packagerHost:enableDev:enableMinification:inlineSourceMap:modulesOnly:runModule:` instead");
142
+
143
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
144
+ packagerHost:(NSString *)packagerHost
145
+ enableDev:(BOOL)enableDev
146
+ enableMinification:(BOOL)enableMinification
147
+ inlineSourceMap:(BOOL)inlineSourceMap;
129
148
 
130
149
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
131
150
  packagerHost:(NSString *)packagerHost
132
151
  packagerScheme:(NSString *)scheme
133
152
  enableDev:(BOOL)enableDev
134
153
  enableMinification:(BOOL)enableMinification
154
+ inlineSourceMap:(BOOL)inlineSourceMap
135
155
  modulesOnly:(BOOL)modulesOnly
136
156
  runModule:(BOOL)runModule;
137
157
  /**
@@ -142,6 +162,17 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
142
162
  + (NSURL *)resourceURLForResourcePath:(NSString *)path
143
163
  packagerHost:(NSString *)packagerHost
144
164
  scheme:(NSString *)scheme
145
- query:(NSString *)query;
165
+ query:(NSString *)query
166
+ __deprecated_msg("Use version with queryItems parameter instead");
167
+
168
+ /**
169
+ * Given a hostname for the packager and a resource path (including "/"), return the URL to the resource.
170
+ * In general, please use the instance method to decide if the packager is running and fallback to the pre-packaged
171
+ * resource if it is not: -resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle:
172
+ */
173
+ + (NSURL *)resourceURLForResourcePath:(NSString *)path
174
+ packagerHost:(NSString *)packagerHost
175
+ scheme:(NSString *)scheme
176
+ queryItems:(NSArray<NSURLQueryItem *> *)queryItems;
146
177
 
147
178
  @end
@@ -22,10 +22,12 @@ void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed)
22
22
  kRCTAllowPackagerAccess = allowed;
23
23
  }
24
24
  #endif
25
+ static NSString *const kRCTPlatformName = @"ios";
25
26
  static NSString *const kRCTPackagerSchemeKey = @"RCT_packager_scheme";
26
27
  static NSString *const kRCTJsLocationKey = @"RCT_jsLocation";
27
28
  static NSString *const kRCTEnableDevKey = @"RCT_enableDev";
28
29
  static NSString *const kRCTEnableMinificationKey = @"RCT_enableMinification";
30
+ static NSString *const kRCTInlineSourceMapKey = @"RCT_inlineSourceMap";
29
31
 
30
32
  @implementation RCTBundleURLProvider
31
33
 
@@ -187,6 +189,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
187
189
  packagerScheme:[self packagerScheme]
188
190
  enableDev:[self enableDev]
189
191
  enableMinification:[self enableMinification]
192
+ inlineSourceMap:[self inlineSourceMap]
190
193
  modulesOnly:NO
191
194
  runModule:YES];
192
195
  }
@@ -199,6 +202,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
199
202
  packagerScheme:[self packagerScheme]
200
203
  enableDev:[self enableDev]
201
204
  enableMinification:[self enableMinification]
205
+ inlineSourceMap:[self inlineSourceMap]
202
206
  modulesOnly:YES
203
207
  runModule:NO];
204
208
  }
@@ -238,13 +242,29 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
238
242
  return [[self class] resourceURLForResourcePath:path
239
243
  packagerHost:packagerServerHostPort
240
244
  scheme:packagerServerScheme
241
- query:nil];
245
+ queryItems:nil];
242
246
  }
243
247
 
244
248
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
245
249
  packagerHost:(NSString *)packagerHost
246
250
  enableDev:(BOOL)enableDev
247
251
  enableMinification:(BOOL)enableMinification
252
+ {
253
+ return [self jsBundleURLForBundleRoot:bundleRoot
254
+ packagerHost:packagerHost
255
+ packagerScheme:nil
256
+ enableDev:enableDev
257
+ enableMinification:enableMinification
258
+ inlineSourceMap:NO
259
+ modulesOnly:NO
260
+ runModule:YES];
261
+ }
262
+
263
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
264
+ packagerHost:(NSString *)packagerHost
265
+ enableDev:(BOOL)enableDev
266
+ enableMinification:(BOOL)enableMinification
267
+ inlineSourceMap:(BOOL)inlineSourceMap
248
268
 
249
269
  {
250
270
  return [self jsBundleURLForBundleRoot:bundleRoot
@@ -252,6 +272,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
252
272
  packagerScheme:nil
253
273
  enableDev:enableDev
254
274
  enableMinification:enableMinification
275
+ inlineSourceMap:inlineSourceMap
255
276
  modulesOnly:NO
256
277
  runModule:YES];
257
278
  }
@@ -263,27 +284,45 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
263
284
  enableMinification:(BOOL)enableMinification
264
285
  modulesOnly:(BOOL)modulesOnly
265
286
  runModule:(BOOL)runModule
287
+ {
288
+ return [self jsBundleURLForBundleRoot:bundleRoot
289
+ packagerHost:packagerHost
290
+ packagerScheme:nil
291
+ enableDev:enableDev
292
+ enableMinification:enableMinification
293
+ inlineSourceMap:NO
294
+ modulesOnly:modulesOnly
295
+ runModule:runModule];
296
+ }
297
+
298
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
299
+ packagerHost:(NSString *)packagerHost
300
+ packagerScheme:(NSString *)scheme
301
+ enableDev:(BOOL)enableDev
302
+ enableMinification:(BOOL)enableMinification
303
+ inlineSourceMap:(BOOL)inlineSourceMap
304
+ modulesOnly:(BOOL)modulesOnly
305
+ runModule:(BOOL)runModule
266
306
  {
267
307
  NSString *path = [NSString stringWithFormat:@"/%@.bundle", bundleRoot];
308
+ BOOL lazy = enableDev;
309
+ NSArray<NSURLQueryItem *> *queryItems = @[
310
+ [[NSURLQueryItem alloc] initWithName:@"platform" value:kRCTPlatformName],
311
+ [[NSURLQueryItem alloc] initWithName:@"dev" value:enableDev ? @"true" : @"false"],
312
+ [[NSURLQueryItem alloc] initWithName:@"minify" value:enableMinification ? @"true" : @"false"],
313
+ [[NSURLQueryItem alloc] initWithName:@"inlineSourceMap" value:inlineSourceMap ? @"true" : @"false"],
314
+ [[NSURLQueryItem alloc] initWithName:@"modulesOnly" value:modulesOnly ? @"true" : @"false"],
315
+ [[NSURLQueryItem alloc] initWithName:@"runModule" value:runModule ? @"true" : @"false"],
268
316
  #ifdef HERMES_BYTECODE_VERSION
269
- NSString *runtimeBytecodeVersion = [NSString stringWithFormat:@"&runtimeBytecodeVersion=%u", HERMES_BYTECODE_VERSION];
270
- #else
271
- NSString *runtimeBytecodeVersion = @"";
272
- #endif
273
-
274
- // When we support only iOS 8 and above, use queryItems for a better API.
275
- NSString *query = [NSString stringWithFormat:@"platform=ios&dev=%@&minify=%@&modulesOnly=%@&runModule=%@%@",
276
- enableDev ? @"true" : @"false",
277
- enableMinification ? @"true" : @"false",
278
- modulesOnly ? @"true" : @"false",
279
- runModule ? @"true" : @"false",
280
- runtimeBytecodeVersion];
317
+ [[NSURLQueryItem alloc] initWithName:@"runtimeBytecodeVersion" value:HERMES_BYTECODE_VERSION],
318
+ #endif
319
+ ];
281
320
 
282
321
  NSString *bundleID = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleIdentifierKey];
283
322
  if (bundleID) {
284
- query = [NSString stringWithFormat:@"%@&app=%@", query, bundleID];
323
+ queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"app" value:bundleID]];
285
324
  }
286
- return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:scheme query:query];
325
+ return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:scheme queryItems:queryItems];
287
326
  }
288
327
 
289
328
  + (NSURL *)resourceURLForResourcePath:(NSString *)path
@@ -300,6 +339,20 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
300
339
  return components.URL;
301
340
  }
302
341
 
342
+ + (NSURL *)resourceURLForResourcePath:(NSString *)path
343
+ packagerHost:(NSString *)packagerHost
344
+ scheme:(NSString *)scheme
345
+ queryItems:(NSArray<NSURLQueryItem *> *)queryItems
346
+ {
347
+ NSURLComponents *components = [NSURLComponents componentsWithURL:serverRootWithHostPort(packagerHost, scheme)
348
+ resolvingAgainstBaseURL:NO];
349
+ components.path = path;
350
+ if (queryItems != nil) {
351
+ components.queryItems = queryItems;
352
+ }
353
+ return components.URL;
354
+ }
355
+
303
356
  - (void)updateValue:(id)object forKey:(NSString *)key
304
357
  {
305
358
  [[NSUserDefaults standardUserDefaults] setObject:object forKey:key];
@@ -317,6 +370,11 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
317
370
  return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTEnableMinificationKey];
318
371
  }
319
372
 
373
+ - (BOOL)inlineSourceMap
374
+ {
375
+ return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTInlineSourceMapKey];
376
+ }
377
+
320
378
  - (NSString *)jsLocation
321
379
  {
322
380
  return [[NSUserDefaults standardUserDefaults] stringForKey:kRCTJsLocationKey];
@@ -346,6 +404,11 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
346
404
  [self updateValue:@(enableMinification) forKey:kRCTEnableMinificationKey];
347
405
  }
348
406
 
407
+ - (void)setInlineSourceMap:(BOOL)inlineSourceMap
408
+ {
409
+ [self updateValue:@(inlineSourceMap) forKey:kRCTInlineSourceMapKey];
410
+ }
411
+
349
412
  - (void)setPackagerScheme:(NSString *)packagerScheme
350
413
  {
351
414
  [self updateValue:packagerScheme forKey:kRCTPackagerSchemeKey];
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(72),
26
- RCTVersionPatch: @(3),
26
+ RCTVersionPatch: @(5),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -128,6 +128,11 @@ RCT_EXPORT_MODULE()
128
128
  _paused = YES;
129
129
  _timers = [NSMutableDictionary new];
130
130
  _inBackground = NO;
131
+ RCTExecuteOnMainQueue(^{
132
+ if (!self->_inBackground && [RCTSharedApplication() applicationState] == UIApplicationStateBackground) {
133
+ [self appDidMoveToBackground];
134
+ }
135
+ });
131
136
 
132
137
  for (NSString *name in @[
133
138
  UIApplicationWillResignActiveNotification,
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.72.3
1
+ VERSION_NAME=0.72.5
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -20,6 +20,7 @@ import android.content.pm.PackageManager;
20
20
  import android.graphics.Color;
21
21
  import android.graphics.Typeface;
22
22
  import android.hardware.SensorManager;
23
+ import android.os.Build;
23
24
  import android.util.Pair;
24
25
  import android.view.Gravity;
25
26
  import android.view.View;
@@ -1142,7 +1143,7 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
1142
1143
  if (!mIsReceiverRegistered) {
1143
1144
  IntentFilter filter = new IntentFilter();
1144
1145
  filter.addAction(getReloadAppAction(mApplicationContext));
1145
- mApplicationContext.registerReceiver(mReloadAppBroadcastReceiver, filter);
1146
+ compatRegisterReceiver(mApplicationContext, mReloadAppBroadcastReceiver, filter, true);
1146
1147
  mIsReceiverRegistered = true;
1147
1148
  }
1148
1149
 
@@ -1258,4 +1259,21 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
1258
1259
 
1259
1260
  return mSurfaceDelegateFactory.createSurfaceDelegate(moduleName);
1260
1261
  }
1262
+
1263
+ /**
1264
+ * Starting with Android 14, apps and services that target Android 14 and use context-registered
1265
+ * receivers are required to specify a flag to indicate whether or not the receiver should be
1266
+ * exported to all other apps on the device: either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED
1267
+ *
1268
+ * <p>https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported
1269
+ */
1270
+ private void compatRegisterReceiver(
1271
+ Context context, BroadcastReceiver receiver, IntentFilter filter, boolean exported) {
1272
+ if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) {
1273
+ context.registerReceiver(
1274
+ receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED);
1275
+ } else {
1276
+ context.registerReceiver(receiver, filter);
1277
+ }
1278
+ }
1261
1279
  }
@@ -53,7 +53,6 @@ import com.facebook.react.bridge.WritableMap;
53
53
  import com.facebook.react.common.build.ReactBuildConfig;
54
54
  import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
55
55
  import com.facebook.react.config.ReactFeatureFlags;
56
- import com.facebook.react.fabric.events.EventBeatManager;
57
56
  import com.facebook.react.fabric.events.EventEmitterWrapper;
58
57
  import com.facebook.react.fabric.events.FabricEventEmitter;
59
58
  import com.facebook.react.fabric.interop.InteropEventEmitter;
@@ -61,6 +60,7 @@ import com.facebook.react.fabric.mounting.MountItemDispatcher;
61
60
  import com.facebook.react.fabric.mounting.MountingManager;
62
61
  import com.facebook.react.fabric.mounting.SurfaceMountingManager;
63
62
  import com.facebook.react.fabric.mounting.SurfaceMountingManager.ViewEvent;
63
+ import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
64
64
  import com.facebook.react.fabric.mounting.mountitems.DispatchIntCommandMountItem;
65
65
  import com.facebook.react.fabric.mounting.mountitems.DispatchStringCommandMountItem;
66
66
  import com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem;
@@ -79,6 +79,7 @@ import com.facebook.react.uimanager.ThemedReactContext;
79
79
  import com.facebook.react.uimanager.UIManagerHelper;
80
80
  import com.facebook.react.uimanager.ViewManagerPropertyUpdater;
81
81
  import com.facebook.react.uimanager.ViewManagerRegistry;
82
+ import com.facebook.react.uimanager.events.BatchEventDispatchedListener;
82
83
  import com.facebook.react.uimanager.events.EventCategoryDef;
83
84
  import com.facebook.react.uimanager.events.EventDispatcher;
84
85
  import com.facebook.react.uimanager.events.EventDispatcherImpl;
@@ -168,7 +169,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
168
169
  @NonNull private final MountItemDispatcher mMountItemDispatcher;
169
170
  @NonNull private final ViewManagerRegistry mViewManagerRegistry;
170
171
 
171
- @NonNull private final EventBeatManager mEventBeatManager;
172
+ @NonNull private final BatchEventDispatchedListener mBatchEventDispatchedListener;
172
173
 
173
174
  @NonNull
174
175
  private final CopyOnWriteArrayList<UIManagerListener> mListeners = new CopyOnWriteArrayList<>();
@@ -208,16 +209,16 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
208
209
  };
209
210
 
210
211
  public FabricUIManager(
211
- ReactApplicationContext reactContext,
212
- ViewManagerRegistry viewManagerRegistry,
213
- EventBeatManager eventBeatManager) {
212
+ @NonNull ReactApplicationContext reactContext,
213
+ @NonNull ViewManagerRegistry viewManagerRegistry,
214
+ @NonNull BatchEventDispatchedListener batchEventDispatchedListener) {
214
215
  mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext);
215
216
  mReactApplicationContext = reactContext;
216
217
  mMountingManager = new MountingManager(viewManagerRegistry, mMountItemExecutor);
217
218
  mMountItemDispatcher =
218
219
  new MountItemDispatcher(mMountingManager, new MountItemDispatchListener());
219
220
  mEventDispatcher = new EventDispatcherImpl(reactContext);
220
- mEventBeatManager = eventBeatManager;
221
+ mBatchEventDispatchedListener = batchEventDispatchedListener;
221
222
  mReactApplicationContext.addLifecycleEventListener(this);
222
223
 
223
224
  mViewManagerRegistry = viewManagerRegistry;
@@ -385,7 +386,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
385
386
  @Override
386
387
  public void initialize() {
387
388
  mEventDispatcher.registerEventEmitter(FABRIC, new FabricEventEmitter(this));
388
- mEventDispatcher.addBatchEventDispatchedListener(mEventBeatManager);
389
+ mEventDispatcher.addBatchEventDispatchedListener(mBatchEventDispatchedListener);
389
390
  if (ENABLE_FABRIC_PERF_LOGS) {
390
391
  mDevToolsReactPerfLogger = new DevToolsReactPerfLogger();
391
392
  mDevToolsReactPerfLogger.addDevToolsReactPerfLoggerListener(FABRIC_PERF_LOGGER);
@@ -424,7 +425,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
424
425
  // memory immediately.
425
426
  mDispatchUIFrameCallback.stop();
426
427
 
427
- mEventDispatcher.removeBatchEventDispatchedListener(mEventBeatManager);
428
+ mEventDispatcher.removeBatchEventDispatchedListener(mBatchEventDispatchedListener);
428
429
  mEventDispatcher.unregisterEventEmitter(FABRIC);
429
430
 
430
431
  mReactApplicationContext.unregisterComponentCallbacks(mViewManagerRegistry);
@@ -1039,8 +1040,16 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
1039
1040
  final int reactTag,
1040
1041
  final String commandId,
1041
1042
  @Nullable final ReadableArray commandArgs) {
1042
- mMountItemDispatcher.dispatchCommandMountItem(
1043
- new DispatchStringCommandMountItem(surfaceId, reactTag, commandId, commandArgs));
1043
+ if (ReactFeatureFlags.unstable_useFabricInterop) {
1044
+ // For Fabric Interop, we check if the commandId is an integer. If it is, we use the integer
1045
+ // overload of dispatchCommand. Otherwise, we use the string overload.
1046
+ // and the events won't be correctly dispatched.
1047
+ mMountItemDispatcher.dispatchCommandMountItem(
1048
+ createDispatchCommandMountItemForInterop(surfaceId, reactTag, commandId, commandArgs));
1049
+ } else {
1050
+ mMountItemDispatcher.dispatchCommandMountItem(
1051
+ new DispatchStringCommandMountItem(surfaceId, reactTag, commandId, commandArgs));
1052
+ }
1044
1053
  }
1045
1054
 
1046
1055
  @Override
@@ -1200,6 +1209,24 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
1200
1209
  }
1201
1210
  }
1202
1211
 
1212
+ /**
1213
+ * Util function that takes care of handling commands for Fabric Interop. If the command is a
1214
+ * string that represents a number (say "42"), it will be parsed as an integer and the
1215
+ * corresponding dispatch command mount item will be created.
1216
+ */
1217
+ /* package */ DispatchCommandMountItem createDispatchCommandMountItemForInterop(
1218
+ final int surfaceId,
1219
+ final int reactTag,
1220
+ final String commandId,
1221
+ @Nullable final ReadableArray commandArgs) {
1222
+ try {
1223
+ int commandIdInteger = Integer.parseInt(commandId);
1224
+ return new DispatchIntCommandMountItem(surfaceId, reactTag, commandIdInteger, commandArgs);
1225
+ } catch (NumberFormatException e) {
1226
+ return new DispatchStringCommandMountItem(surfaceId, reactTag, commandId, commandArgs);
1227
+ }
1228
+ }
1229
+
1203
1230
  private class DispatchUIFrameCallback extends GuardedFrameCallback {
1204
1231
 
1205
1232
  private volatile boolean mIsMountingEnabled = true;
@@ -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", 72,
20
- "patch", 3,
20
+ "patch", 5,
21
21
  "prerelease", null);
22
22
  }
@@ -117,7 +117,6 @@ import java.util.Set;
117
117
 
118
118
  Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
119
119
  if (viewManagerBubblingEvents != null) {
120
-
121
120
  if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
122
121
  // For Fabric, events needs to be fired with a "top" prefix.
123
122
  // For the sake of Fabric Interop, here we normalize events adding "top" in their
@@ -133,6 +132,12 @@ import java.util.Set;
133
132
 
134
133
  Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
135
134
  if (viewManagerDirectEvents != null) {
135
+ if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
136
+ // For Fabric, events needs to be fired with a "top" prefix.
137
+ // For the sake of Fabric Interop, here we normalize events adding "top" in their
138
+ // name if the user hasn't provided it.
139
+ normalizeEventTypes(viewManagerDirectEvents);
140
+ }
136
141
  recursiveMerge(cumulativeDirectEventTypes, viewManagerDirectEvents);
137
142
  recursiveMerge(viewManagerDirectEvents, defaultDirectEvents);
138
143
  viewManagerConstants.put(DIRECT_EVENTS_KEY, viewManagerDirectEvents);
@@ -103,6 +103,10 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
103
103
  }
104
104
 
105
105
  View firstVisibleView = mFirstVisibleView.get();
106
+ if (firstVisibleView == null) {
107
+ return;
108
+ }
109
+
106
110
  Rect newFrame = new Rect();
107
111
  firstVisibleView.getHitRect(newFrame);
108
112
 
@@ -218,6 +218,12 @@ public class ReactScrollView extends ScrollView
218
218
  }
219
219
  }
220
220
 
221
+ public void abortAnimation() {
222
+ if (mScroller != null && !mScroller.isFinished()) {
223
+ mScroller.abortAnimation();
224
+ }
225
+ }
226
+
221
227
  public void setSnapInterval(int snapInterval) {
222
228
  mSnapInterval = snapInterval;
223
229
  }
@@ -1076,7 +1082,6 @@ public class ReactScrollView extends ScrollView
1076
1082
  */
1077
1083
  @Override
1078
1084
  public void scrollTo(int x, int y) {
1079
- mScroller.abortAnimation();
1080
1085
  super.scrollTo(x, y);
1081
1086
  ReactScrollViewHelper.updateFabricScrollState(this);
1082
1087
  setPendingContentOffsets(x, y);