@office-iss/react-native-win32 0.68.0 → 0.69.0-preview.3

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 (183) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.flowconfig +1 -3
  3. package/CHANGELOG.json +386 -32
  4. package/CHANGELOG.md +166 -19
  5. package/IntegrationTests/BUCK +4 -1
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -0
  7. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +1 -0
  8. package/Libraries/Alert/Alert.win32.js +1 -1
  9. package/Libraries/Animated/AnimatedImplementation.js +1 -1
  10. package/Libraries/Animated/NativeAnimatedHelper.js +55 -9
  11. package/Libraries/Animated/NativeAnimatedModule.js +1 -0
  12. package/Libraries/Animated/NativeAnimatedTurboModule.js +1 -0
  13. package/Libraries/Animated/animations/TimingAnimation.js +6 -11
  14. package/Libraries/Animated/createAnimatedComponent.js +2 -2
  15. package/Libraries/Animated/nodes/AnimatedColor.js +95 -29
  16. package/Libraries/Animated/nodes/AnimatedInterpolation.js +19 -22
  17. package/Libraries/Animated/nodes/AnimatedNode.js +2 -2
  18. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  19. package/Libraries/AppState/AppState.js +1 -1
  20. package/Libraries/Blob/URL.js +7 -1
  21. package/Libraries/Components/Button.js +3 -0
  22. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +5 -0
  23. package/Libraries/Components/Pressable/Pressable.js +3 -3
  24. package/Libraries/Components/Pressable/Pressable.win32.js +3 -3
  25. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +47 -38
  26. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +15 -7
  27. package/Libraries/Components/ScrollView/ScrollView.js +1 -1
  28. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -3
  29. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -1
  30. package/Libraries/Components/Slider/Slider.js +0 -2
  31. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -1
  32. package/Libraries/Components/StatusBar/StatusBar.js +6 -1
  33. package/Libraries/Components/Switch/Switch.js +11 -1
  34. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +114 -109
  35. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +17 -9
  36. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +13 -5
  37. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +10 -0
  38. package/Libraries/Components/TextInput/TextInput.js +1 -8
  39. package/Libraries/Components/TextInput/TextInputState.js +10 -2
  40. package/Libraries/Components/TextInput/TextInputState.win32.js +10 -2
  41. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  42. package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
  43. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -0
  44. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -0
  45. package/Libraries/Components/Touchable/TouchableOpacity.js +7 -1
  46. package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +3 -1
  47. package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
  48. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -0
  49. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  50. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  51. package/Libraries/Components/View/View.win32.js +33 -1
  52. package/Libraries/Components/View/ViewNativeComponent.js +68 -8
  53. package/Libraries/Components/View/ViewPropTypes.js +36 -4
  54. package/Libraries/Components/View/ViewPropTypes.win32.js +36 -4
  55. package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
  56. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  57. package/Libraries/Core/Devtools/parseHermesStack.js +1 -1
  58. package/Libraries/Core/ExceptionsManager.js +1 -1
  59. package/Libraries/Core/RawEventEmitter.js +38 -0
  60. package/Libraries/Core/ReactNativeVersion.js +2 -2
  61. package/Libraries/Core/polyfillPromise.js +32 -0
  62. package/Libraries/Core/setUpReactDevTools.js +3 -2
  63. package/Libraries/EventEmitter/NativeEventEmitter.js +3 -3
  64. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +2 -1
  65. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -3
  66. package/Libraries/Events/CustomEvent.js +32 -0
  67. package/Libraries/Events/EventPolyfill.js +239 -0
  68. package/Libraries/Image/Image.android.js +0 -6
  69. package/Libraries/Image/Image.ios.js +0 -6
  70. package/Libraries/Image/Image.win32.js +2 -8
  71. package/Libraries/Image/ImageViewNativeComponent.js +18 -3
  72. package/Libraries/Image/TextInlineImageNativeComponent.js +23 -15
  73. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  74. package/Libraries/Inspector/Inspector.js +2 -4
  75. package/Libraries/Inspector/Inspector.win32.js +7 -9
  76. package/Libraries/Interaction/BridgeSpyStallHandler.js +4 -3
  77. package/Libraries/Interaction/InteractionManager.js +1 -12
  78. package/Libraries/Interaction/TaskQueue.js +5 -4
  79. package/Libraries/LayoutAnimation/LayoutAnimation.js +13 -0
  80. package/Libraries/Linking/Linking.js +1 -1
  81. package/Libraries/Lists/FlatList.js +27 -6
  82. package/Libraries/Lists/VirtualizedList.js +71 -55
  83. package/Libraries/Lists/VirtualizedListContext.js +7 -3
  84. package/Libraries/Lists/VirtualizedSectionList.js +2 -2
  85. package/Libraries/Lists/__tests__/{FillRateHelper-test.windows.js → FillRateHelper-test.js} +2 -2
  86. package/Libraries/Lists/__tests__/{FlatList-test.windows.js → FlatList-test.js} +2 -2
  87. package/Libraries/Lists/__tests__/{SectionList-test.windows.js → SectionList-test.js} +14 -14
  88. package/Libraries/Lists/__tests__/{VirtualizeUtils-test.windows.js → VirtualizeUtils-test.js} +3 -3
  89. package/Libraries/Lists/__tests__/{VirtualizedList-test.windows.js → VirtualizedList-test.js} +92 -43
  90. package/Libraries/Lists/__tests__/{VirtualizedSectionList-test.windows.js → VirtualizedSectionList-test.js} +16 -14
  91. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  92. package/Libraries/LogBox/Data/LogBoxLog.js +1 -1
  93. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  94. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  95. package/Libraries/LogBox/LogBox.js +2 -21
  96. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -0
  97. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +2 -1
  98. package/Libraries/NativeComponent/BaseViewConfig.android.js +295 -0
  99. package/Libraries/NativeComponent/BaseViewConfig.ios.js +333 -0
  100. package/Libraries/NativeComponent/BaseViewConfig.win32.js +334 -0
  101. package/Libraries/NativeComponent/NativeComponentRegistry.js +0 -2
  102. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +24 -0
  103. package/Libraries/NativeComponent/StaticViewConfigValidator.js +7 -42
  104. package/Libraries/NativeComponent/ViewConfig.js +4 -4
  105. package/Libraries/NativeComponent/ViewConfigIgnore.js +54 -0
  106. package/Libraries/Network/FormData.js +7 -1
  107. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  108. package/Libraries/Pressability/Pressability.js +115 -46
  109. package/Libraries/Pressability/Pressability.win32.js +174 -69
  110. package/Libraries/Pressability/PressabilityDebug.js +5 -9
  111. package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +1 -0
  112. package/Libraries/ReactNative/AppContainer.js +1 -1
  113. package/Libraries/ReactNative/{DummyUIManager.js → BridgelessUIManager.js} +62 -40
  114. package/Libraries/ReactNative/PaperUIManager.win32.js +5 -5
  115. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +39 -0
  116. package/Libraries/ReactNative/UIManager.js +2 -3
  117. package/Libraries/ReactNative/renderApplication.js +4 -0
  118. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +8 -0
  119. package/Libraries/Renderer/implementations/ReactFabric-dev.js +5908 -4906
  120. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2100 -1918
  121. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2567 -2352
  122. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5610 -4844
  123. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1710 -1556
  124. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1830 -1639
  125. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  126. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -1
  127. package/Libraries/StyleSheet/EdgeInsetsPropType.js +4 -1
  128. package/Libraries/StyleSheet/StyleSheetTypes.js +59 -66
  129. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  130. package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +15 -0
  131. package/Libraries/StyleSheet/private/_TransformStyle.js +53 -0
  132. package/Libraries/Text/Text.js +13 -7
  133. package/Libraries/Text/TextNativeComponent.js +2 -0
  134. package/Libraries/Text/TextNativeComponent.win32.js +2 -0
  135. package/Libraries/Text/TextProps.js +10 -0
  136. package/Libraries/Types/CoreEventTypes.js +13 -1
  137. package/Libraries/Types/CoreEventTypes.win32.js +26 -1
  138. package/Libraries/Utilities/Appearance.js +0 -8
  139. package/Libraries/Utilities/HMRClient.js +1 -1
  140. package/Libraries/Utilities/ReactNativeTestTools.js +1 -0
  141. package/Libraries/Utilities/codegenNativeComponent.js +16 -6
  142. package/Libraries/Utilities/stringifySafe.js +4 -1
  143. package/Libraries/Utilities/useColorScheme.js +9 -15
  144. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +3 -3
  145. package/Libraries/WebSocket/WebSocket.js +1 -1
  146. package/Libraries/vendor/emitter/_EmitterSubscription.js +1 -1
  147. package/Libraries/vendor/emitter/_EventEmitter.js +1 -1
  148. package/Libraries/vendor/emitter/_EventSubscription.js +1 -1
  149. package/flow/{use-subscription.js → use-sync-external-store.js} +4 -4
  150. package/index.js +30 -25
  151. package/index.win32.js +30 -25
  152. package/jest/preprocessor.js +24 -107
  153. package/jest/preprocessor_DO_NOT_USE.js +122 -0
  154. package/metro.config.js +3 -47
  155. package/overrides.json +39 -46
  156. package/package.json +32 -29
  157. package/rntypes/index.d.ts +19 -7
  158. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
  159. package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +3 -1
  160. package/src/Libraries/Components/View/ViewWin32.Props.ts +1 -0
  161. package/src/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +427 -0
  162. package/src/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap +391 -0
  163. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +3 -0
  164. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +4565 -0
  165. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizedSectionList-test.js.snap +1153 -0
  166. package/src/rntypes/index.d.ts +19 -7
  167. package/typings-index.js +5 -1
  168. package/typings-index.js.map +1 -1
  169. package/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +0 -44
  170. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +0 -45
  171. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +0 -123
  172. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js +0 -45
  173. package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -360
  174. package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +0 -401
  175. package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -83
  176. package/Libraries/ReactNative/UIManagerInjection.js +0 -15
  177. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +0 -24527
  178. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +0 -8309
  179. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +0 -8961
  180. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +0 -24948
  181. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +0 -8400
  182. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +0 -9049
  183. package/flow/Promise.js +0 -47
@@ -22,7 +22,7 @@ describe('VirtualizedList', () => {
22
22
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
23
23
  renderItem={({item}) => <item value={item.key} />}
24
24
  getItem={(data, index) => data[index]}
25
- getItemCount={(data) => data.length}
25
+ getItemCount={data => data.length}
26
26
  />,
27
27
  );
28
28
  expect(component).toMatchSnapshot();
@@ -37,7 +37,7 @@ describe('VirtualizedList', () => {
37
37
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
38
38
  ListItemComponent={ListItemComponent}
39
39
  getItem={(data, index) => data[index]}
40
- getItemCount={(data) => data.length}
40
+ getItemCount={data => data.length}
41
41
  />,
42
42
  );
43
43
  expect(component).toMatchSnapshot();
@@ -56,7 +56,7 @@ describe('VirtualizedList', () => {
56
56
  <item value={item.key} testID={`${item.key}-renderItem`} />
57
57
  )}
58
58
  getItem={(data, index) => data[index]}
59
- getItemCount={(data) => data.length}
59
+ getItemCount={data => data.length}
60
60
  />,
61
61
  );
62
62
 
@@ -70,7 +70,7 @@ describe('VirtualizedList', () => {
70
70
  it('throws if no renderItem or ListItemComponent', () => {
71
71
  // Silence the React error boundary warning; we expect an uncaught error.
72
72
  const consoleError = console.error;
73
- jest.spyOn(console, 'error').mockImplementation((message) => {
73
+ jest.spyOn(console, 'error').mockImplementation(message => {
74
74
  if (message.startsWith('The above error occurred in the ')) {
75
75
  return;
76
76
  }
@@ -82,7 +82,7 @@ describe('VirtualizedList', () => {
82
82
  <VirtualizedList
83
83
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
84
84
  getItem={(data, index) => data[index]}
85
- getItemCount={(data) => data.length}
85
+ getItemCount={data => data.length}
86
86
  />,
87
87
  );
88
88
  expect(componentFactory).toThrow(
@@ -98,7 +98,7 @@ describe('VirtualizedList', () => {
98
98
  data={[]}
99
99
  renderItem={({item}) => <item value={item.key} />}
100
100
  getItem={(data, index) => data[index]}
101
- getItemCount={(data) => data.length}
101
+ getItemCount={data => data.length}
102
102
  />,
103
103
  );
104
104
  expect(component).toMatchSnapshot();
@@ -110,7 +110,7 @@ describe('VirtualizedList', () => {
110
110
  data={[]}
111
111
  renderItem={({item}) => <item value={item.key} />}
112
112
  getItem={(data, index) => data[index]}
113
- getItemCount={(data) => data.length}
113
+ getItemCount={data => data.length}
114
114
  />,
115
115
  );
116
116
 
@@ -132,7 +132,7 @@ describe('VirtualizedList', () => {
132
132
  data={undefined}
133
133
  renderItem={({item}) => <item value={item.key} />}
134
134
  getItem={(data, index) => data[index]}
135
- getItemCount={(data) => 0}
135
+ getItemCount={data => 0}
136
136
  />,
137
137
  );
138
138
  expect(component).toMatchSnapshot();
@@ -146,7 +146,7 @@ describe('VirtualizedList', () => {
146
146
  ListFooterComponent={() => <footer />}
147
147
  ListHeaderComponent={() => <header />}
148
148
  getItem={(data, index) => data[index]}
149
- getItemCount={(data) => data.length}
149
+ getItemCount={data => data.length}
150
150
  renderItem={({item}) => <item value={item.key} />}
151
151
  />,
152
152
  );
@@ -159,7 +159,7 @@ describe('VirtualizedList', () => {
159
159
  data={[{key: 'hello'}]}
160
160
  ListEmptyComponent={() => <empty />}
161
161
  getItem={(data, index) => data[index]}
162
- getItemCount={(data) => data.length}
162
+ getItemCount={data => data.length}
163
163
  renderItem={({item}) => <item value={item.key} />}
164
164
  />,
165
165
  );
@@ -175,7 +175,7 @@ describe('VirtualizedList', () => {
175
175
  ListHeaderComponent={() => <header />}
176
176
  data={new Array(5).fill().map((_, ii) => ({id: String(ii)}))}
177
177
  getItem={(data, index) => data[index]}
178
- getItemCount={(data) => data.length}
178
+ getItemCount={data => data.length}
179
179
  getItemLayout={({index}) => ({length: 50, offset: index * 50})}
180
180
  inverted={true}
181
181
  keyExtractor={(item, index) => item.id}
@@ -203,14 +203,14 @@ describe('VirtualizedList', () => {
203
203
  const infos = [];
204
204
  const component = ReactTestRenderer.create(
205
205
  <VirtualizedList
206
- ItemSeparatorComponent={(props) => <separator {...props} />}
206
+ ItemSeparatorComponent={props => <separator {...props} />}
207
207
  data={[{key: 'i0'}, {key: 'i1'}, {key: 'i2'}]}
208
- renderItem={(info) => {
208
+ renderItem={info => {
209
209
  infos.push(info);
210
210
  return <item title={info.item.key} />;
211
211
  }}
212
212
  getItem={(data, index) => data[index]}
213
- getItemCount={(data) => data.length}
213
+ getItemCount={data => data.length}
214
214
  />,
215
215
  );
216
216
  expect(component).toMatchSnapshot();
@@ -225,22 +225,22 @@ describe('VirtualizedList', () => {
225
225
  const component = ReactTestRenderer.create(
226
226
  <VirtualizedList
227
227
  data={[{key: 'outer0'}, {key: 'outer1'}]}
228
- renderItem={(outerInfo) => (
228
+ renderItem={outerInfo => (
229
229
  <VirtualizedList
230
230
  data={[
231
231
  {key: outerInfo.item.key + ':inner0'},
232
232
  {key: outerInfo.item.key + ':inner1'},
233
233
  ]}
234
234
  horizontal={outerInfo.item.key === 'outer1'}
235
- renderItem={(innerInfo) => {
235
+ renderItem={innerInfo => {
236
236
  return <item title={innerInfo.item.key} />;
237
237
  }}
238
238
  getItem={(data, index) => data[index]}
239
- getItemCount={(data) => data.length}
239
+ getItemCount={data => data.length}
240
240
  />
241
241
  )}
242
242
  getItem={(data, index) => data[index]}
243
- getItemCount={(data) => data.length}
243
+ getItemCount={data => data.length}
244
244
  />,
245
245
  );
246
246
  expect(component).toMatchSnapshot();
@@ -261,7 +261,7 @@ describe('VirtualizedList', () => {
261
261
  data,
262
262
  renderItem: ({item}) => <item value={item.key} />,
263
263
  getItem: (items, index) => items[index],
264
- getItemCount: (items) => items.length,
264
+ getItemCount: items => items.length,
265
265
  getItemLayout: (items, index) => ({
266
266
  length: ITEM_HEIGHT,
267
267
  offset: ITEM_HEIGHT * index,
@@ -313,7 +313,7 @@ describe('VirtualizedList', () => {
313
313
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
314
314
  renderItem={({item}) => <item value={item.key} />}
315
315
  getItem={(data, index) => data[index]}
316
- getItemCount={(data) => data.length}
316
+ getItemCount={data => data.length}
317
317
  ref={listRef}
318
318
  />,
319
319
  );
@@ -331,22 +331,22 @@ describe('VirtualizedList', () => {
331
331
  ReactTestRenderer.create(
332
332
  <VirtualizedList
333
333
  data={[{key: 'outer0'}, {key: 'outer1'}]}
334
- renderItem={(outerInfo) => (
334
+ renderItem={outerInfo => (
335
335
  <VirtualizedList
336
336
  data={[
337
337
  {key: outerInfo.item.key + ':inner0'},
338
338
  {key: outerInfo.item.key + ':inner1'},
339
339
  ]}
340
- renderItem={(innerInfo) => {
340
+ renderItem={innerInfo => {
341
341
  return <item title={innerInfo.item.key} />;
342
342
  }}
343
343
  getItem={(data, index) => data[index]}
344
- getItemCount={(data) => data.length}
344
+ getItemCount={data => data.length}
345
345
  ref={listRef}
346
346
  />
347
347
  )}
348
348
  getItem={(data, index) => data[index]}
349
- getItemCount={(data) => data.length}
349
+ getItemCount={data => data.length}
350
350
  />,
351
351
  );
352
352
  const scrollRef = listRef.current.getScrollRef();
@@ -362,7 +362,7 @@ describe('VirtualizedList', () => {
362
362
  const layout = {width: 300, height: 600};
363
363
  let data = Array(20)
364
364
  .fill()
365
- .map((_, key) => ({key: String(key)}));
365
+ .map((_, index) => ({key: `key-${index}`}));
366
366
  const onEndReached = jest.fn();
367
367
  const props = {
368
368
  data,
@@ -371,7 +371,7 @@ describe('VirtualizedList', () => {
371
371
  windowSize: 21,
372
372
  renderItem: ({item}) => <item value={item.key} />,
373
373
  getItem: (items, index) => items[index],
374
- getItemCount: (items) => items.length,
374
+ getItemCount: items => items.length,
375
375
  getItemLayout: (items, index) => ({
376
376
  length: ITEM_HEIGHT,
377
377
  offset: ITEM_HEIGHT * index,
@@ -423,7 +423,7 @@ describe('VirtualizedList', () => {
423
423
  const commonProps = {
424
424
  data: [{key: 'cell0'}],
425
425
  getItem: (data, index) => data[index],
426
- getItemCount: (data) => data.length,
426
+ getItemCount: data => data.length,
427
427
  renderItem: ({item}) => <item value={item.key} />,
428
428
  };
429
429
  try {
@@ -485,7 +485,7 @@ describe('VirtualizedList', () => {
485
485
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
486
486
  renderItem={({item}) => <item value={item.key} />}
487
487
  getItem={(data, index) => data[index]}
488
- getItemCount={(data) => data.length}
488
+ getItemCount={data => data.length}
489
489
  />,
490
490
  );
491
491
  const instance = component.getInstance();
@@ -501,7 +501,7 @@ describe('VirtualizedList', () => {
501
501
  data={[]}
502
502
  renderItem={({item}) => <item value={item.key} />}
503
503
  getItem={(data, index) => data[index]}
504
- getItemCount={(data) => data.length}
504
+ getItemCount={data => data.length}
505
505
  />,
506
506
  );
507
507
  const instance = component.getInstance();
@@ -517,7 +517,7 @@ describe('VirtualizedList', () => {
517
517
  data={[{key: 'i1'}, {key: 'i2'}, {key: 'i3'}]}
518
518
  renderItem={({item}) => <item value={item.key} />}
519
519
  getItem={(data, index) => data[index]}
520
- getItemCount={(data) => data.length}
520
+ getItemCount={data => data.length}
521
521
  />,
522
522
  );
523
523
  const instance = component.getInstance();
@@ -862,7 +862,7 @@ it('does not adjust render area until content area layed out', () => {
862
862
  expect(component).toMatchSnapshot();
863
863
  });
864
864
 
865
- it('does not adjust render area with non-zero initialScrollIndex until scrolled', () => {
865
+ it('adjusts render area with non-zero initialScrollIndex', () => {
866
866
  const items = generateItems(20);
867
867
  const ITEM_HEIGHT = 10;
868
868
 
@@ -885,18 +885,17 @@ it('does not adjust render area with non-zero initialScrollIndex until scrolled'
885
885
  viewport: {width: 10, height: 50},
886
886
  content: {width: 10, height: 200},
887
887
  });
888
+
888
889
  performAllBatches();
889
890
  });
890
891
 
891
- // Layout information from before the time we scroll to initial index may not
892
- // correspond to the area "initialScrollIndex" points to. Expect only the 5
893
- // initial items (starting at initialScrollIndex) to be rendered after
894
- // processing all batch work, even though the windowSize allows for more.
892
+ // We should expand the render area after receiving a message indcating we
893
+ // arrived at initialScrollIndex.
895
894
  expect(component).toMatchSnapshot();
896
895
  });
897
896
 
898
- it('adjusts render area with non-zero initialScrollIndex after scrolled', () => {
899
- const items = generateItems(20);
897
+ it('renders new items when data is updated with non-zero initialScrollIndex', () => {
898
+ const items = generateItems(2);
900
899
  const ITEM_HEIGHT = 10;
901
900
 
902
901
  let component;
@@ -918,13 +917,29 @@ it('adjusts render area with non-zero initialScrollIndex after scrolled', () =>
918
917
  viewport: {width: 10, height: 50},
919
918
  content: {width: 10, height: 200},
920
919
  });
920
+ performAllBatches();
921
+ });
922
+
923
+ const newItems = generateItems(4);
924
+
925
+ ReactTestRenderer.act(() => {
926
+ component.update(
927
+ <VirtualizedList
928
+ initialNumToRender={5}
929
+ initialScrollIndex={1}
930
+ windowSize={10}
931
+ maxToRenderPerBatch={10}
932
+ {...baseItemProps(newItems)}
933
+ {...fixedHeightItemLayoutProps(ITEM_HEIGHT)}
934
+ />,
935
+ );
936
+ });
921
937
 
922
- simulateScroll(component, {x: 0, y: 10});
938
+ ReactTestRenderer.act(() => {
923
939
  performAllBatches();
924
940
  });
925
941
 
926
- // We should expand the render area after receiving a message indcating we
927
- // arrived at initialScrollIndex.
942
+ // We expect all the items to be rendered
928
943
  expect(component).toMatchSnapshot();
929
944
  });
930
945
 
@@ -1116,6 +1131,8 @@ it('retains batch render region when an item is appended', () => {
1116
1131
  performAllBatches();
1117
1132
  });
1118
1133
 
1134
+ jest.runAllTimers();
1135
+
1119
1136
  ReactTestRenderer.act(() => {
1120
1137
  component.update(
1121
1138
  <VirtualizedList
@@ -1365,6 +1382,7 @@ it('renders windowSize derived region at top', () => {
1365
1382
  performAllBatches();
1366
1383
  });
1367
1384
 
1385
+ jest.runAllTimers();
1368
1386
  // A windowSize of 3 means that we should render a viewport's worth of content
1369
1387
  // above and below the current. A 20 dip viewport at the top of the list means
1370
1388
  // we should render the top 4 10-dip items (for the current viewport, and
@@ -1402,6 +1420,7 @@ it('renders windowSize derived region in middle', () => {
1402
1420
  performAllBatches();
1403
1421
  });
1404
1422
 
1423
+ jest.runAllTimers();
1405
1424
  // A windowSize of 3 means that we should render a viewport's worth of content
1406
1425
  // above and below the current. A 20 dip viewport in the top of the list means
1407
1426
  // we should render the 6 10-dip items (for the current viewport, 20 dip above
@@ -1434,12 +1453,12 @@ it('renders windowSize derived region at bottom', () => {
1434
1453
  });
1435
1454
  performAllBatches();
1436
1455
  });
1437
-
1438
1456
  ReactTestRenderer.act(() => {
1439
1457
  simulateScroll(component, {x: 0, y: 80});
1440
1458
  performAllBatches();
1441
1459
  });
1442
1460
 
1461
+ jest.runAllTimers();
1443
1462
  // A windowSize of 3 means that we should render a viewport's worth of content
1444
1463
  // above and below the current. A 20 dip viewport at the bottom of the list
1445
1464
  // means we should render the bottom 4 10-dip items (for the current viewport,
@@ -1448,6 +1467,36 @@ it('renders windowSize derived region at bottom', () => {
1448
1467
  expect(component).toMatchSnapshot();
1449
1468
  });
1450
1469
 
1470
+ it('calls _onCellLayout properly', () => {
1471
+ const items = [{key: 'i1'}, {key: 'i2'}, {key: 'i3'}];
1472
+ const mock = jest.fn();
1473
+ const component = ReactTestRenderer.create(
1474
+ <VirtualizedList
1475
+ data={items}
1476
+ renderItem={({item}) => <item value={item.key} />}
1477
+ getItem={(data, index) => data[index]}
1478
+ getItemCount={data => data.length}
1479
+ />,
1480
+ );
1481
+ const virtualList: VirtualizedList = component.getInstance();
1482
+ virtualList._onCellLayout = mock;
1483
+ component.update(
1484
+ <VirtualizedList
1485
+ data={[...items, {key: 'i4'}]}
1486
+ renderItem={({item}) => <item value={item.key} />}
1487
+ getItem={(data, index) => data[index]}
1488
+ getItemCount={data => data.length}
1489
+ />,
1490
+ );
1491
+ const cell = virtualList._cellRefs.i4;
1492
+ const event = {
1493
+ nativeEvent: {layout: {x: 0, y: 0, width: 50, height: 50}},
1494
+ };
1495
+ cell._onLayout(event);
1496
+ expect(mock).toHaveBeenCalledWith(event, 'i4', 3);
1497
+ expect(mock).not.toHaveBeenCalledWith(event, 'i3', 2);
1498
+ });
1499
+
1451
1500
  function generateItems(count) {
1452
1501
  return Array(count)
1453
1502
  .fill()
@@ -1466,13 +1515,13 @@ function baseItemProps(items) {
1466
1515
  renderItem: ({item}) =>
1467
1516
  React.createElement('MockCellItem', {value: item.key, ...item}),
1468
1517
  getItem: (data, index) => data[index],
1469
- getItemCount: (data) => data.length,
1518
+ getItemCount: data => data.length,
1470
1519
  stickyHeaderIndices: stickyHeaderIndices(items),
1471
1520
  };
1472
1521
  }
1473
1522
 
1474
1523
  function stickyHeaderIndices(items) {
1475
- return items.filter((item) => item.sticky).map((item) => item.key);
1524
+ return items.filter(item => item.sticky).map(item => item.key);
1476
1525
  }
1477
1526
 
1478
1527
  function fixedHeightItemLayoutProps(height) {
@@ -25,7 +25,7 @@ describe('VirtualizedSectionList', () => {
25
25
  ]}
26
26
  renderItem={({item}) => <item value={item.key} />}
27
27
  getItem={(data, key) => data[key]}
28
- getItemCount={(data) => data.length}
28
+ getItemCount={data => data.length}
29
29
  />,
30
30
  );
31
31
  expect(component).toMatchSnapshot();
@@ -37,7 +37,7 @@ describe('VirtualizedSectionList', () => {
37
37
  sections={[]}
38
38
  renderItem={({item}) => <item value={item.key} />}
39
39
  getItem={(data, key) => data[key]}
40
- getItemCount={(data) => data.length}
40
+ getItemCount={data => data.length}
41
41
  />,
42
42
  );
43
43
  expect(component).toMatchSnapshot();
@@ -51,7 +51,7 @@ describe('VirtualizedSectionList', () => {
51
51
  ListFooterComponent={() => <footer />}
52
52
  ListHeaderComponent={() => <header />}
53
53
  getItem={(data, key) => data[key]}
54
- getItemCount={(data) => data.length}
54
+ getItemCount={data => data.length}
55
55
  renderItem={({item}) => <item value={item.key} />}
56
56
  />,
57
57
  );
@@ -64,7 +64,7 @@ describe('VirtualizedSectionList', () => {
64
64
  sections={[{title: 's1', data: [{key: 'hello'}]}]}
65
65
  ListEmptyComponent={() => <empty />}
66
66
  getItem={(data, key) => data[key]}
67
- getItemCount={(data) => data.length}
67
+ getItemCount={data => data.length}
68
68
  renderItem={({item}) => <item value={item.key} />}
69
69
  />,
70
70
  );
@@ -85,7 +85,7 @@ describe('VirtualizedSectionList', () => {
85
85
  },
86
86
  ]}
87
87
  getItem={(data, key) => data[key]}
88
- getItemCount={(data) => data.length}
88
+ getItemCount={data => data.length}
89
89
  getItemLayout={({index}) => ({
90
90
  index: -1,
91
91
  length: 50,
@@ -107,16 +107,16 @@ describe('VirtualizedSectionList', () => {
107
107
  ReactTestRenderer.act(() => {
108
108
  component = ReactTestRenderer.create(
109
109
  <VirtualizedSectionList
110
- ItemSeparatorComponent={(props) => <separator {...props} />}
110
+ ItemSeparatorComponent={props => <separator {...props} />}
111
111
  sections={[
112
112
  {title: 's0', data: [{key: 'i0'}, {key: 'i1'}, {key: 'i2'}]},
113
113
  ]}
114
- renderItem={(info) => {
114
+ renderItem={info => {
115
115
  infos.push(info);
116
116
  return <item title={info.item.key} />;
117
117
  }}
118
118
  getItem={(data, key) => data[key]}
119
- getItemCount={(data) => data.length}
119
+ getItemCount={data => data.length}
120
120
  />,
121
121
  );
122
122
  });
@@ -140,7 +140,7 @@ describe('VirtualizedSectionList', () => {
140
140
  const component = ReactTestRenderer.create(
141
141
  <VirtualizedSectionList
142
142
  sections={[{title: 'outer', data: [{key: 'outer0'}, {key: 'outer1'}]}]}
143
- renderItem={(outerInfo) => (
143
+ renderItem={outerInfo => (
144
144
  <VirtualizedSectionList
145
145
  sections={[
146
146
  {
@@ -152,15 +152,15 @@ describe('VirtualizedSectionList', () => {
152
152
  },
153
153
  ]}
154
154
  horizontal={outerInfo.item.key === 'outer1'}
155
- renderItem={(innerInfo) => {
155
+ renderItem={innerInfo => {
156
156
  return <item title={innerInfo.item.key} />;
157
157
  }}
158
158
  getItem={(data, key) => data[key]}
159
- getItemCount={(data) => data.length}
159
+ getItemCount={data => data.length}
160
160
  />
161
161
  )}
162
162
  getItem={(data, key) => data[key]}
163
- getItemCount={(data) => data.length}
163
+ getItemCount={data => data.length}
164
164
  />,
165
165
  );
166
166
  expect(component).toMatchSnapshot();
@@ -169,7 +169,9 @@ describe('VirtualizedSectionList', () => {
169
169
  describe('scrollToLocation', () => {
170
170
  const ITEM_HEIGHT = 100;
171
171
 
172
- const createVirtualizedSectionList = (props) => {
172
+ const createVirtualizedSectionList = (
173
+ props: void | $TEMPORARY$object<{stickySectionHeadersEnabled: boolean}>,
174
+ ) => {
173
175
  const component = ReactTestRenderer.create(
174
176
  <VirtualizedSectionList
175
177
  sections={[
@@ -178,7 +180,7 @@ describe('VirtualizedSectionList', () => {
178
180
  ]}
179
181
  renderItem={({item}) => <item value={item.key} />}
180
182
  getItem={(data, key) => data[key]}
181
- getItemCount={(data) => data.length}
183
+ getItemCount={data => data.length}
182
184
  getItemLayout={(data, index) => ({
183
185
  length: ITEM_HEIGHT,
184
186
  offset: ITEM_HEIGHT * index,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -156,7 +156,7 @@ function appendNewLog(newLog) {
156
156
  // sybolication for up to a second before adding the log.
157
157
  const OPTIMISTIC_WAIT_TIME = 1000;
158
158
 
159
- let addPendingLog = () => {
159
+ let addPendingLog: ?() => void = () => {
160
160
  logs.add(newLog);
161
161
  if (_selectedIndex < 0) {
162
162
  setSelectedLog(logs.size - 1);
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -75,24 +75,6 @@ if (__DEV__) {
75
75
  consoleErrorImpl = registerError;
76
76
  consoleWarnImpl = registerWarning;
77
77
 
78
- if ((console: any).disableYellowBox === true) {
79
- LogBoxData.setDisabled(true);
80
- console.warn(
81
- 'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
82
- );
83
- }
84
-
85
- (Object.defineProperty: any)(console, 'disableYellowBox', {
86
- configurable: true,
87
- get: () => LogBoxData.isDisabled(),
88
- set: value => {
89
- LogBoxData.setDisabled(value);
90
- console.warn(
91
- 'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
92
- );
93
- },
94
- });
95
-
96
78
  if (Platform.isTesting) {
97
79
  LogBoxData.setDisabled(true);
98
80
  }
@@ -115,7 +97,6 @@ if (__DEV__) {
115
97
  // After uninstalling: original > LogBox (noop) > OtherErrorHandler
116
98
  consoleErrorImpl = originalConsoleError;
117
99
  consoleWarnImpl = originalConsoleWarn;
118
- delete (console: any).disableLogBox;
119
100
  },
120
101
 
121
102
  isInstalled(): boolean {
@@ -153,7 +134,7 @@ if (__DEV__) {
153
134
  return typeof args[0] === 'string' && args[0].startsWith('(ADVICE)');
154
135
  };
155
136
 
156
- const isWarningModuleWarning = (...args: any) => {
137
+ const isWarningModuleWarning = (...args: Array<mixed>) => {
157
138
  return typeof args[0] === 'string' && args[0].startsWith('Warning: ');
158
139
  };
159
140
 
@@ -69,6 +69,7 @@ function FooterButton(props: ButtonProps): React.Node {
69
69
  const buttonStyles = StyleSheet.create({
70
70
  safeArea: {
71
71
  flex: 1,
72
+ // $FlowFixMe[sketchy-null-bool]
72
73
  paddingBottom: DeviceInfo.getConstants().isIPhoneX_deprecated ? 30 : 0,
73
74
  },
74
75
  content: {
@@ -18,6 +18,7 @@ import StatusBar from '../../Components/StatusBar/StatusBar';
18
18
  import LogBoxButton from './LogBoxButton';
19
19
  import * as LogBoxStyle from './LogBoxStyle';
20
20
  import type {LogLevel} from '../Data/LogBoxLog';
21
+ import type {ImageSource} from '../../Image/ImageSource';
21
22
  type Props = $ReadOnly<{|
22
23
  onSelectIndex: (selectedIndex: number) => void,
23
24
  selectedIndex: number,
@@ -91,7 +92,7 @@ const backgroundForLevel = (level: LogLevel) =>
91
92
  function LogBoxInspectorHeaderButton(
92
93
  props: $ReadOnly<{|
93
94
  disabled: boolean,
94
- image: number,
95
+ image: ImageSource,
95
96
  level: LogLevel,
96
97
  onPress?: ?() => void,
97
98
  |}>,