@office-iss/react-native-win32 0.68.0-preview.2 → 0.69.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 (180) hide show
  1. package/.flowconfig +3 -3
  2. package/CHANGELOG.json +386 -14
  3. package/CHANGELOG.md +159 -9
  4. package/IntegrationTests/BUCK +4 -1
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -0
  6. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +1 -0
  7. package/Libraries/Alert/Alert.win32.js +1 -1
  8. package/Libraries/Animated/AnimatedImplementation.js +1 -1
  9. package/Libraries/Animated/NativeAnimatedHelper.js +55 -9
  10. package/Libraries/Animated/NativeAnimatedModule.js +1 -0
  11. package/Libraries/Animated/NativeAnimatedTurboModule.js +1 -0
  12. package/Libraries/Animated/animations/TimingAnimation.js +6 -11
  13. package/Libraries/Animated/createAnimatedComponent.js +2 -2
  14. package/Libraries/Animated/nodes/AnimatedColor.js +95 -29
  15. package/Libraries/Animated/nodes/AnimatedInterpolation.js +19 -22
  16. package/Libraries/Animated/nodes/AnimatedNode.js +2 -2
  17. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  18. package/Libraries/AppState/AppState.js +1 -1
  19. package/Libraries/Blob/URL.js +7 -1
  20. package/Libraries/Components/Button.js +3 -0
  21. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +5 -0
  22. package/Libraries/Components/Pressable/Pressable.js +3 -3
  23. package/Libraries/Components/Pressable/Pressable.win32.js +3 -3
  24. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +47 -38
  25. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +15 -7
  26. package/Libraries/Components/ScrollView/ScrollView.js +1 -1
  27. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -3
  28. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -1
  29. package/Libraries/Components/Slider/Slider.js +0 -2
  30. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -1
  31. package/Libraries/Components/StatusBar/StatusBar.js +6 -1
  32. package/Libraries/Components/Switch/Switch.js +13 -2
  33. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +114 -109
  34. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +17 -9
  35. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +13 -5
  36. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +10 -0
  37. package/Libraries/Components/TextInput/TextInput.js +1 -8
  38. package/Libraries/Components/TextInput/TextInputState.js +10 -2
  39. package/Libraries/Components/TextInput/TextInputState.win32.js +10 -2
  40. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  41. package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
  42. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -0
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -0
  44. package/Libraries/Components/Touchable/TouchableOpacity.js +7 -1
  45. package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +3 -1
  46. package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
  47. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -0
  48. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  49. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  50. package/Libraries/Components/View/View.win32.js +33 -1
  51. package/Libraries/Components/View/ViewNativeComponent.js +68 -8
  52. package/Libraries/Components/View/ViewPropTypes.js +36 -4
  53. package/Libraries/Components/View/ViewPropTypes.win32.js +36 -4
  54. package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
  55. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  56. package/Libraries/Core/Devtools/parseHermesStack.js +1 -1
  57. package/Libraries/Core/ExceptionsManager.js +1 -1
  58. package/Libraries/Core/RawEventEmitter.js +38 -0
  59. package/Libraries/Core/ReactNativeVersion.js +2 -2
  60. package/Libraries/Core/polyfillPromise.js +32 -0
  61. package/Libraries/Core/setUpReactDevTools.js +3 -2
  62. package/Libraries/EventEmitter/NativeEventEmitter.js +3 -3
  63. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +2 -1
  64. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -3
  65. package/Libraries/Events/CustomEvent.js +32 -0
  66. package/Libraries/Events/EventPolyfill.js +239 -0
  67. package/Libraries/Image/Image.android.js +0 -6
  68. package/Libraries/Image/Image.ios.js +0 -6
  69. package/Libraries/Image/Image.win32.js +2 -8
  70. package/Libraries/Image/ImageViewNativeComponent.js +18 -3
  71. package/Libraries/Image/TextInlineImageNativeComponent.js +23 -15
  72. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  73. package/Libraries/Inspector/Inspector.js +2 -4
  74. package/Libraries/Inspector/Inspector.win32.js +7 -9
  75. package/Libraries/Interaction/BridgeSpyStallHandler.js +4 -3
  76. package/Libraries/Interaction/InteractionManager.js +1 -12
  77. package/Libraries/Interaction/TaskQueue.js +5 -4
  78. package/Libraries/LayoutAnimation/LayoutAnimation.js +13 -0
  79. package/Libraries/Linking/Linking.js +1 -1
  80. package/Libraries/Lists/FlatList.js +27 -6
  81. package/Libraries/Lists/VirtualizedList.js +71 -55
  82. package/Libraries/Lists/VirtualizedListContext.js +7 -3
  83. package/Libraries/Lists/VirtualizedSectionList.js +2 -2
  84. package/Libraries/Lists/__tests__/{FillRateHelper-test.windows.js → FillRateHelper-test.js} +2 -2
  85. package/Libraries/Lists/__tests__/{FlatList-test.windows.js → FlatList-test.js} +2 -2
  86. package/Libraries/Lists/__tests__/{SectionList-test.windows.js → SectionList-test.js} +14 -14
  87. package/Libraries/Lists/__tests__/{VirtualizeUtils-test.windows.js → VirtualizeUtils-test.js} +3 -3
  88. package/Libraries/Lists/__tests__/{VirtualizedList-test.windows.js → VirtualizedList-test.js} +92 -43
  89. package/Libraries/Lists/__tests__/{VirtualizedSectionList-test.windows.js → VirtualizedSectionList-test.js} +16 -14
  90. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  91. package/Libraries/LogBox/Data/LogBoxLog.js +1 -1
  92. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  93. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  94. package/Libraries/LogBox/LogBox.js +2 -21
  95. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -0
  96. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +2 -1
  97. package/Libraries/NativeComponent/BaseViewConfig.android.js +295 -0
  98. package/Libraries/NativeComponent/BaseViewConfig.ios.js +333 -0
  99. package/Libraries/NativeComponent/BaseViewConfig.win32.js +334 -0
  100. package/Libraries/NativeComponent/NativeComponentRegistry.js +0 -2
  101. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +24 -0
  102. package/Libraries/NativeComponent/StaticViewConfigValidator.js +7 -42
  103. package/Libraries/NativeComponent/ViewConfig.js +4 -4
  104. package/Libraries/NativeComponent/ViewConfigIgnore.js +54 -0
  105. package/Libraries/Network/FormData.js +7 -1
  106. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  107. package/Libraries/Pressability/Pressability.js +115 -46
  108. package/Libraries/Pressability/Pressability.win32.js +174 -69
  109. package/Libraries/Pressability/PressabilityDebug.js +5 -9
  110. package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +1 -0
  111. package/Libraries/ReactNative/AppContainer.js +1 -1
  112. package/Libraries/ReactNative/{DummyUIManager.js → BridgelessUIManager.js} +62 -40
  113. package/Libraries/ReactNative/PaperUIManager.win32.js +5 -5
  114. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +39 -0
  115. package/Libraries/ReactNative/UIManager.js +2 -3
  116. package/Libraries/ReactNative/renderApplication.js +4 -0
  117. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +8 -0
  118. package/Libraries/Renderer/implementations/ReactFabric-dev.js +5908 -4906
  119. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2100 -1918
  120. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2567 -2352
  121. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5610 -4844
  122. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1710 -1556
  123. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1830 -1639
  124. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  125. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -1
  126. package/Libraries/StyleSheet/EdgeInsetsPropType.js +4 -1
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +59 -66
  128. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  129. package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +15 -0
  130. package/Libraries/StyleSheet/private/_TransformStyle.js +53 -0
  131. package/Libraries/Text/Text.js +13 -7
  132. package/Libraries/Text/TextNativeComponent.js +2 -0
  133. package/Libraries/Text/TextNativeComponent.win32.js +2 -0
  134. package/Libraries/Text/TextProps.js +10 -0
  135. package/Libraries/Types/CoreEventTypes.js +13 -1
  136. package/Libraries/Types/CoreEventTypes.win32.js +26 -1
  137. package/Libraries/Utilities/Appearance.js +0 -8
  138. package/Libraries/Utilities/HMRClient.js +1 -1
  139. package/Libraries/Utilities/ReactNativeTestTools.js +1 -0
  140. package/Libraries/Utilities/codegenNativeComponent.js +17 -6
  141. package/Libraries/Utilities/stringifySafe.js +4 -1
  142. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +3 -3
  143. package/Libraries/WebSocket/WebSocket.js +1 -1
  144. package/Libraries/vendor/emitter/_EmitterSubscription.js +1 -1
  145. package/Libraries/vendor/emitter/_EventEmitter.js +1 -1
  146. package/Libraries/vendor/emitter/_EventSubscription.js +1 -1
  147. package/index.js +30 -25
  148. package/index.win32.js +30 -25
  149. package/jest/preprocessor.js +24 -107
  150. package/jest/preprocessor_DO_NOT_USE.js +122 -0
  151. package/metro.config.js +3 -47
  152. package/overrides.json +39 -46
  153. package/package.json +28 -26
  154. package/rntypes/index.d.ts +19 -7
  155. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
  156. package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +3 -1
  157. package/src/Libraries/Components/View/ViewWin32.Props.ts +1 -0
  158. package/src/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +427 -0
  159. package/src/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap +391 -0
  160. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +3 -0
  161. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +4565 -0
  162. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +1153 -0
  163. package/src/rntypes/index.d.ts +19 -7
  164. package/typings-index.js +5 -1
  165. package/typings-index.js.map +1 -1
  166. package/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +0 -44
  167. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +0 -45
  168. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +0 -123
  169. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js +0 -45
  170. package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -360
  171. package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +0 -401
  172. package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -83
  173. package/Libraries/ReactNative/UIManagerInjection.js +0 -15
  174. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +0 -24527
  175. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +0 -8309
  176. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +0 -8961
  177. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +0 -24948
  178. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +0 -8400
  179. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +0 -9049
  180. package/flow/Promise.js +0 -47
@@ -13,7 +13,7 @@
13
13
  import type EventEmitter from './EventEmitter';
14
14
  import _EventSubscription from './_EventSubscription';
15
15
  import type EventSubscriptionVendor from './_EventSubscriptionVendor';
16
- import {type EventSubscription} from './EventSubscription';
16
+ import type {EventSubscription} from './EventSubscription';
17
17
 
18
18
  /**
19
19
  * EmitterSubscription represents a subscription with listener and context data.
@@ -12,7 +12,7 @@
12
12
  const invariant = require('invariant');
13
13
 
14
14
  import EmitterSubscription from './_EmitterSubscription';
15
- import {type EventSubscription} from './EventSubscription';
15
+ import type {EventSubscription} from './EventSubscription';
16
16
  import EventSubscriptionVendor from './_EventSubscriptionVendor';
17
17
 
18
18
  const sparseFilterPredicate = () => true;
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {type EventSubscription} from './EventSubscription';
13
+ import type {EventSubscription} from './EventSubscription';
14
14
  import type EventSubscriptionVendor from './_EventSubscriptionVendor';
15
15
 
16
16
  /**
package/index.js CHANGED
@@ -30,7 +30,6 @@ import typeof RefreshControl from './Libraries/Components/RefreshControl/Refresh
30
30
  import typeof SafeAreaView from './Libraries/Components/SafeAreaView/SafeAreaView';
31
31
  import typeof ScrollView from './Libraries/Components/ScrollView/ScrollView';
32
32
  import typeof SectionList from './Libraries/Lists/SectionList';
33
- import typeof SegmentedControlIOS from './Libraries/Components/SegmentedControlIOS/SegmentedControlIOS';
34
33
  import typeof Slider from './Libraries/Components/Slider/Slider';
35
34
  import typeof StatusBar from './Libraries/Components/StatusBar/StatusBar';
36
35
  import typeof Switch from './Libraries/Components/Switch/Switch';
@@ -193,16 +192,6 @@ module.exports = {
193
192
  get SectionList(): SectionList {
194
193
  return require('./Libraries/Lists/SectionList').default;
195
194
  },
196
- // $FlowFixMe[value-as-type]
197
- get SegmentedControlIOS(): SegmentedControlIOS {
198
- warnOnce(
199
- 'segmented-control-ios-moved',
200
- 'SegmentedControlIOS has been extracted from react-native core and will be removed in a future release. ' +
201
- "It can now be installed and imported from '@react-native-segmented-control/segmented-control' instead of 'react-native'. " +
202
- 'See https://github.com/react-native-segmented-control/segmented-control',
203
- );
204
- return require('./Libraries/Components/SegmentedControlIOS/SegmentedControlIOS');
205
- },
206
195
  get Slider(): Slider {
207
196
  warnOnce(
208
197
  'slider-moved',
@@ -446,32 +435,32 @@ module.exports = {
446
435
  },
447
436
  // Deprecated Prop Types
448
437
  get ColorPropType(): $FlowFixMe {
449
- console.warn(
450
- 'ColorPropType will be removed from React Native. Migrate to ' +
438
+ invariant(
439
+ false,
440
+ 'ColorPropType has been removed from React Native. Migrate to ' +
451
441
  "ColorPropType exported from 'deprecated-react-native-prop-types'.",
452
442
  );
453
- return require('deprecated-react-native-prop-types').ColorPropType;
454
443
  },
455
444
  get EdgeInsetsPropType(): $FlowFixMe {
456
- console.warn(
457
- 'EdgeInsetsPropType will be removed from React Native. Migrate to ' +
445
+ invariant(
446
+ false,
447
+ 'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
458
448
  "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
459
449
  );
460
- return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
461
450
  },
462
451
  get PointPropType(): $FlowFixMe {
463
- console.warn(
464
- 'PointPropType will be removed from React Native. Migrate to ' +
452
+ invariant(
453
+ false,
454
+ 'PointPropType has been removed from React Native. Migrate to ' +
465
455
  "PointPropType exported from 'deprecated-react-native-prop-types'.",
466
456
  );
467
- return require('deprecated-react-native-prop-types').PointPropType;
468
457
  },
469
458
  get ViewPropTypes(): $FlowFixMe {
470
- console.warn(
471
- 'ViewPropTypes will be removed from React Native. Migrate to ' +
459
+ invariant(
460
+ false,
461
+ 'ViewPropTypes has been removed from React Native. Migrate to ' +
472
462
  "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
473
463
  );
474
- return require('deprecated-react-native-prop-types').ViewPropTypes;
475
464
  },
476
465
  };
477
466
 
@@ -647,8 +636,8 @@ if (__DEV__) {
647
636
  invariant(
648
637
  false,
649
638
  'ViewPagerAndroid has been removed from React Native. ' +
650
- "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " +
651
- 'See https://github.com/callstack/react-native-viewpager',
639
+ "It can now be installed and imported from 'react-native-pager-view' instead of 'react-native'. " +
640
+ 'See https://github.com/callstack/react-native-pager-view',
652
641
  );
653
642
  },
654
643
  });
@@ -669,6 +658,22 @@ if (__DEV__) {
669
658
  },
670
659
  });
671
660
 
661
+ /* $FlowFixMe[prop-missing] This is intentional: Flow will error when
662
+ * attempting to access SegmentedControlIOS. */
663
+ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when
664
+ * attempting to access SegmentedControlIOS. */
665
+ Object.defineProperty(module.exports, 'SegmentedControlIOS', {
666
+ configurable: true,
667
+ get() {
668
+ invariant(
669
+ false,
670
+ 'SegmentedControlIOS has been removed from React Native. ' +
671
+ "It can now be installed and imported from '@react-native-community/segmented-checkbox' instead of 'react-native'." +
672
+ 'See https://github.com/react-native-segmented-control/segmented-control',
673
+ );
674
+ },
675
+ });
676
+
672
677
  /* $FlowFixMe[prop-missing] This is intentional: Flow will error when
673
678
  * attempting to access StatusBarIOS. */
674
679
  /* $FlowFixMe[invalid-export] This is intentional: Flow will error when
package/index.win32.js CHANGED
@@ -30,7 +30,6 @@ import typeof RefreshControl from './Libraries/Components/RefreshControl/Refresh
30
30
  import typeof SafeAreaView from './Libraries/Components/SafeAreaView/SafeAreaView';
31
31
  import typeof ScrollView from './Libraries/Components/ScrollView/ScrollView';
32
32
  import typeof SectionList from './Libraries/Lists/SectionList';
33
- import typeof SegmentedControlIOS from './Libraries/Components/SegmentedControlIOS/SegmentedControlIOS';
34
33
  import typeof Slider from './Libraries/Components/Slider/Slider';
35
34
  import typeof StatusBar from './Libraries/Components/StatusBar/StatusBar';
36
35
  import typeof Switch from './Libraries/Components/Switch/Switch';
@@ -197,16 +196,6 @@ module.exports = {
197
196
  get SectionList(): SectionList {
198
197
  return require('./Libraries/Lists/SectionList').default;
199
198
  },
200
- // $FlowFixMe[value-as-type]
201
- get SegmentedControlIOS(): SegmentedControlIOS {
202
- warnOnce(
203
- 'segmented-control-ios-moved',
204
- 'SegmentedControlIOS has been extracted from react-native core and will be removed in a future release. ' +
205
- "It can now be installed and imported from '@react-native-segmented-control/segmented-control' instead of 'react-native'. " +
206
- 'See https://github.com/react-native-segmented-control/segmented-control',
207
- );
208
- return require('./Libraries/Components/SegmentedControlIOS/SegmentedControlIOS');
209
- },
210
199
  get Slider(): Slider {
211
200
  warnOnce(
212
201
  'slider-moved',
@@ -456,32 +445,32 @@ module.exports = {
456
445
  },
457
446
  // Deprecated Prop Types
458
447
  get ColorPropType(): $FlowFixMe {
459
- console.warn(
460
- 'ColorPropType will be removed from React Native. Migrate to ' +
448
+ invariant(
449
+ false,
450
+ 'ColorPropType has been removed from React Native. Migrate to ' +
461
451
  "ColorPropType exported from 'deprecated-react-native-prop-types'.",
462
452
  );
463
- return require('deprecated-react-native-prop-types').ColorPropType;
464
453
  },
465
454
  get EdgeInsetsPropType(): $FlowFixMe {
466
- console.warn(
467
- 'EdgeInsetsPropType will be removed from React Native. Migrate to ' +
455
+ invariant(
456
+ false,
457
+ 'EdgeInsetsPropType has been removed from React Native. Migrate to ' +
468
458
  "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.",
469
459
  );
470
- return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
471
460
  },
472
461
  get PointPropType(): $FlowFixMe {
473
- console.warn(
474
- 'PointPropType will be removed from React Native. Migrate to ' +
462
+ invariant(
463
+ false,
464
+ 'PointPropType has been removed from React Native. Migrate to ' +
475
465
  "PointPropType exported from 'deprecated-react-native-prop-types'.",
476
466
  );
477
- return require('deprecated-react-native-prop-types').PointPropType;
478
467
  },
479
468
  get ViewPropTypes(): $FlowFixMe {
480
- console.warn(
481
- 'ViewPropTypes will be removed from React Native. Migrate to ' +
469
+ invariant(
470
+ false,
471
+ 'ViewPropTypes has been removed from React Native. Migrate to ' +
482
472
  "ViewPropTypes exported from 'deprecated-react-native-prop-types'.",
483
473
  );
484
- return require('deprecated-react-native-prop-types').ViewPropTypes;
485
474
  },
486
475
  // Win32 Types (Typescript components exported as flow any)
487
476
  get ColorGradientWin32(): ColorGradientWin32 {
@@ -685,8 +674,8 @@ if (__DEV__) {
685
674
  invariant(
686
675
  false,
687
676
  'ViewPagerAndroid has been removed from React Native. ' +
688
- "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " +
689
- 'See https://github.com/callstack/react-native-viewpager',
677
+ "It can now be installed and imported from 'react-native-pager-view' instead of 'react-native'. " +
678
+ 'See https://github.com/callstack/react-native-pager-view',
690
679
  );
691
680
  },
692
681
  });
@@ -707,6 +696,22 @@ if (__DEV__) {
707
696
  },
708
697
  });
709
698
 
699
+ /* $FlowFixMe[prop-missing] This is intentional: Flow will error when
700
+ * attempting to access SegmentedControlIOS. */
701
+ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when
702
+ * attempting to access SegmentedControlIOS. */
703
+ Object.defineProperty(module.exports, 'SegmentedControlIOS', {
704
+ configurable: true,
705
+ get() {
706
+ invariant(
707
+ false,
708
+ 'SegmentedControlIOS has been removed from React Native. ' +
709
+ "It can now be installed and imported from '@react-native-community/segmented-checkbox' instead of 'react-native'." +
710
+ 'See https://github.com/react-native-segmented-control/segmented-control',
711
+ );
712
+ },
713
+ });
714
+
710
715
  /* $FlowFixMe[prop-missing] This is intentional: Flow will error when
711
716
  * attempting to access StatusBarIOS. */
712
717
  /* $FlowFixMe[invalid-export] This is intentional: Flow will error when
@@ -12,112 +12,29 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const babelRegisterOnly = require('metro-babel-register');
16
- const createCacheKeyFunction =
17
- require('@jest/create-cache-key-function').default;
18
-
19
- const {transformSync: babelTransformSync} = require('@babel/core');
20
- const generate = require('@babel/generator').default;
21
-
22
- const nodeFiles = new RegExp(
23
- [
24
- '/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc.
25
- ].join('|'),
15
+ // NOTE: Avoiding using a package like 'chalk' here, for simplicity
16
+ const YELLOW = process.stderr.isTTY ? '\u001b[33m' : '';
17
+ const BOLD = process.stderr.isTTY ? '\u001b[1m' : '';
18
+ const RESET = process.stderr.isTTY ? '\u001b[0m' : '';
19
+ const UNDERLINE = process.stderr.isTTY ? '\u001b[4m' : '';
20
+
21
+ console.warn(
22
+ '\n' +
23
+ YELLOW +
24
+ BOLD +
25
+ 'react-native/jest/preprocessor.js' +
26
+ RESET +
27
+ YELLOW +
28
+ ' is deprecated and will be removed.\n' +
29
+ 'Use "preset": "react-native" in your Jest config instead.\n' +
30
+ 'See ' +
31
+ UNDERLINE +
32
+ 'https://jestjs.io/docs/tutorial-react-native' +
33
+ RESET +
34
+ YELLOW +
35
+ ' for more setup instructions.' +
36
+ RESET +
37
+ '\n',
26
38
  );
27
- const nodeOptions = babelRegisterOnly.config([nodeFiles]);
28
-
29
- babelRegisterOnly([]);
30
-
31
- const transformer = require('metro-react-native-babel-transformer');
32
- module.exports = {
33
- process(src /*: string */, file /*: string */) /*: string */ {
34
- if (nodeFiles.test(file)) {
35
- // node specific transforms only
36
- return babelTransformSync(src, {
37
- filename: file,
38
- sourceType: 'script',
39
- ...nodeOptions,
40
- ast: false,
41
- }).code;
42
- }
43
-
44
- const {ast} = transformer.transform({
45
- filename: file,
46
- options: {
47
- ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
48
- dev: true,
49
- enableBabelRuntime: false,
50
- experimentalImportSupport: false,
51
- globalPrefix: '',
52
- hot: false,
53
- inlineRequires: true,
54
- minify: false,
55
- platform: '',
56
- projectRoot: '',
57
- publicPath: '/assets',
58
- retainLines: true,
59
- sourceType: 'unambiguous', // b7 required. detects module vs script mode
60
- },
61
- src,
62
- plugins: [
63
- [require('@babel/plugin-transform-block-scoping')],
64
- // the flow strip types plugin must go BEFORE class properties!
65
- // there'll be a test case that fails if you don't.
66
- [require('@babel/plugin-transform-flow-strip-types')],
67
- [
68
- require('@babel/plugin-proposal-class-properties'),
69
- // use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
70
- {loose: true},
71
- ],
72
- [require('@babel/plugin-transform-computed-properties')],
73
- [require('@babel/plugin-transform-destructuring')],
74
- [require('@babel/plugin-transform-function-name')],
75
- [require('@babel/plugin-transform-literals')],
76
- [require('@babel/plugin-transform-parameters')],
77
- [require('@babel/plugin-transform-shorthand-properties')],
78
- [require('@babel/plugin-transform-react-jsx')],
79
- [require('@babel/plugin-transform-regenerator')],
80
- [require('@babel/plugin-transform-sticky-regex')],
81
- [require('@babel/plugin-transform-unicode-regex')],
82
- [
83
- require('@babel/plugin-transform-modules-commonjs'),
84
- {strict: false, allowTopLevelThis: true},
85
- ],
86
- [require('@babel/plugin-transform-classes')],
87
- [require('@babel/plugin-transform-arrow-functions')],
88
- [require('@babel/plugin-transform-spread')],
89
- [require('@babel/plugin-proposal-object-rest-spread')],
90
- [
91
- require('@babel/plugin-transform-template-literals'),
92
- {loose: true}, // dont 'a'.concat('b'), just use 'a'+'b'
93
- ],
94
- [require('@babel/plugin-transform-exponentiation-operator')],
95
- [require('@babel/plugin-transform-object-assign')],
96
- [require('@babel/plugin-transform-for-of'), {loose: true}],
97
- [require('@babel/plugin-transform-react-display-name')],
98
- [require('@babel/plugin-transform-react-jsx-source')],
99
- ],
100
- });
101
-
102
- return generate(
103
- ast,
104
- // $FlowFixMe[prop-missing] Error found when improving flow typing for libs
105
- {
106
- code: true,
107
- comments: false,
108
- compact: false,
109
- filename: file,
110
- retainLines: true,
111
- sourceFileName: file,
112
- sourceMaps: true,
113
- },
114
- src,
115
- ).code;
116
- },
117
39
 
118
- getCacheKey: (createCacheKeyFunction([
119
- __filename,
120
- require.resolve('metro-react-native-babel-transformer'),
121
- require.resolve('@babel/core/package.json'),
122
- ]) /*: any */),
123
- };
40
+ module.exports = require('./preprocessor_DO_NOT_USE');
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow
9
+ */
10
+
11
+ /* eslint-env node */
12
+
13
+ 'use strict';
14
+
15
+ const babelRegisterOnly = require('metro-babel-register');
16
+ const createCacheKeyFunction =
17
+ require('@jest/create-cache-key-function').default;
18
+
19
+ const {transformSync: babelTransformSync} = require('@babel/core');
20
+ const generate = require('@babel/generator').default;
21
+
22
+ const nodeFiles = new RegExp(
23
+ [
24
+ '/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc.
25
+ ].join('|'),
26
+ );
27
+ const nodeOptions = babelRegisterOnly.config([nodeFiles]);
28
+
29
+ babelRegisterOnly([]);
30
+
31
+ const transformer = require('metro-react-native-babel-transformer');
32
+ module.exports = {
33
+ process(src /*: string */, file /*: string */) /*: {code: string, ...} */ {
34
+ if (nodeFiles.test(file)) {
35
+ // node specific transforms only
36
+ return babelTransformSync(src, {
37
+ filename: file,
38
+ sourceType: 'script',
39
+ ...nodeOptions,
40
+ ast: false,
41
+ });
42
+ }
43
+
44
+ const {ast} = transformer.transform({
45
+ filename: file,
46
+ options: {
47
+ ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
48
+ dev: true,
49
+ enableBabelRuntime: false,
50
+ experimentalImportSupport: false,
51
+ globalPrefix: '',
52
+ hot: false,
53
+ inlineRequires: true,
54
+ minify: false,
55
+ platform: '',
56
+ projectRoot: '',
57
+ publicPath: '/assets',
58
+ retainLines: true,
59
+ sourceType: 'unambiguous', // b7 required. detects module vs script mode
60
+ },
61
+ src,
62
+ plugins: [
63
+ [require('@babel/plugin-transform-block-scoping')],
64
+ // the flow strip types plugin must go BEFORE class properties!
65
+ // there'll be a test case that fails if you don't.
66
+ [require('@babel/plugin-transform-flow-strip-types')],
67
+ [
68
+ require('@babel/plugin-proposal-class-properties'),
69
+ // use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
70
+ {loose: true},
71
+ ],
72
+ [require('@babel/plugin-transform-computed-properties')],
73
+ [require('@babel/plugin-transform-destructuring')],
74
+ [require('@babel/plugin-transform-function-name')],
75
+ [require('@babel/plugin-transform-literals')],
76
+ [require('@babel/plugin-transform-parameters')],
77
+ [require('@babel/plugin-transform-shorthand-properties')],
78
+ [require('@babel/plugin-transform-react-jsx')],
79
+ [require('@babel/plugin-transform-regenerator')],
80
+ [require('@babel/plugin-transform-sticky-regex')],
81
+ [require('@babel/plugin-transform-unicode-regex')],
82
+ [
83
+ require('@babel/plugin-transform-modules-commonjs'),
84
+ {strict: false, allowTopLevelThis: true},
85
+ ],
86
+ [require('@babel/plugin-transform-classes')],
87
+ [require('@babel/plugin-transform-arrow-functions')],
88
+ [require('@babel/plugin-transform-spread')],
89
+ [require('@babel/plugin-proposal-object-rest-spread')],
90
+ [
91
+ require('@babel/plugin-transform-template-literals'),
92
+ {loose: true}, // dont 'a'.concat('b'), just use 'a'+'b'
93
+ ],
94
+ [require('@babel/plugin-transform-exponentiation-operator')],
95
+ [require('@babel/plugin-transform-for-of'), {loose: true}],
96
+ [require('@babel/plugin-transform-react-display-name')],
97
+ [require('@babel/plugin-transform-react-jsx-source')],
98
+ ],
99
+ });
100
+
101
+ return generate(
102
+ ast,
103
+ // $FlowFixMe[prop-missing] Error found when improving flow typing for libs
104
+ {
105
+ code: true,
106
+ comments: false,
107
+ compact: false,
108
+ filename: file,
109
+ retainLines: true,
110
+ sourceFileName: file,
111
+ sourceMaps: true,
112
+ },
113
+ src,
114
+ );
115
+ },
116
+
117
+ getCacheKey: (createCacheKeyFunction([
118
+ __filename,
119
+ require.resolve('metro-react-native-babel-transformer'),
120
+ require.resolve('@babel/core/package.json'),
121
+ ]) /*: any */),
122
+ };
package/metro.config.js CHANGED
@@ -1,53 +1,6 @@
1
- /**
2
- * @format
3
- */
4
1
  const fs = require('fs');
5
2
  const path = require('path');
6
3
 
7
- const rnWin32Path = fs.realpathSync(
8
- path.dirname(require.resolve('@office-iss/react-native-win32/package.json')),
9
- );
10
- const rnwTesterPath = fs.realpathSync(
11
- path.dirname(
12
- require.resolve('@office-iss/react-native-win32-tester/package.json'),
13
- ),
14
- );
15
- const virtualizedListPath = fs.realpathSync(
16
- path.resolve(
17
- require.resolve('@react-native-windows/virtualized-list/package.json'),
18
- '..',
19
- ),
20
- );
21
-
22
- module.exports = {
23
- // WatchFolders is only needed due to the yarn workspace layout of node_modules, we need to watch the symlinked locations separately
24
- watchFolders: [
25
- // Include hoisted modules
26
- path.resolve(__dirname, '../../../node_modules'),
27
- rnwTesterPath,
28
- rnWin32Path,
29
- // Add virtualized-list dependency, whose unsymlinked representation is not in node_modules, only in our repo
30
- virtualizedListPath,
31
- ],
32
-
33
- resolver: {
34
- extraNodeModules: {
35
- '@office-iss/react-native-win32': rnWin32Path,
36
- 'react-native-win32-tester': rnwTesterPath,
37
- '@react-native-windows/virtualized-list': virtualizedListPath,
38
- },
39
- },
40
-
41
- transformer: {
42
- getTransformOptions: async () => ({
43
- transform: {
44
- experimentalImportSupport: false,
45
- inlineRequires: true,
46
- },
47
- }),
48
- },
49
- };
50
-
51
4
  // Check that we have built our JS files before running the bundler, otherwise we'll get a harder to diagnose "Unable to resolve module" error
52
5
  if (
53
6
  !fs.existsSync(
@@ -58,3 +11,6 @@ if (
58
11
  '\nThis package must be built before running the bundler. Did you mean to run "yarn build" first?\n',
59
12
  );
60
13
  }
14
+
15
+ const {makeMetroConfig} = require('@rnw-scripts/metro-dev-config');
16
+ module.exports = makeMetroConfig();