@office-iss/react-native-win32 0.76.2 → 0.77.0-preview.1

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 (248) hide show
  1. package/.eslintignore +1 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +164 -53
  4. package/CHANGELOG.md +74 -28
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
  7. package/Libraries/Animated/AnimatedEvent.js +1 -1
  8. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  9. package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
  10. package/Libraries/Animated/animations/Animation.js +60 -25
  11. package/Libraries/Animated/animations/DecayAnimation.js +26 -38
  12. package/Libraries/Animated/animations/SpringAnimation.js +33 -39
  13. package/Libraries/Animated/animations/TimingAnimation.js +34 -42
  14. package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
  15. package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
  16. package/Libraries/Animated/createAnimatedComponent.js +60 -33
  17. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  18. package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
  20. package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
  21. package/Libraries/Animated/nodes/AnimatedProps.js +96 -46
  22. package/Libraries/Animated/nodes/AnimatedStyle.js +108 -39
  23. package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
  24. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  25. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
  26. package/Libraries/Animated/useAnimatedProps.js +41 -35
  27. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  28. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
  29. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
  30. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
  31. package/Libraries/Components/Button.js +9 -4
  32. package/Libraries/Components/Button.win32.js +12 -4
  33. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  34. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
  35. package/Libraries/Components/Pressable/Pressable.js +4 -4
  36. package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
  37. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
  42. package/Libraries/Components/ScrollView/ScrollView.js +49 -88
  43. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  44. package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
  47. package/Libraries/Components/Switch/Switch.js +8 -6
  48. package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
  49. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
  50. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
  51. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
  52. package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
  53. package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
  54. package/Libraries/Components/TextInput/TextInput.js +37 -13
  55. package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
  56. package/Libraries/Components/TextInput/TextInputState.js +11 -13
  57. package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
  58. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
  59. package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
  60. package/Libraries/Components/Touchable/Position.js +7 -2
  61. package/Libraries/Components/Touchable/Touchable.js +4 -0
  62. package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
  63. package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
  64. package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
  65. package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
  66. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
  67. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
  68. package/Libraries/Components/View/View.js +4 -4
  69. package/Libraries/Components/View/View.win32.js +4 -4
  70. package/Libraries/Components/View/ViewNativeComponent.js +6 -98
  71. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  72. package/Libraries/Components/View/ViewPropTypes.js +0 -3
  73. package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
  74. package/Libraries/Components/View/ViewWin32.js +1 -0
  75. package/Libraries/Core/ExceptionsManager.js +50 -29
  76. package/Libraries/Core/ReactNativeVersion.js +3 -3
  77. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
  78. package/Libraries/Core/setUpBatchedBridge.js +1 -10
  79. package/Libraries/Core/setUpDeveloperTools.js +1 -5
  80. package/Libraries/Core/setUpErrorHandling.js +20 -18
  81. package/Libraries/Core/setUpReactDevTools.js +107 -8
  82. package/Libraries/Core/setUpSegmentFetcher.js +1 -0
  83. package/Libraries/Core/setUpTimers.js +21 -18
  84. package/Libraries/Debugging/DebuggingOverlay.js +4 -5
  85. package/Libraries/Image/AssetSourceResolver.js +12 -1
  86. package/Libraries/Image/Image.android.js +1 -5
  87. package/Libraries/Image/Image.d.ts +20 -29
  88. package/Libraries/Image/Image.ios.js +0 -2
  89. package/Libraries/Image/Image.win32.js +0 -2
  90. package/Libraries/Image/ImageBackground.js +2 -5
  91. package/Libraries/Image/ImageProps.js +7 -6
  92. package/Libraries/Image/ImageResizeMode.d.ts +8 -1
  93. package/Libraries/Image/ImageResizeMode.js +4 -1
  94. package/Libraries/Image/ImageSource.d.ts +0 -2
  95. package/Libraries/Image/ImageSource.js +0 -2
  96. package/Libraries/Image/ImageTypes.flow.js +11 -9
  97. package/Libraries/Image/ImageUtils.js +6 -3
  98. package/Libraries/Image/ImageViewNativeComponent.js +5 -3
  99. package/Libraries/Inspector/Inspector.js +1 -0
  100. package/Libraries/Inspector/Inspector.win32.js +2 -1
  101. package/Libraries/Inspector/NetworkOverlay.js +4 -0
  102. package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
  103. package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
  104. package/Libraries/Interaction/InteractionManager.js +6 -1
  105. package/Libraries/Interaction/InteractionManagerStub.js +176 -0
  106. package/Libraries/Interaction/TouchHistoryMath.js +22 -19
  107. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  108. package/Libraries/Lists/FlatList.d.ts +1 -2
  109. package/Libraries/Lists/FlatList.js +2 -2
  110. package/Libraries/Lists/SectionListModern.js +7 -7
  111. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
  112. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  113. package/Libraries/LogBox/Data/LogBoxData.js +3 -3
  114. package/Libraries/LogBox/LogBox.js +18 -5
  115. package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
  116. package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
  117. package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
  118. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
  119. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
  120. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  121. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
  122. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
  123. package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
  124. package/Libraries/Modal/Modal.d.ts +12 -0
  125. package/Libraries/Modal/Modal.js +31 -4
  126. package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
  127. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
  128. package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
  129. package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
  130. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
  131. package/Libraries/Network/XHRInterceptor.js +63 -14
  132. package/Libraries/Network/XMLHttpRequest.js +26 -1
  133. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  134. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
  135. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
  136. package/Libraries/Pressability/HoverState.js +2 -0
  137. package/Libraries/Pressability/HoverState.win32.js +2 -0
  138. package/Libraries/Pressability/Pressability.js +2 -3
  139. package/Libraries/Pressability/Pressability.win32.js +2 -3
  140. package/Libraries/Pressability/usePressability.js +4 -1
  141. package/Libraries/ReactNative/AppContainer.js +1 -1
  142. package/Libraries/ReactNative/AppRegistry.js +1 -11
  143. package/Libraries/ReactNative/DisplayMode.js +1 -1
  144. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
  145. package/Libraries/ReactNative/RendererImplementation.js +18 -17
  146. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
  147. package/Libraries/ReactNative/renderApplication.js +9 -8
  148. package/Libraries/ReactNative/requireNativeComponent.js +5 -2
  149. package/Libraries/Renderer/shims/ReactFabric.js +3 -3
  150. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  151. package/Libraries/Renderer/shims/ReactNative.js +3 -3
  152. package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
  153. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
  154. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  155. package/Libraries/StyleSheet/StyleSheet.js +7 -1
  156. package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
  157. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
  158. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
  159. package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
  160. package/Libraries/StyleSheet/processTransform.js +3 -34
  161. package/Libraries/Text/Text.js +248 -249
  162. package/Libraries/Text/Text.win32.js +282 -295
  163. package/Libraries/Text/TextNativeComponent.js +0 -1
  164. package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
  165. package/Libraries/Types/CoreEventTypes.d.ts +3 -10
  166. package/Libraries/Types/CoreEventTypes.js +4 -6
  167. package/Libraries/Types/CoreEventTypes.win32.js +4 -6
  168. package/Libraries/Utilities/Appearance.js +3 -1
  169. package/Libraries/Utilities/BackHandler.android.js +6 -18
  170. package/Libraries/Utilities/BackHandler.d.ts +0 -4
  171. package/Libraries/Utilities/BackHandler.ios.js +0 -7
  172. package/Libraries/Utilities/BackHandler.win32.js +6 -18
  173. package/Libraries/Utilities/FocusManager.win32.js +1 -1
  174. package/Libraries/Utilities/HMRClient.js +3 -4
  175. package/Libraries/Utilities/Platform.flow.js +2 -2
  176. package/Libraries/Utilities/Platform.flow.win32.js +3 -2
  177. package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
  178. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  179. package/Libraries/Utilities/useMergeRefs.js +26 -7
  180. package/Libraries/WebSocket/WebSocketEvent.js +4 -1
  181. package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
  182. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
  183. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  184. package/index.js +10 -3
  185. package/index.win32.js +10 -3
  186. package/jest/setup.js +36 -1
  187. package/overrides.json +37 -37
  188. package/package.json +20 -20
  189. package/src/private/animated/NativeAnimatedHelper.js +18 -16
  190. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
  191. package/src/private/animated/useAnimatedPropsMemo.js +348 -0
  192. package/src/private/components/HScrollViewNativeComponents.js +1 -27
  193. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
  194. package/src/private/components/VScrollViewNativeComponents.js +2 -25
  195. package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
  196. package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
  197. package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
  198. package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
  199. package/src/private/devmenu/DevMenu.d.ts +20 -0
  200. package/src/private/devmenu/DevMenu.js +31 -0
  201. package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
  202. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
  203. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
  204. package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
  205. package/src/private/setup/setUpDOM.js +14 -6
  206. package/src/private/setup/setUpMutationObserver.js +5 -0
  207. package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
  208. package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
  209. package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
  210. package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
  211. package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
  212. package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
  213. package/src/private/specs/modules/NativeAppearance.js +4 -10
  214. package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
  215. package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
  216. package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
  217. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
  218. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
  219. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
  220. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
  221. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
  222. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  223. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
  224. package/src/private/webapis/performance/EventTiming.js +13 -8
  225. package/src/private/webapis/performance/Performance.js +66 -73
  226. package/src/private/webapis/performance/PerformanceEntry.js +2 -5
  227. package/src/private/webapis/performance/PerformanceObserver.js +65 -164
  228. package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
  229. package/src/private/webapis/performance/UserTiming.js +11 -7
  230. package/src/private/webapis/performance/Utilities.js +18 -0
  231. package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
  232. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
  233. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  234. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  235. package/types/index.d.ts +1 -1
  236. package/types/public/ReactNativeTypes.d.ts +4 -8
  237. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
  238. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
  239. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
  240. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
  241. package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
  242. package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
  243. package/src/private/components/useSyncOnScroll.js +0 -48
  244. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
  245. package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
  246. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
  247. package/types/experimental.d.ts +0 -59
  248. /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
@@ -21,6 +21,17 @@ if (__DEV__) {
21
21
  }
22
22
  }
23
23
 
24
+ const isEventLoopEnabled = (() => {
25
+ if (NativeReactNativeFeatureFlags == null) {
26
+ return false;
27
+ }
28
+
29
+ return (
30
+ ReactNativeFeatureFlags.enableBridgelessArchitecture() &&
31
+ !ReactNativeFeatureFlags.disableEventLoopOnBridgeless()
32
+ );
33
+ })();
34
+
24
35
  // In bridgeless mode, timers are host functions installed from cpp.
25
36
  if (global.RN$Bridgeless !== true) {
26
37
  /**
@@ -29,14 +40,14 @@ if (global.RN$Bridgeless !== true) {
29
40
  */
30
41
  const defineLazyTimer = (
31
42
  name:
32
- | $TEMPORARY$string<'cancelAnimationFrame'>
33
- | $TEMPORARY$string<'cancelIdleCallback'>
34
- | $TEMPORARY$string<'clearInterval'>
35
- | $TEMPORARY$string<'clearTimeout'>
36
- | $TEMPORARY$string<'requestAnimationFrame'>
37
- | $TEMPORARY$string<'requestIdleCallback'>
38
- | $TEMPORARY$string<'setInterval'>
39
- | $TEMPORARY$string<'setTimeout'>,
43
+ | 'cancelAnimationFrame'
44
+ | 'cancelIdleCallback'
45
+ | 'clearInterval'
46
+ | 'clearTimeout'
47
+ | 'requestAnimationFrame'
48
+ | 'requestIdleCallback'
49
+ | 'setInterval'
50
+ | 'setTimeout',
40
51
  ) => {
41
52
  polyfillGlobal(name, () => require('./Timers/JSTimers')[name]);
42
53
  };
@@ -48,12 +59,7 @@ if (global.RN$Bridgeless !== true) {
48
59
  defineLazyTimer('cancelAnimationFrame');
49
60
  defineLazyTimer('requestIdleCallback');
50
61
  defineLazyTimer('cancelIdleCallback');
51
- } else if (
52
- // TODO remove this condition when bridgeless == modern scheduler everywhere.
53
- NativeReactNativeFeatureFlags != null &&
54
- // eslint-disable-next-line react-hooks/rules-of-hooks -- false positive due to `use` prefix
55
- ReactNativeFeatureFlags.useModernRuntimeScheduler()
56
- ) {
62
+ } else if (isEventLoopEnabled) {
57
63
  polyfillGlobal(
58
64
  'requestIdleCallback',
59
65
  () =>
@@ -72,10 +78,7 @@ if (global.RN$Bridgeless !== true) {
72
78
  // We need to check if the native module is available before accessing the
73
79
  // feature flag, because otherwise the API would throw an error in the legacy
74
80
  // architecture in OSS, where the native module isn't available.
75
- if (
76
- NativeReactNativeFeatureFlags != null &&
77
- ReactNativeFeatureFlags.enableMicrotasks()
78
- ) {
81
+ if (isEventLoopEnabled) {
79
82
  // This is the flag that tells React to use `queueMicrotask` to batch state
80
83
  // updates, instead of using the scheduler to schedule a regular task.
81
84
  // We use a global variable because we don't currently have any other
@@ -102,10 +102,9 @@ const styles = StyleSheet.create({
102
102
  },
103
103
  });
104
104
 
105
- const DebuggingOverlayWithForwardedRef: React.AbstractComponent<
106
- {},
107
- DebuggingOverlayHandle,
108
- React.Node,
109
- > = React.forwardRef(DebuggingOverlay);
105
+ const DebuggingOverlayWithForwardedRef: component(
106
+ ref: React.RefSetter<DebuggingOverlayHandle>,
107
+ ...props: {}
108
+ ) = React.forwardRef(DebuggingOverlay);
110
109
 
111
110
  export default DebuggingOverlayWithForwardedRef;
@@ -53,6 +53,13 @@ function getAssetPathInDrawableFolder(asset: PackagerAsset): string {
53
53
  return drawableFolder + '/' + fileName + '.' + asset.type;
54
54
  }
55
55
 
56
+ /**
57
+ * Returns true if the asset can be loaded over the network.
58
+ */
59
+ function assetSupportsNetworkLoads(asset: PackagerAsset): boolean {
60
+ return !(asset.type === 'xml' && Platform.OS === 'android');
61
+ }
62
+
56
63
  class AssetSourceResolver {
57
64
  serverUrl: ?string;
58
65
  // where the jsbundle is being run from
@@ -67,7 +74,11 @@ class AssetSourceResolver {
67
74
  }
68
75
 
69
76
  isLoadedFromServer(): boolean {
70
- return !!this.serverUrl;
77
+ return (
78
+ this.serverUrl != null &&
79
+ this.serverUrl !== '' &&
80
+ assetSupportsNetworkLoads(this.asset)
81
+ );
71
82
  }
72
83
 
73
84
  isLoadedFromFileSystem(): boolean {
@@ -133,7 +133,6 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
133
133
  width: undefined,
134
134
  height: undefined,
135
135
  };
136
- const defaultSource = resolveAssetSource(props.defaultSource);
137
136
  const loadingIndicatorSource = resolveAssetSource(
138
137
  props.loadingIndicatorSource,
139
138
  );
@@ -166,11 +165,9 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
166
165
  sources = [source];
167
166
  }
168
167
 
169
- const {height, width, ...restProps} = props;
170
-
171
168
  const {onLoadStart, onLoad, onLoadEnd, onError} = props;
172
169
  const nativeProps = {
173
- ...restProps,
170
+ ...props,
174
171
  style,
175
172
  shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError),
176
173
  // Both iOS and C++ sides expect to have "source" prop, whereas on Android it's "src"
@@ -181,7 +178,6 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
181
178
  /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
182
179
  * when making Flow check .android.js files. */
183
180
  headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
184
- defaultSrc: defaultSource ? defaultSource.uri : null,
185
181
  loadingIndicatorSrc: loadingIndicatorSource
186
182
  ? loadingIndicatorSource.uri
187
183
  : null,
@@ -60,18 +60,28 @@ export interface ImagePropsIOS {
60
60
  interface ImagePropsAndroid {
61
61
  /**
62
62
  * The mechanism that should be used to resize the image when the image's dimensions
63
- * differ from the image view's dimensions. Defaults to auto.
63
+ * differ from the image view's dimensions. Defaults to `auto`.
64
+ *
65
+ * - `auto`: Use heuristics to pick between `resize` and `scale`.
66
+ *
67
+ * - `resize`: A software operation which changes the encoded image in memory before it
68
+ * gets decoded. This should be used instead of `scale` when the image is much larger
69
+ * than the view.
70
+ *
71
+ * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
72
+ * faster (usually hardware accelerated) and produces higher quality images. This
73
+ * should be used if the image is smaller than the view. It should also be used if the
74
+ * image is slightly bigger than the view.
64
75
  *
65
- * 'auto': Use heuristics to pick between resize and scale.
76
+ * - `none`: No sampling is performed and the image is displayed in its full resolution. This
77
+ * should only be used in rare circumstances because it is considered unsafe as Android will
78
+ * throw a runtime exception when trying to render images that consume too much memory.
66
79
  *
67
- * 'resize': A software operation which changes the encoded image in memory before it gets decoded.
68
- * This should be used instead of scale when the image is much larger than the view.
80
+ * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
69
81
  *
70
- * 'scale': The image gets drawn downscaled or upscaled. Compared to resize, scale is faster (usually hardware accelerated)
71
- * and produces higher quality images. This should be used if the image is smaller than the view.
72
- * It should also be used if the image is slightly bigger than the view.
82
+ * @platform android
73
83
  */
74
- resizeMethod?: 'auto' | 'resize' | 'scale' | undefined;
84
+ resizeMethod?: 'auto' | 'resize' | 'scale' | 'none' | undefined;
75
85
 
76
86
  /**
77
87
  * Duration of fade in animation in ms. Defaults to 300
@@ -190,29 +200,10 @@ export interface ImagePropsBase
190
200
  * 'center': Scale the image down so that it is completely visible,
191
201
  * if bigger than the area of the view.
192
202
  * The image will not be scaled up.
193
- */
194
- resizeMode?: ImageResizeMode | undefined;
195
-
196
- /**
197
- * The mechanism that should be used to resize the image when the image's dimensions
198
- * differ from the image view's dimensions. Defaults to `auto`.
199
203
  *
200
- * - `auto`: Use heuristics to pick between `resize` and `scale`.
201
- *
202
- * - `resize`: A software operation which changes the encoded image in memory before it
203
- * gets decoded. This should be used instead of `scale` when the image is much larger
204
- * than the view.
205
- *
206
- * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
207
- * faster (usually hardware accelerated) and produces higher quality images. This
208
- * should be used if the image is smaller than the view. It should also be used if the
209
- * image is slightly bigger than the view.
210
- *
211
- * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
212
- *
213
- * @platform android
204
+ * 'none': Do not resize the image. The image will be displayed at its intrinsic size.
214
205
  */
215
- resizeMethod?: 'auto' | 'resize' | 'scale' | undefined;
206
+ resizeMode?: ImageResizeMode | undefined;
216
207
 
217
208
  /**
218
209
  * The image source (either a remote URL or a local file resource).
@@ -145,9 +145,7 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
145
145
  'aria-disabled': ariaDisabled,
146
146
  'aria-expanded': ariaExpanded,
147
147
  'aria-selected': ariaSelected,
148
- height,
149
148
  src,
150
- width,
151
149
  ...restProps
152
150
  } = props;
153
151
 
@@ -164,9 +164,7 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
164
164
  'aria-multiselectable': ariaMultiselectable, // Win32
165
165
  'aria-required': ariaRequired, // Win32
166
166
  'aria-selected': ariaSelected,
167
- height,
168
167
  src,
169
- width,
170
168
  ...restProps
171
169
  } = props;
172
170
 
@@ -8,10 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- import type {ViewProps} from '../Components/View/ViewPropTypes';
14
- import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
15
12
  import type {ImageBackgroundProps} from './ImageProps';
16
13
 
17
14
  import View from '../Components/View/View';
@@ -55,7 +52,7 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
55
52
 
56
53
  _viewRef: ?React.ElementRef<typeof View> = null;
57
54
 
58
- _captureRef = (ref: null | React.ElementRef<HostComponent<ViewProps>>) => {
55
+ _captureRef = (ref: null | HostInstance) => {
59
56
  this._viewRef = ref;
60
57
  };
61
58
 
@@ -19,8 +19,9 @@ import type {
19
19
  } from '../StyleSheet/StyleSheet';
20
20
  import type {LayoutEvent, SyntheticEvent} from '../Types/CoreEventTypes';
21
21
  import typeof Image from './Image';
22
+ import type {ImageResizeMode} from './ImageResizeMode';
22
23
  import type {ImageSource} from './ImageSource';
23
- import type {Node, Ref} from 'react';
24
+ import type {ElementRef, Node, RefSetter} from 'react';
24
25
 
25
26
  export type ImageLoadEvent = SyntheticEvent<
26
27
  $ReadOnly<{|
@@ -65,7 +66,7 @@ type AndroidImageProps = $ReadOnly<{|
65
66
  * dimensions differ from the image view's dimensions. Defaults to `'auto'`.
66
67
  * See https://reactnative.dev/docs/image#resizemethod-android
67
68
  */
68
- resizeMethod?: ?('auto' | 'resize' | 'scale'),
69
+ resizeMethod?: ?('auto' | 'resize' | 'scale' | 'none'),
69
70
 
70
71
  /**
71
72
  * When the `resizeMethod` is set to `resize`, the destination dimensions are
@@ -77,7 +78,7 @@ type AndroidImageProps = $ReadOnly<{|
77
78
  resizeMultiplier?: ?number,
78
79
  |}>;
79
80
 
80
- export type ImageProps = {|
81
+ export type ImageProps = $ReadOnly<{|
81
82
  ...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
82
83
  ...IOSImageProps,
83
84
  ...AndroidImageProps,
@@ -234,7 +235,7 @@ export type ImageProps = {|
234
235
  *
235
236
  * See https://reactnative.dev/docs/image#resizemode
236
237
  */
237
- resizeMode?: ?('cover' | 'contain' | 'stretch' | 'repeat' | 'center'),
238
+ resizeMode?: ?ImageResizeMode,
238
239
 
239
240
  /**
240
241
  * A unique identifier for this element to be used in UI Automation
@@ -266,7 +267,7 @@ export type ImageProps = {|
266
267
  */
267
268
  srcSet?: ?string,
268
269
  children?: empty,
269
- |};
270
+ |}>;
270
271
 
271
272
  export type ImageBackgroundProps = $ReadOnly<{|
272
273
  ...ImageProps,
@@ -291,5 +292,5 @@ export type ImageBackgroundProps = $ReadOnly<{|
291
292
  *
292
293
  * See https://reactnative.dev/docs/imagebackground#imageref
293
294
  */
294
- imageRef?: Ref<Image>,
295
+ imageRef?: RefSetter<ElementRef<Image>>,
295
296
  |}>;
@@ -12,7 +12,8 @@ export type ImageResizeMode =
12
12
  | 'contain'
13
13
  | 'stretch'
14
14
  | 'repeat'
15
- | 'center';
15
+ | 'center'
16
+ | 'none';
16
17
 
17
18
  /**
18
19
  * @see ImageResizeMode.js
@@ -46,4 +47,10 @@ export interface ImageResizeModeStatic {
46
47
  * image will keep it's size and aspect ratio.
47
48
  */
48
49
  repeat: ImageResizeMode;
50
+
51
+ /**
52
+ * none - The image will be displayed at its intrinsic size, which means the
53
+ * image will not be scaled up or down.
54
+ */
55
+ none: ImageResizeMode;
49
56
  }
@@ -33,4 +33,7 @@ export type ImageResizeMode =
33
33
 
34
34
  // Resize by stretching it to fill the entire frame of the view without
35
35
  // clipping. This may change the aspect ratio of the image, distorting it.
36
- | 'stretch';
36
+ | 'stretch'
37
+
38
+ // The image will not be resized at all.
39
+ | 'none';
@@ -50,8 +50,6 @@ export interface ImageURISource {
50
50
  * its age or expiration date. If there is no existing data in the cache corresponding
51
51
  * to a URL load request, no attempt is made to load the data from the originating source,
52
52
  * and the load is considered to have failed.
53
- *
54
- * @platform ios
55
53
  */
56
54
  cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined;
57
55
  /**
@@ -65,8 +65,6 @@ export interface ImageURISource {
65
65
  * its age or expiration date. If there is no existing data in the cache corresponding
66
66
  * to a URL load request, no attempt is made to load the data from the originating source,
67
67
  * and the load is considered to have failed.
68
- *
69
- * @platform ios
70
68
  */
71
69
  +cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached');
72
70
 
@@ -56,18 +56,20 @@ type ImageComponentStaticsAndroid = $ReadOnly<{
56
56
  abortPrefetch(requestId: number): void,
57
57
  }>;
58
58
 
59
- export type AbstractImageAndroid = React.AbstractComponent<
60
- ImagePropsType,
61
- | React.ElementRef<TextInlineImageNativeComponent>
62
- | React.ElementRef<ImageViewNativeComponent>,
63
- >;
59
+ export type AbstractImageAndroid = component(
60
+ ref: React.RefSetter<
61
+ | React.ElementRef<TextInlineImageNativeComponent>
62
+ | React.ElementRef<ImageViewNativeComponent>,
63
+ >,
64
+ ...props: ImagePropsType
65
+ );
64
66
 
65
67
  export type ImageAndroid = AbstractImageAndroid & ImageComponentStaticsAndroid;
66
68
 
67
- export type AbstractImageIOS = React.AbstractComponent<
68
- ImagePropsType,
69
- React.ElementRef<ImageViewNativeComponent>,
70
- >;
69
+ export type AbstractImageIOS = component(
70
+ ref: React.RefSetter<React.ElementRef<ImageViewNativeComponent>>,
71
+ ...props: ImagePropsType
72
+ );
71
73
 
72
74
  export type ImageIOS = AbstractImageIOS & ImageComponentStaticsIOS;
73
75
 
@@ -8,15 +8,18 @@
8
8
  * @format
9
9
  */
10
10
 
11
- type ResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
11
+ import type {ImageResizeMode} from './ImageResizeMode';
12
12
 
13
- const objectFitMap: {[string]: ResizeMode} = {
13
+ const objectFitMap: {[string]: ImageResizeMode} = {
14
14
  contain: 'contain',
15
15
  cover: 'cover',
16
16
  fill: 'stretch',
17
17
  'scale-down': 'contain',
18
+ none: 'none',
18
19
  };
19
20
 
20
- export function convertObjectFitToResizeMode(objectFit: ?string): ?ResizeMode {
21
+ export function convertObjectFitToResizeMode(
22
+ objectFit: ?string,
23
+ ): ?ImageResizeMode {
21
24
  return objectFit != null ? objectFitMap[objectFit] : undefined;
22
25
  }
@@ -11,6 +11,7 @@
11
11
  import type {ViewProps} from '../Components/View/ViewPropTypes';
12
12
  import type {
13
13
  HostComponent,
14
+ HostInstance,
14
15
  PartialViewConfig,
15
16
  } from '../Renderer/shims/ReactNativeTypes';
16
17
  import type {
@@ -20,7 +21,6 @@ import type {
20
21
  } from '../StyleSheet/StyleSheet';
21
22
  import type {ResolvedAssetSource} from './AssetSourceResolver';
22
23
  import type {ImageProps} from './ImageProps';
23
- import type {ElementRef} from 'react';
24
24
 
25
25
  import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
26
26
  import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
@@ -48,7 +48,7 @@ type Props = $ReadOnly<{
48
48
 
49
49
  interface NativeCommands {
50
50
  +setIsVisible_EXPERIMENTAL: (
51
- viewRef: ElementRef<HostComponent<mixed>>,
51
+ viewRef: HostInstance,
52
52
  isVisible: boolean,
53
53
  time: number,
54
54
  ) => void;
@@ -82,6 +82,9 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
82
82
  },
83
83
  validAttributes: {
84
84
  blurRadius: true,
85
+ defaultSource: {
86
+ process: require('./resolveAssetSource'),
87
+ },
85
88
  internal_analyticTag: true,
86
89
  resizeMethod: true,
87
90
  resizeMode: true,
@@ -100,7 +103,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
100
103
  borderRadius: true,
101
104
  headers: true,
102
105
  shouldNotifyLoadEvents: true,
103
- defaultSrc: true,
104
106
  overlayColor: {
105
107
  process: require('../StyleSheet/processColor').default,
106
108
  },
@@ -17,6 +17,7 @@ import type {
17
17
  } from '../Renderer/shims/ReactNativeTypes';
18
18
  import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
19
19
  import type {ReactDevToolsAgent} from '../Types/ReactDevToolsTypes';
20
+
20
21
  import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
21
22
 
22
23
  const View = require('../Components/View/View');
@@ -17,10 +17,11 @@ import type {
17
17
  } from '../Renderer/shims/ReactNativeTypes';
18
18
  import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
19
19
  import type {ReactDevToolsAgent} from '../Types/ReactDevToolsTypes';
20
+
20
21
  import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
21
22
 
22
23
  const PressabilityDebug = require('../Pressability/PressabilityDebug');
23
- const ReactNative = require('../Renderer/shims/ReactNative');
24
+ const ReactNative = require('../Renderer/shims/ReactNative').default;
24
25
  const {findNodeHandle} = require('../ReactNative/RendererProxy');
25
26
  const StyleSheet = require('../StyleSheet/StyleSheet');
26
27
  const Platform = require('../Utilities/Platform');
@@ -143,6 +143,7 @@ class NetworkOverlay extends React.Component<Props, State> {
143
143
  });
144
144
 
145
145
  XHRInterceptor.setRequestHeaderCallback((header, value, xhr) => {
146
+ // $FlowFixMe[prop-missing]
146
147
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
147
148
  if (xhrIndex === -1) {
148
149
  return;
@@ -159,6 +160,7 @@ class NetworkOverlay extends React.Component<Props, State> {
159
160
  });
160
161
 
161
162
  XHRInterceptor.setSendCallback((data, xhr) => {
163
+ // $FlowFixMe[prop-missing]
162
164
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
163
165
  if (xhrIndex === -1) {
164
166
  return;
@@ -173,6 +175,7 @@ class NetworkOverlay extends React.Component<Props, State> {
173
175
 
174
176
  XHRInterceptor.setHeaderReceivedCallback(
175
177
  (type, size, responseHeaders, xhr) => {
178
+ // $FlowFixMe[prop-missing]
176
179
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
177
180
  if (xhrIndex === -1) {
178
181
  return;
@@ -190,6 +193,7 @@ class NetworkOverlay extends React.Component<Props, State> {
190
193
 
191
194
  XHRInterceptor.setResponseCallback(
192
195
  (status, timeout, response, responseURL, responseType, xhr) => {
196
+ // $FlowFixMe[prop-missing]
193
197
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
194
198
  if (xhrIndex === -1) {
195
199
  return;
@@ -20,7 +20,6 @@ import StyleSheet from '../StyleSheet/StyleSheet';
20
20
  import ElementBox from './ElementBox';
21
21
  import * as React from 'react';
22
22
 
23
- const {findNodeHandle} = require('../ReactNative/RendererProxy');
24
23
  const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint');
25
24
 
26
25
  const {useEffect, useState, useCallback} = React;
@@ -78,20 +77,15 @@ export default function ReactDevToolsOverlay({
78
77
  x,
79
78
  y,
80
79
  viewData => {
81
- const {touchedViewTag, closestInstance, frame} = viewData;
82
- if (closestInstance != null || touchedViewTag != null) {
83
- // We call `selectNode` for both non-fabric(viewTag) and fabric(instance),
84
- // this makes sure it works for both architectures.
85
- reactDevToolsAgent.selectNode(findNodeHandle(touchedViewTag));
86
- if (closestInstance != null) {
87
- reactDevToolsAgent.selectNode(closestInstance);
88
- }
89
- setInspected({
90
- frame,
91
- });
92
- return true;
80
+ const {frame, closestPublicInstance} = viewData;
81
+
82
+ if (closestPublicInstance == null) {
83
+ return false;
93
84
  }
94
- return false;
85
+
86
+ reactDevToolsAgent.selectNode(closestPublicInstance);
87
+ setInspected({frame});
88
+ return true;
95
89
  },
96
90
  );
97
91
  },
@@ -9,18 +9,16 @@
9
9
  */
10
10
 
11
11
  import type {
12
- HostComponent,
12
+ HostInstance,
13
13
  TouchedViewDataAtPoint,
14
14
  } from '../Renderer/shims/ReactNativeTypes';
15
15
 
16
16
  const invariant = require('invariant');
17
- const React = require('react');
18
17
 
19
- export type HostRef = React.ElementRef<HostComponent<mixed>>;
20
18
  export type ReactRenderer = {
21
19
  rendererConfig: {
22
20
  getInspectorDataForViewAtPoint: (
23
- inspectedView: ?HostRef,
21
+ inspectedView: ?HostInstance,
24
22
  locationX: number,
25
23
  locationY: number,
26
24
  callback: Function,
@@ -52,7 +50,7 @@ function validateRenderers(): void {
52
50
  }
53
51
 
54
52
  module.exports = function getInspectorDataForViewAtPoint(
55
- inspectedView: ?HostRef,
53
+ inspectedView: ?HostInstance,
56
54
  locationX: number,
57
55
  locationY: number,
58
56
  callback: (viewData: TouchedViewDataAtPoint) => boolean,
@@ -10,6 +10,7 @@
10
10
 
11
11
  import type {Task} from './TaskQueue';
12
12
 
13
+ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
13
14
  import EventEmitter from '../vendor/emitter/EventEmitter';
14
15
 
15
16
  const BatchedBridge = require('../BatchedBridge/BatchedBridge');
@@ -208,4 +209,8 @@ function _processUpdate() {
208
209
  _deleteInteractionSet.clear();
209
210
  }
210
211
 
211
- module.exports = InteractionManager;
212
+ module.exports = (
213
+ ReactNativeFeatureFlags.disableInteractionManager()
214
+ ? require('./InteractionManagerStub')
215
+ : InteractionManager
216
+ ) as typeof InteractionManager;