@tamagui/react-native-web-lite 1.125.6 → 1.125.7

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 (273) hide show
  1. package/dist/esm/AccessibilityInfo/index.native.js +58 -62
  2. package/dist/esm/AccessibilityInfo/index.native.js.map +1 -6
  3. package/dist/esm/ActivityIndicator/__tests__/index-test.native.js +85 -55
  4. package/dist/esm/ActivityIndicator/__tests__/index-test.native.js.map +1 -6
  5. package/dist/esm/ActivityIndicator/index.native.js +82 -90
  6. package/dist/esm/ActivityIndicator/index.native.js.map +1 -6
  7. package/dist/esm/Alert/index.native.js +14 -18
  8. package/dist/esm/Alert/index.native.js.map +1 -6
  9. package/dist/esm/AppRegistry/AppContainer.native.js +30 -26
  10. package/dist/esm/AppRegistry/AppContainer.native.js.map +1 -6
  11. package/dist/esm/AppRegistry/__tests__/index-test.native.js +13 -13
  12. package/dist/esm/AppRegistry/__tests__/index-test.native.js.map +1 -6
  13. package/dist/esm/AppRegistry/__tests__/index-test.node.native.js +45 -34
  14. package/dist/esm/AppRegistry/__tests__/index-test.node.native.js.map +1 -6
  15. package/dist/esm/AppRegistry/index.native.js +50 -55
  16. package/dist/esm/AppRegistry/index.native.js.map +1 -6
  17. package/dist/esm/AppRegistry/renderApplication.native.js +33 -27
  18. package/dist/esm/AppRegistry/renderApplication.native.js.map +1 -6
  19. package/dist/esm/AppState/__tests__/index-test.native.js +9 -10
  20. package/dist/esm/AppState/__tests__/index-test.native.js.map +1 -6
  21. package/dist/esm/AppState/index.native.js +45 -51
  22. package/dist/esm/AppState/index.native.js.map +1 -6
  23. package/dist/esm/Appearance/index.native.js +27 -24
  24. package/dist/esm/Appearance/index.native.js.map +1 -6
  25. package/dist/esm/BackHandler/index.native.js +11 -13
  26. package/dist/esm/BackHandler/index.native.js.map +1 -6
  27. package/dist/esm/Batchinator/index.native.js +19 -23
  28. package/dist/esm/Batchinator/index.native.js.map +1 -6
  29. package/dist/esm/Clipboard/index.native.js +21 -26
  30. package/dist/esm/Clipboard/index.native.js.map +1 -6
  31. package/dist/esm/DeviceEmitter.native.js +3 -5
  32. package/dist/esm/DeviceEmitter.native.js.map +1 -6
  33. package/dist/esm/DeviceInfo/index.native.js +41 -33
  34. package/dist/esm/DeviceInfo/index.native.js.map +1 -6
  35. package/dist/esm/Dimensions/__tests__/index-test.native.js +9 -8
  36. package/dist/esm/Dimensions/__tests__/index-test.native.js.map +1 -6
  37. package/dist/esm/Dimensions/index.native.js +49 -53
  38. package/dist/esm/Dimensions/index.native.js.map +1 -6
  39. package/dist/esm/FlatList.native.js +137 -131
  40. package/dist/esm/FlatList.native.js.map +1 -6
  41. package/dist/esm/I18nManager/index.native.js +10 -13
  42. package/dist/esm/I18nManager/index.native.js.map +1 -6
  43. package/dist/esm/Image/index.native.js +174 -149
  44. package/dist/esm/Image/index.native.js.map +1 -6
  45. package/dist/esm/Image/types.native.js +2 -1
  46. package/dist/esm/Image/types.native.js.map +1 -6
  47. package/dist/esm/ImageBackground/__tests__/index-test.native.js +27 -19
  48. package/dist/esm/ImageBackground/__tests__/index-test.native.js.map +1 -6
  49. package/dist/esm/ImageBackground/index.native.js +35 -33
  50. package/dist/esm/ImageBackground/index.native.js.map +1 -6
  51. package/dist/esm/InteractionManager/TaskQueue.native.js +46 -51
  52. package/dist/esm/InteractionManager/TaskQueue.native.js.map +1 -6
  53. package/dist/esm/InteractionManager/index.native.js +66 -60
  54. package/dist/esm/InteractionManager/index.native.js.map +1 -6
  55. package/dist/esm/Keyboard/index.native.js +13 -17
  56. package/dist/esm/Keyboard/index.native.js.map +1 -6
  57. package/dist/esm/KeyboardAvoidingView/index.native.js +34 -44
  58. package/dist/esm/KeyboardAvoidingView/index.native.js.map +1 -6
  59. package/dist/esm/Linking/__tests__/index-test.native.js +9 -9
  60. package/dist/esm/Linking/__tests__/index-test.native.js.map +1 -6
  61. package/dist/esm/Linking/index.native.js +42 -49
  62. package/dist/esm/Linking/index.native.js.map +1 -6
  63. package/dist/esm/LogBox/index.native.js +7 -12
  64. package/dist/esm/LogBox/index.native.js.map +1 -6
  65. package/dist/esm/Modal/ModalAnimation.native.js +89 -112
  66. package/dist/esm/Modal/ModalAnimation.native.js.map +1 -6
  67. package/dist/esm/Modal/ModalContent.native.js +52 -54
  68. package/dist/esm/Modal/ModalContent.native.js.map +1 -6
  69. package/dist/esm/Modal/ModalFocusTrap.native.js +49 -52
  70. package/dist/esm/Modal/ModalFocusTrap.native.js.map +1 -6
  71. package/dist/esm/Modal/ModalPortal.native.js +9 -11
  72. package/dist/esm/Modal/ModalPortal.native.js.map +1 -6
  73. package/dist/esm/Modal/index.native.js +53 -45
  74. package/dist/esm/Modal/index.native.js.map +1 -6
  75. package/dist/esm/NativeModules/index.native.js +5 -6
  76. package/dist/esm/NativeModules/index.native.js.map +1 -6
  77. package/dist/esm/PanResponder/Alternative.js +157 -122
  78. package/dist/esm/PanResponder/Alternative.js.map +1 -6
  79. package/dist/esm/PanResponder/index.native.js +3 -5
  80. package/dist/esm/PanResponder/index.native.js.map +1 -6
  81. package/dist/esm/PixelRatio/index.native.js +48 -59
  82. package/dist/esm/PixelRatio/index.native.js.map +1 -6
  83. package/dist/esm/Pressable/index.native.js +70 -67
  84. package/dist/esm/Pressable/index.native.js.map +1 -6
  85. package/dist/esm/RefreshControl/index.native.js +4 -6
  86. package/dist/esm/RefreshControl/index.native.js.map +1 -6
  87. package/dist/esm/SafeAreaView/index.native.js +24 -21
  88. package/dist/esm/SafeAreaView/index.native.js.map +1 -6
  89. package/dist/esm/ScrollView/ScrollViewBase.native.js +61 -50
  90. package/dist/esm/ScrollView/ScrollViewBase.native.js.map +1 -6
  91. package/dist/esm/ScrollView/index.native.js +183 -211
  92. package/dist/esm/ScrollView/index.native.js.map +1 -6
  93. package/dist/esm/Share/index.native.js +29 -36
  94. package/dist/esm/Share/index.native.js.map +1 -6
  95. package/dist/esm/StatusBar/index.native.js +3 -6
  96. package/dist/esm/StatusBar/index.native.js.map +1 -6
  97. package/dist/esm/Text/index.native.js +128 -100
  98. package/dist/esm/Text/index.native.js.map +1 -6
  99. package/dist/esm/Text/types.native.js +2 -1
  100. package/dist/esm/Text/types.native.js.map +1 -6
  101. package/dist/esm/TextInput/__tests__/index-test.native.js +445 -259
  102. package/dist/esm/TextInput/__tests__/index-test.native.js.map +1 -6
  103. package/dist/esm/TextInput/index.native.js +210 -147
  104. package/dist/esm/TextInput/index.native.js.map +1 -6
  105. package/dist/esm/TextInput/types.native.js +2 -1
  106. package/dist/esm/TextInput/types.native.js.map +1 -6
  107. package/dist/esm/TouchableOpacity.native.js +63 -67
  108. package/dist/esm/TouchableOpacity.native.js.map +1 -6
  109. package/dist/esm/TouchableWithoutFeedback.native.js +49 -45
  110. package/dist/esm/TouchableWithoutFeedback.native.js.map +1 -6
  111. package/dist/esm/UnimplementedView.native.js +22 -30
  112. package/dist/esm/UnimplementedView.native.js.map +1 -6
  113. package/dist/esm/Vibration/index.native.js +14 -14
  114. package/dist/esm/Vibration/index.native.js.map +1 -6
  115. package/dist/esm/View/index.native.js +84 -55
  116. package/dist/esm/View/index.native.js.map +1 -6
  117. package/dist/esm/View/types.native.js +2 -1
  118. package/dist/esm/View/types.native.js.map +1 -6
  119. package/dist/esm/createElement/__tests__/index-test.native.js +398 -195
  120. package/dist/esm/createElement/__tests__/index-test.native.js.map +1 -6
  121. package/dist/esm/createElement/index.native.js +18 -16
  122. package/dist/esm/createElement/index.native.js.map +1 -6
  123. package/dist/esm/createReactDOMStyle.native.js +2 -4
  124. package/dist/esm/createReactDOMStyle.native.js.map +1 -6
  125. package/dist/esm/index.native.js +47 -123
  126. package/dist/esm/index.native.js.map +1 -6
  127. package/dist/esm/render/index.native.js +6 -15
  128. package/dist/esm/render/index.native.js.map +1 -6
  129. package/dist/esm/styleTypes.native.js +2 -1
  130. package/dist/esm/styleTypes.native.js.map +1 -6
  131. package/dist/esm/types.native.js +2 -1
  132. package/dist/esm/types.native.js.map +1 -6
  133. package/dist/esm/useColorScheme/index.native.js +7 -7
  134. package/dist/esm/useColorScheme/index.native.js.map +1 -6
  135. package/dist/esm/useLocaleContext/index.native.js +2 -4
  136. package/dist/esm/useLocaleContext/index.native.js.map +1 -6
  137. package/dist/esm/useWindowDimensions/index.native.js +9 -9
  138. package/dist/esm/useWindowDimensions/index.native.js.map +1 -6
  139. package/dist/esm/vendor/react-native/Animated/Animated.native.js +16 -17
  140. package/dist/esm/vendor/react-native/Animated/Animated.native.js.map +1 -6
  141. package/dist/esm/vendor/react-native/Animated/AnimatedEvent.native.js +72 -99
  142. package/dist/esm/vendor/react-native/Animated/AnimatedEvent.native.js.map +1 -6
  143. package/dist/esm/vendor/react-native/Animated/AnimatedImplementation.native.js +465 -436
  144. package/dist/esm/vendor/react-native/Animated/AnimatedImplementation.native.js.map +1 -6
  145. package/dist/esm/vendor/react-native/Animated/AnimatedMock.native.js +97 -91
  146. package/dist/esm/vendor/react-native/Animated/AnimatedMock.native.js.map +1 -6
  147. package/dist/esm/vendor/react-native/Animated/AnimatedPlatformConfig.native.js +2 -1
  148. package/dist/esm/vendor/react-native/Animated/AnimatedPlatformConfig.native.js.map +1 -6
  149. package/dist/esm/vendor/react-native/Animated/Easing.native.js +194 -231
  150. package/dist/esm/vendor/react-native/Animated/Easing.native.js.map +1 -6
  151. package/dist/esm/vendor/react-native/Animated/NativeAnimatedHelper.native.js +206 -222
  152. package/dist/esm/vendor/react-native/Animated/NativeAnimatedHelper.native.js.map +1 -6
  153. package/dist/esm/vendor/react-native/Animated/NativeAnimatedModule.native.js +3 -5
  154. package/dist/esm/vendor/react-native/Animated/NativeAnimatedModule.native.js.map +1 -6
  155. package/dist/esm/vendor/react-native/Animated/NativeAnimatedTurboModule.native.js +3 -5
  156. package/dist/esm/vendor/react-native/Animated/NativeAnimatedTurboModule.native.js.map +1 -6
  157. package/dist/esm/vendor/react-native/Animated/SpringConfig.native.js +5 -5
  158. package/dist/esm/vendor/react-native/Animated/SpringConfig.native.js.map +1 -6
  159. package/dist/esm/vendor/react-native/Animated/animations/Animation.native.js +25 -37
  160. package/dist/esm/vendor/react-native/Animated/animations/Animation.native.js.map +1 -6
  161. package/dist/esm/vendor/react-native/Animated/animations/DecayAnimation.native.js +42 -54
  162. package/dist/esm/vendor/react-native/Animated/animations/DecayAnimation.native.js.map +1 -6
  163. package/dist/esm/vendor/react-native/Animated/animations/SpringAnimation.native.js +72 -72
  164. package/dist/esm/vendor/react-native/Animated/animations/SpringAnimation.native.js.map +1 -6
  165. package/dist/esm/vendor/react-native/Animated/animations/TimingAnimation.native.js +45 -60
  166. package/dist/esm/vendor/react-native/Animated/animations/TimingAnimation.native.js.map +1 -6
  167. package/dist/esm/vendor/react-native/Animated/bezier.native.js +23 -20
  168. package/dist/esm/vendor/react-native/Animated/bezier.native.js.map +1 -6
  169. package/dist/esm/vendor/react-native/Animated/components/AnimatedImage.native.js +4 -6
  170. package/dist/esm/vendor/react-native/Animated/components/AnimatedImage.native.js.map +1 -6
  171. package/dist/esm/vendor/react-native/Animated/components/AnimatedScrollView.native.js +12 -13
  172. package/dist/esm/vendor/react-native/Animated/components/AnimatedScrollView.native.js.map +1 -6
  173. package/dist/esm/vendor/react-native/Animated/components/AnimatedText.native.js +4 -6
  174. package/dist/esm/vendor/react-native/Animated/components/AnimatedText.native.js.map +1 -6
  175. package/dist/esm/vendor/react-native/Animated/components/AnimatedView.native.js +4 -6
  176. package/dist/esm/vendor/react-native/Animated/components/AnimatedView.native.js.map +1 -6
  177. package/dist/esm/vendor/react-native/Animated/createAnimatedComponent.native.js +17 -11
  178. package/dist/esm/vendor/react-native/Animated/createAnimatedComponent.native.js.map +1 -6
  179. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedAddition.native.js +39 -55
  180. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedAddition.native.js.map +1 -6
  181. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedColor.native.js +180 -197
  182. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedColor.native.js.map +1 -6
  183. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDiffClamp.native.js +39 -51
  184. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDiffClamp.native.js.map +1 -6
  185. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDivision.native.js +42 -57
  186. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDivision.native.js.map +1 -6
  187. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedInterpolation.native.js +99 -116
  188. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedInterpolation.native.js.map +1 -6
  189. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedModulo.native.js +37 -50
  190. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedModulo.native.js.map +1 -6
  191. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedMultiplication.native.js +39 -55
  192. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedMultiplication.native.js.map +1 -6
  193. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedNode.native.js +61 -89
  194. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedNode.native.js.map +1 -6
  195. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedProps.native.js +52 -70
  196. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedProps.native.js.map +1 -6
  197. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedStyle.native.js +50 -68
  198. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedStyle.native.js.map +1 -6
  199. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedSubtraction.native.js +39 -55
  200. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedSubtraction.native.js.map +1 -6
  201. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTracking.native.js +41 -53
  202. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTracking.native.js.map +1 -6
  203. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTransform.native.js +44 -57
  204. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTransform.native.js.map +1 -6
  205. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValue.native.js +70 -99
  206. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValue.native.js.map +1 -6
  207. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValueXY.native.js +64 -82
  208. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValueXY.native.js.map +1 -6
  209. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedWithChildren.native.js +40 -53
  210. package/dist/esm/vendor/react-native/Animated/nodes/AnimatedWithChildren.native.js.map +1 -6
  211. package/dist/esm/vendor/react-native/Animated/useAnimatedProps.native.js +50 -58
  212. package/dist/esm/vendor/react-native/Animated/useAnimatedProps.native.js.map +1 -6
  213. package/dist/esm/vendor/react-native/FeatureFlags.native.js +8 -10
  214. package/dist/esm/vendor/react-native/FeatureFlags.native.js.map +1 -6
  215. package/dist/esm/vendor/react-native/FillRateHelper/index.native.js +58 -59
  216. package/dist/esm/vendor/react-native/FillRateHelper/index.native.js.map +1 -6
  217. package/dist/esm/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.native.js +3 -5
  218. package/dist/esm/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.native.js.map +1 -6
  219. package/dist/esm/vendor/react-native/NativeEventEmitter/index.native.js +46 -55
  220. package/dist/esm/vendor/react-native/NativeEventEmitter/index.native.js.map +1 -6
  221. package/dist/esm/vendor/react-native/PanResponder/index.native.js +224 -219
  222. package/dist/esm/vendor/react-native/PanResponder/index.native.js.map +1 -6
  223. package/dist/esm/vendor/react-native/TouchHistoryMath/index.native.js +58 -81
  224. package/dist/esm/vendor/react-native/TouchHistoryMath/index.native.js.map +1 -6
  225. package/dist/esm/vendor/react-native/TurboModule/RCTExport.native.js +2 -1
  226. package/dist/esm/vendor/react-native/TurboModule/RCTExport.native.js.map +1 -6
  227. package/dist/esm/vendor/react-native/TurboModule/TurboModuleRegistry.native.js +2 -5
  228. package/dist/esm/vendor/react-native/TurboModule/TurboModuleRegistry.native.js.map +1 -6
  229. package/dist/esm/vendor/react-native/Types/CoreEventTypes.native.js +2 -1
  230. package/dist/esm/vendor/react-native/Types/CoreEventTypes.native.js.map +1 -6
  231. package/dist/esm/vendor/react-native/Utilities/clamp.native.js +2 -4
  232. package/dist/esm/vendor/react-native/Utilities/clamp.native.js.map +1 -6
  233. package/dist/esm/vendor/react-native/Utilities/setAndForwardRef.native.js +5 -6
  234. package/dist/esm/vendor/react-native/Utilities/setAndForwardRef.native.js.map +1 -6
  235. package/dist/esm/vendor/react-native/ViewabilityHelper.native.js +127 -129
  236. package/dist/esm/vendor/react-native/ViewabilityHelper.native.js.map +1 -6
  237. package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js +51 -50
  238. package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js.map +1 -6
  239. package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js +60 -73
  240. package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +1 -6
  241. package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js +96 -96
  242. package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +1 -6
  243. package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +57 -64
  244. package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +1 -6
  245. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +105 -117
  246. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +1 -6
  247. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +35 -37
  248. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +1 -6
  249. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +2 -1
  250. package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +1 -6
  251. package/dist/esm/vendor/react-native/VirtualizedList/index.native.js +817 -760
  252. package/dist/esm/vendor/react-native/VirtualizedList/index.native.js.map +1 -6
  253. package/dist/esm/vendor/react-native/deepDiffer/index.native.js +17 -29
  254. package/dist/esm/vendor/react-native/deepDiffer/index.native.js.map +1 -6
  255. package/dist/esm/vendor/react-native/emitter/EventEmitter.native.js +3 -5
  256. package/dist/esm/vendor/react-native/emitter/EventEmitter.native.js.map +1 -6
  257. package/dist/esm/vendor/react-native/emitter/EventSubscription.native.js +2 -1
  258. package/dist/esm/vendor/react-native/emitter/EventSubscription.native.js.map +1 -6
  259. package/dist/esm/vendor/react-native/emitter/_EmitterSubscription.native.js +24 -33
  260. package/dist/esm/vendor/react-native/emitter/_EmitterSubscription.native.js.map +1 -6
  261. package/dist/esm/vendor/react-native/emitter/_EventEmitter.native.js +41 -51
  262. package/dist/esm/vendor/react-native/emitter/_EventEmitter.native.js.map +1 -6
  263. package/dist/esm/vendor/react-native/emitter/_EventSubscription.native.js +12 -16
  264. package/dist/esm/vendor/react-native/emitter/_EventSubscription.native.js.map +1 -6
  265. package/dist/esm/vendor/react-native/emitter/_EventSubscriptionVendor.native.js +21 -26
  266. package/dist/esm/vendor/react-native/emitter/_EventSubscriptionVendor.native.js.map +1 -6
  267. package/dist/esm/vendor/react-native/infoLog/index.native.js +3 -6
  268. package/dist/esm/vendor/react-native/infoLog/index.native.js.map +1 -6
  269. package/dist/esm/vendor/react-native/useRefEffect.native.js +4 -8
  270. package/dist/esm/vendor/react-native/useRefEffect.native.js.map +1 -6
  271. package/dist/esm/without-animated.native.js +51 -112
  272. package/dist/esm/without-animated.native.js.map +1 -6
  273. package/package.json +6 -6
@@ -1,30 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { invariant, StyleSheet } from "@tamagui/react-native-web-internals";
3
- import ViewabilityHelper from "../ViewabilityHelper";
4
- import { CellRenderMask } from "./CellRenderMask";
5
- import StateSafePureComponent from "./StateSafePureComponent";
6
- import { VirtualizedListCellContextProvider, VirtualizedListContext, VirtualizedListContextProvider } from "./VirtualizedListContext";
7
- import ScrollView from "../../../ScrollView/ScrollViewBase";
3
+ import ViewabilityHelper from "../ViewabilityHelper.native.js";
4
+ import { CellRenderMask } from "./CellRenderMask.native.js";
5
+ import StateSafePureComponent from "./StateSafePureComponent.native.js";
6
+ import { VirtualizedListCellContextProvider, VirtualizedListContext, VirtualizedListContextProvider } from "./VirtualizedListContext.native.js";
7
+ import ScrollView from "../../../ScrollView/ScrollViewBase.native.js";
8
8
  import View from "../../../View";
9
- import CellRenderer from "./VirtualizedListCellRenderer";
9
+ import CellRenderer from "./VirtualizedListCellRenderer.native.js";
10
10
  import FillRateHelper from "../FillRateHelper";
11
- import ChildListCollection from "./ChildListCollection";
11
+ import ChildListCollection from "./ChildListCollection.native.js";
12
12
  import React from "react";
13
- import clamp from "../Utilities/clamp";
13
+ import clamp from "../Utilities/clamp.native.js";
14
14
  import { keyExtractor as defaultKeyExtractor } from "../VirtualizeUtils";
15
15
  import Batchinator from "../../../Batchinator";
16
16
  import RefreshControl from "../../../RefreshControl";
17
17
  function _assert_this_initialized(self) {
18
- if (self === void 0)
19
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
20
19
  return self;
21
20
  }
22
21
  function _call_super(_this, derived, args) {
23
22
  return derived = _get_prototype_of(derived), _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
24
23
  }
25
24
  function _class_call_check(instance, Constructor) {
26
- if (!(instance instanceof Constructor))
27
- throw new TypeError("Cannot call a class as a function");
25
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
28
26
  }
29
27
  function _defineProperties(target, props) {
30
28
  for (var i = 0; i < props.length; i++) {
@@ -44,13 +42,12 @@ function _define_property(obj, key, value) {
44
42
  }) : obj[key] = value, obj;
45
43
  }
46
44
  function _get_prototype_of(o) {
47
- return _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function(o2) {
45
+ return _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function (o2) {
48
46
  return o2.__proto__ || Object.getPrototypeOf(o2);
49
47
  }, _get_prototype_of(o);
50
48
  }
51
49
  function _inherits(subClass, superClass) {
52
- if (typeof superClass != "function" && superClass !== null)
53
- throw new TypeError("Super expression must either be null or a function");
50
+ if (typeof superClass != "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function");
54
51
  subClass.prototype = Object.create(superClass && superClass.prototype, {
55
52
  constructor: {
56
53
  value: subClass,
@@ -63,25 +60,27 @@ function _possible_constructor_return(self, call) {
63
60
  return call && (_type_of(call) === "object" || typeof call == "function") ? call : _assert_this_initialized(self);
64
61
  }
65
62
  function _set_prototype_of(o, p) {
66
- return _set_prototype_of = Object.setPrototypeOf || function(o2, p2) {
63
+ return _set_prototype_of = Object.setPrototypeOf || function (o2, p2) {
67
64
  return o2.__proto__ = p2, o2;
68
65
  }, _set_prototype_of(o, p);
69
66
  }
70
67
  function _type_of(obj) {
71
68
  "@swc/helpers - typeof";
69
+
72
70
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
73
71
  }
74
72
  function _is_native_reflect_construct() {
75
73
  try {
76
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
77
- }));
78
- } catch {
79
- }
80
- return (_is_native_reflect_construct = function() {
74
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
75
+ } catch {}
76
+ return (_is_native_reflect_construct = function () {
81
77
  return !!result;
82
78
  })();
83
79
  }
84
- var __DEV__ = process.env.NODE_ENV !== "production", ON_EDGE_REACHED_EPSILON = 1e-3, _usedIndexForKey = !1, _keylessItemComponentName = "";
80
+ var __DEV__ = process.env.NODE_ENV !== "production",
81
+ ON_EDGE_REACHED_EPSILON = 1e-3,
82
+ _usedIndexForKey = !1,
83
+ _keylessItemComponentName = "";
85
84
  function horizontalOrDefault(horizontal) {
86
85
  return horizontal ?? !1;
87
86
  }
@@ -107,35 +106,32 @@ function windowSizeOrDefault(windowSize) {
107
106
  return windowSize ?? 21;
108
107
  }
109
108
  function findLastWhere(arr, predicate) {
110
- for (var i = arr.length - 1; i >= 0; i--)
111
- if (predicate(arr[i]))
112
- return arr[i];
109
+ for (var i = arr.length - 1; i >= 0; i--) if (predicate(arr[i])) return arr[i];
113
110
  return null;
114
111
  }
115
- var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
112
+ var VirtualizedList = /* @__PURE__ */function (StateSafePureComponent2) {
116
113
  "use strict";
114
+
117
115
  _inherits(VirtualizedList2, StateSafePureComponent2);
118
116
  function VirtualizedList2(props) {
119
117
  _class_call_check(this, VirtualizedList2);
120
118
  var _this;
121
- _this = _call_super(this, VirtualizedList2, [
122
- props
123
- ]), _define_property(_this, "_getScrollMetrics", function() {
119
+ _this = _call_super(this, VirtualizedList2, [props]), _define_property(_this, "_getScrollMetrics", function () {
124
120
  return _this._scrollMetrics;
125
- }), _define_property(_this, "_getOutermostParentListRef", function() {
121
+ }), _define_property(_this, "_getOutermostParentListRef", function () {
126
122
  return _this._isNestedWithSameOrientation() ? _this.context.getOutermostParentListRef() : _this;
127
- }), _define_property(_this, "_registerAsNestedChild", function(childList) {
123
+ }), _define_property(_this, "_registerAsNestedChild", function (childList) {
128
124
  _this._nestedChildLists.add(childList.ref, childList.cellKey), _this._hasInteracted && childList.ref.recordInteraction();
129
- }), _define_property(_this, "_unregisterAsNestedChild", function(childList) {
125
+ }), _define_property(_this, "_unregisterAsNestedChild", function (childList) {
130
126
  _this._nestedChildLists.remove(childList.ref);
131
- }), _define_property(_this, "invertedWheelEventHandler", void 0), _define_property(_this, "_onUpdateSeparators", function(keys, newProps) {
132
- keys.forEach(function(key) {
127
+ }), _define_property(_this, "invertedWheelEventHandler", void 0), _define_property(_this, "_onUpdateSeparators", function (keys, newProps) {
128
+ keys.forEach(function (key) {
133
129
  var ref = key != null && _this._cellRefs[key];
134
130
  ref && ref.updateSeparatorProps(newProps);
135
131
  });
136
- }), _define_property(_this, "_getSpacerKey", function(isVertical) {
132
+ }), _define_property(_this, "_getSpacerKey", function (isVertical) {
137
133
  return isVertical ? "height" : "width";
138
- }), _define_property(_this, "_averageCellLength", 0), _define_property(_this, "_cellRefs", {}), _define_property(_this, "_fillRateHelper", void 0), _define_property(_this, "_frames", {}), _define_property(_this, "_footerLength", 0), _define_property(_this, "_hasTriggeredInitialScrollToIndex", !1), _define_property(_this, "_hasInteracted", !1), _define_property(_this, "_hasMore", !1), _define_property(_this, "_hasWarned", {}), _define_property(_this, "_headerLength", 0), _define_property(_this, "_hiPriInProgress", !1), _define_property(_this, "_highestMeasuredFrameIndex", 0), _define_property(_this, "_indicesToKeys", /* @__PURE__ */ new Map()), _define_property(_this, "_lastFocusedCellKey", null), _define_property(_this, "_nestedChildLists", new ChildListCollection()), _define_property(_this, "_offsetFromParentVirtualizedList", 0), _define_property(_this, "_prevParentOffset", 0), _define_property(_this, "_scrollMetrics", {
134
+ }), _define_property(_this, "_averageCellLength", 0), _define_property(_this, "_cellRefs", {}), _define_property(_this, "_fillRateHelper", void 0), _define_property(_this, "_frames", {}), _define_property(_this, "_footerLength", 0), _define_property(_this, "_hasTriggeredInitialScrollToIndex", !1), _define_property(_this, "_hasInteracted", !1), _define_property(_this, "_hasMore", !1), _define_property(_this, "_hasWarned", {}), _define_property(_this, "_headerLength", 0), _define_property(_this, "_hiPriInProgress", !1), _define_property(_this, "_highestMeasuredFrameIndex", 0), _define_property(_this, "_indicesToKeys", /* @__PURE__ */new Map()), _define_property(_this, "_lastFocusedCellKey", null), _define_property(_this, "_nestedChildLists", new ChildListCollection()), _define_property(_this, "_offsetFromParentVirtualizedList", 0), _define_property(_this, "_prevParentOffset", 0), _define_property(_this, "_scrollMetrics", {
139
135
  contentLength: 0,
140
136
  dOffset: 0,
141
137
  dt: 10,
@@ -144,56 +140,54 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
144
140
  velocity: 0,
145
141
  visibleLength: 0,
146
142
  zoomScale: 1
147
- }), _define_property(_this, "_scrollRef", null), _define_property(_this, "_sentStartForContentLength", 0), _define_property(_this, "_sentEndForContentLength", 0), _define_property(_this, "_totalCellLength", 0), _define_property(_this, "_totalCellsMeasured", 0), _define_property(_this, "_updateCellsToRenderBatcher", void 0), _define_property(_this, "_viewabilityTuples", []), _define_property(_this, "_captureScrollRef", function(ref) {
143
+ }), _define_property(_this, "_scrollRef", null), _define_property(_this, "_sentStartForContentLength", 0), _define_property(_this, "_sentEndForContentLength", 0), _define_property(_this, "_totalCellLength", 0), _define_property(_this, "_totalCellsMeasured", 0), _define_property(_this, "_updateCellsToRenderBatcher", void 0), _define_property(_this, "_viewabilityTuples", []), _define_property(_this, "_captureScrollRef", function (ref) {
148
144
  _this._scrollRef = ref;
149
- }), _define_property(_this, "_defaultRenderScrollComponent", function(props2) {
145
+ }), _define_property(_this, "_defaultRenderScrollComponent", function (props2) {
150
146
  var onRefresh = props2.onRefresh;
151
- if (_this._isNestedWithSameOrientation())
152
- return /* @__PURE__ */ _jsx(View, {
153
- ...props2
154
- });
147
+ if (_this._isNestedWithSameOrientation()) return /* @__PURE__ */_jsx(View, {
148
+ ...props2
149
+ });
155
150
  if (onRefresh) {
156
151
  var _props_refreshing;
157
- return invariant(typeof props2.refreshing == "boolean", "`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `" + JSON.stringify((_props_refreshing = props2.refreshing) !== null && _props_refreshing !== void 0 ? _props_refreshing : "undefined") + "`"), /* @__PURE__ */ _jsx(ScrollView, {
152
+ return invariant(typeof props2.refreshing == "boolean", "`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `" + JSON.stringify((_props_refreshing = props2.refreshing) !== null && _props_refreshing !== void 0 ? _props_refreshing : "undefined") + "`"), /* @__PURE__ */_jsx(ScrollView, {
158
153
  ...props2,
159
- refreshControl: props2.refreshControl == null ? /* @__PURE__ */ _jsx(RefreshControl, {
154
+ refreshControl: props2.refreshControl == null ? /* @__PURE__ */_jsx(RefreshControl, {
160
155
  refreshing: props2.refreshing,
161
156
  onRefresh,
162
157
  progressViewOffset: props2.progressViewOffset
163
158
  }) : props2.refreshControl
164
159
  });
165
- } else
166
- return /* @__PURE__ */ _jsx(ScrollView, {
167
- ...props2
168
- });
169
- }), _define_property(_this, "_onCellLayout", function(e, cellKey, index) {
170
- var layout = e.nativeEvent.layout, next = {
171
- offset: _this._selectOffset(layout),
172
- length: _this._selectLength(layout),
173
- index,
174
- inLayout: !0
175
- }, curr = _this._frames[cellKey];
160
+ } else return /* @__PURE__ */_jsx(ScrollView, {
161
+ ...props2
162
+ });
163
+ }), _define_property(_this, "_onCellLayout", function (e, cellKey, index) {
164
+ var layout = e.nativeEvent.layout,
165
+ next = {
166
+ offset: _this._selectOffset(layout),
167
+ length: _this._selectLength(layout),
168
+ index,
169
+ inLayout: !0
170
+ },
171
+ curr = _this._frames[cellKey];
176
172
  !curr || next.offset !== curr.offset || next.length !== curr.length || index !== curr.index ? (_this._totalCellLength += next.length - (curr ? curr.length : 0), _this._totalCellsMeasured += curr ? 0 : 1, _this._averageCellLength = _this._totalCellLength / _this._totalCellsMeasured, _this._frames[cellKey] = next, _this._highestMeasuredFrameIndex = Math.max(_this._highestMeasuredFrameIndex, index), _this._scheduleCellsToRenderUpdate()) : _this._frames[cellKey].inLayout = !0, _this._triggerRemeasureForChildListsInCell(cellKey), _this._computeBlankness(), _this._updateViewableItems(
177
- // @ts-ignore
178
- _this.props,
179
- _this.state.cellsAroundViewport
180
- );
181
- }), _define_property(_this, "_onCellUnmount", function(cellKey) {
173
+ // @ts-ignore
174
+ _this.props, _this.state.cellsAroundViewport);
175
+ }), _define_property(_this, "_onCellUnmount", function (cellKey) {
182
176
  delete _this._cellRefs[cellKey];
183
177
  var curr = _this._frames[cellKey];
184
178
  curr && (_this._frames[cellKey] = {
185
179
  ...curr,
186
180
  inLayout: !1
187
181
  });
188
- }), _define_property(_this, "_onLayout", function(e) {
182
+ }), _define_property(_this, "_onLayout", function (e) {
189
183
  _this._isNestedWithSameOrientation() ? _this.measureLayoutRelativeToContainingList() : _this._scrollMetrics.visibleLength = _this._selectLength(e.nativeEvent.layout), _this.props.onLayout && _this.props.onLayout(e), _this._scheduleCellsToRenderUpdate(), _this._maybeCallOnEdgeReached();
190
- }), _define_property(_this, "_onLayoutEmpty", function(e) {
184
+ }), _define_property(_this, "_onLayoutEmpty", function (e) {
191
185
  _this.props.onLayout && _this.props.onLayout(e);
192
- }), _define_property(_this, "_onLayoutFooter", function(e) {
186
+ }), _define_property(_this, "_onLayoutFooter", function (e) {
193
187
  _this._triggerRemeasureForChildListsInCell(_this._getFooterCellKey()), _this._footerLength = _this._selectLength(e.nativeEvent.layout);
194
- }), _define_property(_this, "_onLayoutHeader", function(e) {
188
+ }), _define_property(_this, "_onLayoutHeader", function (e) {
195
189
  _this._headerLength = _this._selectLength(e.nativeEvent.layout);
196
- }), _define_property(_this, "_onContentSizeChange", function(width, height) {
190
+ }), _define_property(_this, "_onContentSizeChange", function (width, height) {
197
191
  width > 0 && height > 0 && _this.props.initialScrollIndex != null && _this.props.initialScrollIndex > 0 && !_this._hasTriggeredInitialScrollToIndex && (_this.props.contentOffset == null && (_this.props.initialScrollIndex < _this.props.getItemCount(_this.props.data) ? _this.scrollToIndex({
198
192
  animated: !1,
199
193
  index: nullthrows(_this.props.initialScrollIndex)
@@ -203,28 +197,40 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
203
197
  height,
204
198
  width
205
199
  }), _this._scheduleCellsToRenderUpdate(), _this._maybeCallOnEdgeReached();
206
- }), _define_property(_this, "_convertParentScrollMetrics", function(metrics) {
207
- var offset = metrics.offset - _this._offsetFromParentVirtualizedList, visibleLength = metrics.visibleLength, dOffset = offset - _this._scrollMetrics.offset, contentLength = _this._scrollMetrics.contentLength;
200
+ }), _define_property(_this, "_convertParentScrollMetrics", function (metrics) {
201
+ var offset = metrics.offset - _this._offsetFromParentVirtualizedList,
202
+ visibleLength = metrics.visibleLength,
203
+ dOffset = offset - _this._scrollMetrics.offset,
204
+ contentLength = _this._scrollMetrics.contentLength;
208
205
  return {
209
206
  visibleLength,
210
207
  contentLength,
211
208
  offset,
212
209
  dOffset
213
210
  };
214
- }), _define_property(_this, "_onScroll", function(e) {
215
- _this._nestedChildLists.forEach(function(childList) {
211
+ }), _define_property(_this, "_onScroll", function (e) {
212
+ _this._nestedChildLists.forEach(function (childList) {
216
213
  childList._onScroll(e);
217
214
  }), _this.props.onScroll && _this.props.onScroll(e);
218
- var timestamp = e.timeStamp, visibleLength = _this._selectLength(e.nativeEvent.layoutMeasurement), contentLength = _this._selectLength(e.nativeEvent.contentSize), offset = _this._selectOffset(e.nativeEvent.contentOffset), dOffset = offset - _this._scrollMetrics.offset;
215
+ var timestamp = e.timeStamp,
216
+ visibleLength = _this._selectLength(e.nativeEvent.layoutMeasurement),
217
+ contentLength = _this._selectLength(e.nativeEvent.contentSize),
218
+ offset = _this._selectOffset(e.nativeEvent.contentOffset),
219
+ dOffset = offset - _this._scrollMetrics.offset;
219
220
  if (_this._isNestedWithSameOrientation()) {
220
- if (_this._scrollMetrics.contentLength === 0)
221
- return;
222
- ({ visibleLength, contentLength, offset, dOffset } = _this._convertParentScrollMetrics({
221
+ if (_this._scrollMetrics.contentLength === 0) return;
222
+ ({
223
+ visibleLength,
224
+ contentLength,
225
+ offset,
226
+ dOffset
227
+ } = _this._convertParentScrollMetrics({
223
228
  visibleLength,
224
229
  offset
225
230
  }));
226
231
  }
227
- var dt = _this._scrollMetrics.timestamp ? Math.max(1, timestamp - _this._scrollMetrics.timestamp) : 1, velocity = dOffset / dt;
232
+ var dt = _this._scrollMetrics.timestamp ? Math.max(1, timestamp - _this._scrollMetrics.timestamp) : 1,
233
+ velocity = dOffset / dt;
228
234
  dt > 500 && _this._scrollMetrics.dt > 500 && contentLength > 5 * visibleLength && !_this._hasWarned.perf && (infoLog("VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc.", {
229
235
  dt,
230
236
  prevDt: _this._scrollMetrics.dt,
@@ -241,88 +247,101 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
241
247
  visibleLength,
242
248
  zoomScale
243
249
  }, _this._updateViewableItems(_this.props, _this.state.cellsAroundViewport), _this.props && (_this._maybeCallOnEdgeReached(), velocity !== 0 && _this._fillRateHelper.activate(), _this._computeBlankness(), _this._scheduleCellsToRenderUpdate());
244
- }), _define_property(_this, "_onScrollBeginDrag", function(e) {
245
- _this._nestedChildLists.forEach(function(childList) {
250
+ }), _define_property(_this, "_onScrollBeginDrag", function (e) {
251
+ _this._nestedChildLists.forEach(function (childList) {
246
252
  childList._onScrollBeginDrag(e);
247
- }), _this._viewabilityTuples.forEach(function(tuple) {
253
+ }), _this._viewabilityTuples.forEach(function (tuple) {
248
254
  tuple.viewabilityHelper.recordInteraction();
249
255
  }), _this._hasInteracted = !0, _this.props.onScrollBeginDrag && _this.props.onScrollBeginDrag(e);
250
- }), _define_property(_this, "_onScrollEndDrag", function(e) {
251
- _this._nestedChildLists.forEach(function(childList) {
256
+ }), _define_property(_this, "_onScrollEndDrag", function (e) {
257
+ _this._nestedChildLists.forEach(function (childList) {
252
258
  childList._onScrollEndDrag(e);
253
259
  });
254
- var { velocity } = e.nativeEvent;
260
+ var {
261
+ velocity
262
+ } = e.nativeEvent;
255
263
  velocity && (_this._scrollMetrics.velocity = _this._selectOffset(velocity)), _this._computeBlankness(), _this.props.onScrollEndDrag && _this.props.onScrollEndDrag(e);
256
- }), _define_property(_this, "_onMomentumScrollBegin", function(e) {
257
- _this._nestedChildLists.forEach(function(childList) {
264
+ }), _define_property(_this, "_onMomentumScrollBegin", function (e) {
265
+ _this._nestedChildLists.forEach(function (childList) {
258
266
  childList._onMomentumScrollBegin(e);
259
267
  }), _this.props.onMomentumScrollBegin && _this.props.onMomentumScrollBegin(e);
260
- }), _define_property(_this, "_onMomentumScrollEnd", function(e) {
261
- _this._nestedChildLists.forEach(function(childList) {
268
+ }), _define_property(_this, "_onMomentumScrollEnd", function (e) {
269
+ _this._nestedChildLists.forEach(function (childList) {
262
270
  childList._onMomentumScrollEnd(e);
263
271
  }), _this._scrollMetrics.velocity = 0, _this._computeBlankness(), _this.props.onMomentumScrollEnd && _this.props.onMomentumScrollEnd(e);
264
- }), _define_property(_this, "_updateCellsToRender", function() {
265
- _this._updateViewableItems(_this.props, _this.state.cellsAroundViewport), _this.setState(function(state, props2) {
266
- var cellsAroundViewport = _this._adjustCellsAroundViewport(props2, state.cellsAroundViewport), renderMask = VirtualizedList2._createRenderMask(props2, cellsAroundViewport, _this._getNonViewportRenderRegions(props2));
272
+ }), _define_property(_this, "_updateCellsToRender", function () {
273
+ _this._updateViewableItems(_this.props, _this.state.cellsAroundViewport), _this.setState(function (state, props2) {
274
+ var cellsAroundViewport = _this._adjustCellsAroundViewport(props2, state.cellsAroundViewport),
275
+ renderMask = VirtualizedList2._createRenderMask(props2, cellsAroundViewport, _this._getNonViewportRenderRegions(props2));
267
276
  return cellsAroundViewport.first === state.cellsAroundViewport.first && cellsAroundViewport.last === state.cellsAroundViewport.last && renderMask.equals(state.renderMask) ? null : {
268
277
  cellsAroundViewport,
269
278
  renderMask
270
279
  };
271
280
  });
272
- }), _define_property(_this, "_createViewToken", function(index, isViewable, props2) {
273
- var { data, getItem } = props2, item = getItem(data, index);
281
+ }), _define_property(_this, "_createViewToken", function (index, isViewable, props2) {
282
+ var {
283
+ data,
284
+ getItem
285
+ } = props2,
286
+ item = getItem(data, index);
274
287
  return {
275
288
  index,
276
289
  item,
277
290
  key: _this._keyExtractor(item, index, props2),
278
291
  isViewable
279
292
  };
280
- }), _define_property(_this, "_getOffsetApprox", function(index, props2) {
281
- if (Number.isInteger(index))
282
- return _this.__getFrameMetricsApprox(index, props2).offset;
283
- var frameMetrics = _this.__getFrameMetricsApprox(Math.floor(index), props2), remainder = index - Math.floor(index);
293
+ }), _define_property(_this, "_getOffsetApprox", function (index, props2) {
294
+ if (Number.isInteger(index)) return _this.__getFrameMetricsApprox(index, props2).offset;
295
+ var frameMetrics = _this.__getFrameMetricsApprox(Math.floor(index), props2),
296
+ remainder = index - Math.floor(index);
284
297
  return frameMetrics.offset + remainder * frameMetrics.length;
285
- }), _define_property(_this, "__getFrameMetricsApprox", function(index, props2) {
298
+ }), _define_property(_this, "__getFrameMetricsApprox", function (index, props2) {
286
299
  var frame = _this._getFrameMetrics(index, props2);
287
- if (frame && frame.index === index)
288
- return frame;
289
- var { data, getItemCount, getItemLayout } = props2;
300
+ if (frame && frame.index === index) return frame;
301
+ var {
302
+ data,
303
+ getItemCount,
304
+ getItemLayout
305
+ } = props2;
290
306
  return invariant(index >= 0 && index < getItemCount(data), "Tried to get frame for out of range index " + index), invariant(!getItemLayout, "Should not have to estimate frames when a measurement metrics function is provided"), {
291
307
  length: _this._averageCellLength,
292
308
  offset: _this._averageCellLength * index
293
309
  };
294
- }), _define_property(_this, "_getFrameMetrics", function(index, props2) {
295
- var { data, getItem, getItemCount, getItemLayout } = props2;
310
+ }), _define_property(_this, "_getFrameMetrics", function (index, props2) {
311
+ var {
312
+ data,
313
+ getItem,
314
+ getItemCount,
315
+ getItemLayout
316
+ } = props2;
296
317
  invariant(index >= 0 && index < getItemCount(data), "Tried to get frame for out of range index " + index);
297
- var item = getItem(data, index), frame = _this._frames[_this._keyExtractor(item, index, props2)];
318
+ var item = getItem(data, index),
319
+ frame = _this._frames[_this._keyExtractor(item, index, props2)];
298
320
  return (!frame || frame.index !== index) && getItemLayout ? getItemLayout(data, index) : frame;
299
- }), _define_property(_this, "_getNonViewportRenderRegions", function(props2) {
300
- if (!(_this._lastFocusedCellKey && _this._cellRefs[_this._lastFocusedCellKey]))
301
- return [];
302
- var lastFocusedCellRenderer = _this._cellRefs[_this._lastFocusedCellKey], focusedCellIndex = lastFocusedCellRenderer.props.index, itemCount = props2.getItemCount(props2.data);
303
- if (focusedCellIndex >= itemCount || _this._keyExtractor(props2.getItem(props2.data, focusedCellIndex), focusedCellIndex, props2) !== _this._lastFocusedCellKey)
304
- return [];
305
- for (var first = focusedCellIndex, heightOfCellsBeforeFocused = 0, i = first - 1; i >= 0 && heightOfCellsBeforeFocused < _this._scrollMetrics.visibleLength; i--)
306
- first--, heightOfCellsBeforeFocused += _this.__getFrameMetricsApprox(i, props2).length;
307
- for (var last = focusedCellIndex, heightOfCellsAfterFocused = 0, i1 = last + 1; i1 < itemCount && heightOfCellsAfterFocused < _this._scrollMetrics.visibleLength; i1++)
308
- last++, heightOfCellsAfterFocused += _this.__getFrameMetricsApprox(i1, props2).length;
309
- return [
310
- {
311
- first,
312
- last
313
- }
314
- ];
321
+ }), _define_property(_this, "_getNonViewportRenderRegions", function (props2) {
322
+ if (!(_this._lastFocusedCellKey && _this._cellRefs[_this._lastFocusedCellKey])) return [];
323
+ var lastFocusedCellRenderer = _this._cellRefs[_this._lastFocusedCellKey],
324
+ focusedCellIndex = lastFocusedCellRenderer.props.index,
325
+ itemCount = props2.getItemCount(props2.data);
326
+ if (focusedCellIndex >= itemCount || _this._keyExtractor(props2.getItem(props2.data, focusedCellIndex), focusedCellIndex, props2) !== _this._lastFocusedCellKey) return [];
327
+ for (var first = focusedCellIndex, heightOfCellsBeforeFocused = 0, i = first - 1; i >= 0 && heightOfCellsBeforeFocused < _this._scrollMetrics.visibleLength; i--) first--, heightOfCellsBeforeFocused += _this.__getFrameMetricsApprox(i, props2).length;
328
+ for (var last = focusedCellIndex, heightOfCellsAfterFocused = 0, i1 = last + 1; i1 < itemCount && heightOfCellsAfterFocused < _this._scrollMetrics.visibleLength; i1++) last++, heightOfCellsAfterFocused += _this.__getFrameMetricsApprox(i1, props2).length;
329
+ return [{
330
+ first,
331
+ last
332
+ }];
315
333
  }), _this._checkProps(props), _this._fillRateHelper = new FillRateHelper(_this._getFrameMetrics);
316
334
  var _this_props_updateCellsBatchingPeriod;
317
- if (_this._updateCellsToRenderBatcher = new Batchinator(_this._updateCellsToRender, (_this_props_updateCellsBatchingPeriod = _this.props.updateCellsBatchingPeriod) !== null && _this_props_updateCellsBatchingPeriod !== void 0 ? _this_props_updateCellsBatchingPeriod : 50), _this.props.viewabilityConfigCallbackPairs)
318
- _this._viewabilityTuples = _this.props.viewabilityConfigCallbackPairs.map(function(pair) {
319
- return {
320
- viewabilityHelper: new ViewabilityHelper(pair.viewabilityConfig),
321
- onViewableItemsChanged: pair.onViewableItemsChanged
322
- };
323
- });
324
- else {
325
- var { onViewableItemsChanged, viewabilityConfig } = _this.props;
335
+ if (_this._updateCellsToRenderBatcher = new Batchinator(_this._updateCellsToRender, (_this_props_updateCellsBatchingPeriod = _this.props.updateCellsBatchingPeriod) !== null && _this_props_updateCellsBatchingPeriod !== void 0 ? _this_props_updateCellsBatchingPeriod : 50), _this.props.viewabilityConfigCallbackPairs) _this._viewabilityTuples = _this.props.viewabilityConfigCallbackPairs.map(function (pair) {
336
+ return {
337
+ viewabilityHelper: new ViewabilityHelper(pair.viewabilityConfig),
338
+ onViewableItemsChanged: pair.onViewableItemsChanged
339
+ };
340
+ });else {
341
+ var {
342
+ onViewableItemsChanged,
343
+ viewabilityConfig
344
+ } = _this.props;
326
345
  onViewableItemsChanged && _this._viewabilityTuples.push({
327
346
  viewabilityHelper: new ViewabilityHelper(viewabilityConfig),
328
347
  onViewableItemsChanged
@@ -332,8 +351,13 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
332
351
  return _this.state = {
333
352
  cellsAroundViewport: initialRenderRegion,
334
353
  renderMask: VirtualizedList2._createRenderMask(props, initialRenderRegion)
335
- }, _this.invertedWheelEventHandler = function(ev) {
336
- var scrollOffset = _this.props.horizontal ? ev.target.scrollLeft : ev.target.scrollTop, scrollLength = _this.props.horizontal ? ev.target.scrollWidth : ev.target.scrollHeight, clientLength = _this.props.horizontal ? ev.target.clientWidth : ev.target.clientHeight, isEventTargetScrollable = scrollLength > clientLength, delta = _this.props.horizontal ? ev.deltaX || ev.wheelDeltaX : ev.deltaY || ev.wheelDeltaY, leftoverDelta = delta;
354
+ }, _this.invertedWheelEventHandler = function (ev) {
355
+ var scrollOffset = _this.props.horizontal ? ev.target.scrollLeft : ev.target.scrollTop,
356
+ scrollLength = _this.props.horizontal ? ev.target.scrollWidth : ev.target.scrollHeight,
357
+ clientLength = _this.props.horizontal ? ev.target.clientWidth : ev.target.clientHeight,
358
+ isEventTargetScrollable = scrollLength > clientLength,
359
+ delta = _this.props.horizontal ? ev.deltaX || ev.wheelDeltaX : ev.deltaY || ev.wheelDeltaY,
360
+ leftoverDelta = delta;
337
361
  isEventTargetScrollable && (leftoverDelta = delta < 0 ? Math.min(delta + scrollOffset, 0) : Math.max(delta - (scrollLength - clientLength - scrollOffset), 0));
338
362
  var targetDelta = delta - leftoverDelta;
339
363
  if (_this.props.inverted && _this._scrollRef && _this._scrollRef.getScrollableNode) {
@@ -351,92 +375,15 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
351
375
  }
352
376
  }, _this;
353
377
  }
354
- return _create_class(VirtualizedList2, [
355
- {
356
- // scrollToEnd may be janky without getItemLayout prop
357
- key: "scrollToEnd",
358
- value: function(params) {
359
- var animated = params ? params.animated : !0, veryLast = this.props.getItemCount(this.props.data) - 1;
360
- if (!(veryLast < 0)) {
361
- var frame = this.__getFrameMetricsApprox(veryLast, this.props), offset = Math.max(0, frame.offset + frame.length + this._footerLength - this._scrollMetrics.visibleLength);
362
- if (this._scrollRef != null) {
363
- if (this._scrollRef.scrollTo == null) {
364
- console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
365
- return;
366
- }
367
- this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
368
- x: offset,
369
- animated
370
- } : {
371
- y: offset,
372
- animated
373
- });
374
- }
375
- }
376
- }
377
- },
378
- {
379
- // scrollToIndex may be janky without getItemLayout prop
380
- key: "scrollToIndex",
381
- value: function(params) {
382
- var { data, horizontal, getItemCount, getItemLayout, onScrollToIndexFailed } = this.props, { animated, index, viewOffset, viewPosition } = params;
383
- if (invariant(index >= 0, `scrollToIndex out of range: requested index ${index} but minimum is 0`), invariant(getItemCount(data) >= 1, `scrollToIndex out of range: item length ${getItemCount(data)} but minimum is 1`), invariant(index < getItemCount(data), `scrollToIndex out of range: requested index ${index} is out of 0 to ${getItemCount(data) - 1}`), !getItemLayout && index > this._highestMeasuredFrameIndex) {
384
- invariant(!!onScrollToIndexFailed, "scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures."), onScrollToIndexFailed({
385
- averageItemLength: this._averageCellLength,
386
- highestMeasuredFrameIndex: this._highestMeasuredFrameIndex,
387
- index
388
- });
389
- return;
390
- }
391
- var frame = this.__getFrameMetricsApprox(Math.floor(index), this.props), offset = Math.max(
392
- 0,
393
- // @ts-ignore
394
- this._getOffsetApprox(index, this.props) - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length)
395
- ) - (viewOffset || 0);
396
- if (this._scrollRef != null) {
397
- if (this._scrollRef.scrollTo == null) {
398
- console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
399
- return;
400
- }
401
- this._scrollRef.scrollTo(horizontal ? {
402
- x: offset,
403
- animated
404
- } : {
405
- y: offset,
406
- animated
407
- });
408
- }
409
- }
410
- },
411
- {
412
- // scrollToItem may be janky without getItemLayout prop. Required linear scan through items -
413
- // use scrollToIndex instead if possible.
414
- key: "scrollToItem",
415
- value: function(params) {
416
- for (var { item } = params, { data, getItem, getItemCount } = this.props, itemCount = getItemCount(data), index = 0; index < itemCount; index++)
417
- if (getItem(data, index) === item) {
418
- this.scrollToIndex({
419
- ...params,
420
- index
421
- });
422
- break;
423
- }
424
- }
425
- },
426
- {
427
- /**
428
- * Scroll to a specific content pixel offset in the list.
429
- *
430
- * Param `offset` expects the offset to scroll to.
431
- * In case of `horizontal` is true, the offset is the x-value,
432
- * in any other case the offset is the y-value.
433
- *
434
- * Param `animated` (`true` by default) defines whether the list
435
- * should do an animation while scrolling.
436
- */
437
- key: "scrollToOffset",
438
- value: function(params) {
439
- var { animated, offset } = params;
378
+ return _create_class(VirtualizedList2, [{
379
+ // scrollToEnd may be janky without getItemLayout prop
380
+ key: "scrollToEnd",
381
+ value: function (params) {
382
+ var animated = params ? params.animated : !0,
383
+ veryLast = this.props.getItemCount(this.props.data) - 1;
384
+ if (!(veryLast < 0)) {
385
+ var frame = this.__getFrameMetricsApprox(veryLast, this.props),
386
+ offset = Math.max(0, frame.offset + frame.length + this._footerLength - this._scrollMetrics.visibleLength);
440
387
  if (this._scrollRef != null) {
441
388
  if (this._scrollRef.scrollTo == null) {
442
389
  console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
@@ -451,158 +398,250 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
451
398
  });
452
399
  }
453
400
  }
454
- },
455
- {
456
- key: "recordInteraction",
457
- value: function() {
458
- this._nestedChildLists.forEach(function(childList) {
459
- childList.recordInteraction();
460
- }), this._viewabilityTuples.forEach(function(t) {
461
- t.viewabilityHelper.recordInteraction();
462
- }), this._updateViewableItems(this.props, this.state.cellsAroundViewport);
463
- }
464
- },
465
- {
466
- key: "flashScrollIndicators",
467
- value: function() {
468
- this._scrollRef != null && this._scrollRef.flashScrollIndicators();
469
- }
470
- },
471
- {
472
- /**
473
- * Provides a handle to the underlying scroll responder.
474
- * Note that `this._scrollRef` might not be a `ScrollView`, so we
475
- * need to check that it responds to `getScrollResponder` before calling it.
476
- */
477
- key: "getScrollResponder",
478
- value: function() {
479
- return this._scrollRef && this._scrollRef.getScrollResponder ? this._scrollRef.getScrollResponder() : null;
480
- }
481
- },
482
- {
483
- key: "getScrollableNode",
484
- value: function() {
485
- return this._scrollRef && this._scrollRef.getScrollableNode ? this._scrollRef.getScrollableNode() : this._scrollRef;
486
- }
487
- },
488
- {
489
- key: "getScrollRef",
490
- value: function() {
491
- return this._scrollRef && this._scrollRef.getScrollRef ? this._scrollRef.getScrollRef() : this._scrollRef;
492
- }
493
- },
494
- {
495
- key: "_getCellKey",
496
- value: function() {
497
- var _this_context;
498
- return ((_this_context = this.context) === null || _this_context === void 0 ? void 0 : _this_context.cellKey) || "rootList";
499
- }
500
- },
501
- {
502
- key: "hasMore",
503
- value: function() {
504
- return this._hasMore;
401
+ }
402
+ }, {
403
+ // scrollToIndex may be janky without getItemLayout prop
404
+ key: "scrollToIndex",
405
+ value: function (params) {
406
+ var {
407
+ data,
408
+ horizontal,
409
+ getItemCount,
410
+ getItemLayout,
411
+ onScrollToIndexFailed
412
+ } = this.props,
413
+ {
414
+ animated,
415
+ index,
416
+ viewOffset,
417
+ viewPosition
418
+ } = params;
419
+ if (invariant(index >= 0, `scrollToIndex out of range: requested index ${index} but minimum is 0`), invariant(getItemCount(data) >= 1, `scrollToIndex out of range: item length ${getItemCount(data)} but minimum is 1`), invariant(index < getItemCount(data), `scrollToIndex out of range: requested index ${index} is out of 0 to ${getItemCount(data) - 1}`), !getItemLayout && index > this._highestMeasuredFrameIndex) {
420
+ invariant(!!onScrollToIndexFailed, "scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures."), onScrollToIndexFailed({
421
+ averageItemLength: this._averageCellLength,
422
+ highestMeasuredFrameIndex: this._highestMeasuredFrameIndex,
423
+ index
424
+ });
425
+ return;
505
426
  }
506
- },
507
- {
508
- key: "_checkProps",
509
- value: function(props) {
510
- var { onScroll, windowSize, getItemCount, data, initialScrollIndex } = props;
511
- invariant(!(onScroll && onScroll.__isNative), "Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent to support native onScroll events with useNativeDriver"), invariant(windowSizeOrDefault(windowSize) > 0, "VirtualizedList: The windowSize prop must be present and set to a value greater than 0."), invariant(getItemCount, 'VirtualizedList: The "getItemCount" prop must be provided');
512
- var itemCount = getItemCount(data);
513
- if (initialScrollIndex != null && !this._hasTriggeredInitialScrollToIndex && (initialScrollIndex < 0 || itemCount > 0 && initialScrollIndex >= itemCount) && !this._hasWarned.initialScrollIndex && (console.warn(`initialScrollIndex "${initialScrollIndex}" is not valid (list has ${itemCount} items)`), this._hasWarned.initialScrollIndex = !0), __DEV__ && !this._hasWarned.flexWrap) {
514
- var flatStyles = StyleSheet.flatten(this.props.contentContainerStyle);
515
- flatStyles != null && flatStyles.flexWrap === "wrap" && (console.warn("`flexWrap: `wrap`` is not supported with the `VirtualizedList` components.Consider using `numColumns` with `FlatList` instead."), this._hasWarned.flexWrap = !0);
427
+ var frame = this.__getFrameMetricsApprox(Math.floor(index), this.props),
428
+ offset = Math.max(0,
429
+ // @ts-ignore
430
+ this._getOffsetApprox(index, this.props) - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length)) - (viewOffset || 0);
431
+ if (this._scrollRef != null) {
432
+ if (this._scrollRef.scrollTo == null) {
433
+ console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
434
+ return;
516
435
  }
436
+ this._scrollRef.scrollTo(horizontal ? {
437
+ x: offset,
438
+ animated
439
+ } : {
440
+ y: offset,
441
+ animated
442
+ });
517
443
  }
518
- },
519
- {
520
- key: "_adjustCellsAroundViewport",
521
- value: function(props, cellsAroundViewport) {
522
- var { data, getItemCount } = props, onEndReachedThreshold = onEndReachedThresholdOrDefault(props.onEndReachedThreshold), { contentLength, offset, visibleLength } = this._scrollMetrics, distanceFromEnd = contentLength - visibleLength - offset;
523
- if (visibleLength <= 0 || contentLength <= 0)
524
- return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
525
- var newCellsAroundViewport;
526
- if (props.disableVirtualization) {
527
- var renderAhead = distanceFromEnd < onEndReachedThreshold * visibleLength ? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch) : 0;
528
- newCellsAroundViewport = {
529
- first: 0,
530
- last: Math.min(cellsAroundViewport.last + renderAhead, getItemCount(data) - 1)
531
- };
532
- } else {
533
- if (props.initialScrollIndex && !this._scrollMetrics.offset && Math.abs(distanceFromEnd) >= Number.EPSILON)
534
- return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
535
- newCellsAroundViewport = computeWindowedRenderLimits(props, maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch), windowSizeOrDefault(props.windowSize), cellsAroundViewport, this.__getFrameMetricsApprox, this._scrollMetrics), invariant(newCellsAroundViewport.last < getItemCount(data), "computeWindowedRenderLimits() should return range in-bounds");
536
- }
537
- if (this._nestedChildLists.size() > 0) {
538
- var childIdx = this._findFirstChildWithMore(newCellsAroundViewport.first, newCellsAroundViewport.last);
539
- newCellsAroundViewport.last = childIdx ?? newCellsAroundViewport.last;
540
- }
541
- return newCellsAroundViewport;
444
+ }
445
+ }, {
446
+ // scrollToItem may be janky without getItemLayout prop. Required linear scan through items -
447
+ // use scrollToIndex instead if possible.
448
+ key: "scrollToItem",
449
+ value: function (params) {
450
+ for (var {
451
+ item
452
+ } = params, {
453
+ data,
454
+ getItem,
455
+ getItemCount
456
+ } = this.props, itemCount = getItemCount(data), index = 0; index < itemCount; index++) if (getItem(data, index) === item) {
457
+ this.scrollToIndex({
458
+ ...params,
459
+ index
460
+ });
461
+ break;
542
462
  }
543
- },
544
- {
545
- key: "_findFirstChildWithMore",
546
- value: function(first, last) {
547
- for (var ii = first; ii <= last; ii++) {
548
- var cellKeyForIndex = this._indicesToKeys.get(ii);
549
- if (cellKeyForIndex != null && this._nestedChildLists.anyInCell(cellKeyForIndex, function(childList) {
550
- return childList.hasMore();
551
- }))
552
- return ii;
463
+ }
464
+ }, {
465
+ /**
466
+ * Scroll to a specific content pixel offset in the list.
467
+ *
468
+ * Param `offset` expects the offset to scroll to.
469
+ * In case of `horizontal` is true, the offset is the x-value,
470
+ * in any other case the offset is the y-value.
471
+ *
472
+ * Param `animated` (`true` by default) defines whether the list
473
+ * should do an animation while scrolling.
474
+ */
475
+ key: "scrollToOffset",
476
+ value: function (params) {
477
+ var {
478
+ animated,
479
+ offset
480
+ } = params;
481
+ if (this._scrollRef != null) {
482
+ if (this._scrollRef.scrollTo == null) {
483
+ console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo.");
484
+ return;
553
485
  }
554
- return null;
486
+ this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
487
+ x: offset,
488
+ animated
489
+ } : {
490
+ y: offset,
491
+ animated
492
+ });
555
493
  }
556
- },
557
- {
558
- key: "componentDidMount",
559
- value: function() {
560
- this._isNestedWithSameOrientation() && this.context.registerAsNestedChild({
561
- ref: this,
562
- cellKey: this.context.cellKey
563
- }), this.setupWebWheelHandler();
494
+ }
495
+ }, {
496
+ key: "recordInteraction",
497
+ value: function () {
498
+ this._nestedChildLists.forEach(function (childList) {
499
+ childList.recordInteraction();
500
+ }), this._viewabilityTuples.forEach(function (t) {
501
+ t.viewabilityHelper.recordInteraction();
502
+ }), this._updateViewableItems(this.props, this.state.cellsAroundViewport);
503
+ }
504
+ }, {
505
+ key: "flashScrollIndicators",
506
+ value: function () {
507
+ this._scrollRef != null && this._scrollRef.flashScrollIndicators();
508
+ }
509
+ }, {
510
+ /**
511
+ * Provides a handle to the underlying scroll responder.
512
+ * Note that `this._scrollRef` might not be a `ScrollView`, so we
513
+ * need to check that it responds to `getScrollResponder` before calling it.
514
+ */
515
+ key: "getScrollResponder",
516
+ value: function () {
517
+ return this._scrollRef && this._scrollRef.getScrollResponder ? this._scrollRef.getScrollResponder() : null;
518
+ }
519
+ }, {
520
+ key: "getScrollableNode",
521
+ value: function () {
522
+ return this._scrollRef && this._scrollRef.getScrollableNode ? this._scrollRef.getScrollableNode() : this._scrollRef;
523
+ }
524
+ }, {
525
+ key: "getScrollRef",
526
+ value: function () {
527
+ return this._scrollRef && this._scrollRef.getScrollRef ? this._scrollRef.getScrollRef() : this._scrollRef;
528
+ }
529
+ }, {
530
+ key: "_getCellKey",
531
+ value: function () {
532
+ var _this_context;
533
+ return ((_this_context = this.context) === null || _this_context === void 0 ? void 0 : _this_context.cellKey) || "rootList";
534
+ }
535
+ }, {
536
+ key: "hasMore",
537
+ value: function () {
538
+ return this._hasMore;
539
+ }
540
+ }, {
541
+ key: "_checkProps",
542
+ value: function (props) {
543
+ var {
544
+ onScroll,
545
+ windowSize,
546
+ getItemCount,
547
+ data,
548
+ initialScrollIndex
549
+ } = props;
550
+ invariant(!(onScroll && onScroll.__isNative), "Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent to support native onScroll events with useNativeDriver"), invariant(windowSizeOrDefault(windowSize) > 0, "VirtualizedList: The windowSize prop must be present and set to a value greater than 0."), invariant(getItemCount, 'VirtualizedList: The "getItemCount" prop must be provided');
551
+ var itemCount = getItemCount(data);
552
+ if (initialScrollIndex != null && !this._hasTriggeredInitialScrollToIndex && (initialScrollIndex < 0 || itemCount > 0 && initialScrollIndex >= itemCount) && !this._hasWarned.initialScrollIndex && (console.warn(`initialScrollIndex "${initialScrollIndex}" is not valid (list has ${itemCount} items)`), this._hasWarned.initialScrollIndex = !0), __DEV__ && !this._hasWarned.flexWrap) {
553
+ var flatStyles = StyleSheet.flatten(this.props.contentContainerStyle);
554
+ flatStyles != null && flatStyles.flexWrap === "wrap" && (console.warn("`flexWrap: `wrap`` is not supported with the `VirtualizedList` components.Consider using `numColumns` with `FlatList` instead."), this._hasWarned.flexWrap = !0);
564
555
  }
565
- },
566
- {
567
- key: "componentWillUnmount",
568
- value: function() {
569
- this._isNestedWithSameOrientation() && this.context.unregisterAsNestedChild({
570
- ref: this
571
- }), this._updateCellsToRenderBatcher.dispose({
572
- abort: !0
573
- }), this._viewabilityTuples.forEach(function(tuple) {
574
- tuple.viewabilityHelper.dispose();
575
- }), this._fillRateHelper.deactivateAndFlush(), this.teardownWebWheelHandler();
556
+ }
557
+ }, {
558
+ key: "_adjustCellsAroundViewport",
559
+ value: function (props, cellsAroundViewport) {
560
+ var {
561
+ data,
562
+ getItemCount
563
+ } = props,
564
+ onEndReachedThreshold = onEndReachedThresholdOrDefault(props.onEndReachedThreshold),
565
+ {
566
+ contentLength,
567
+ offset,
568
+ visibleLength
569
+ } = this._scrollMetrics,
570
+ distanceFromEnd = contentLength - visibleLength - offset;
571
+ if (visibleLength <= 0 || contentLength <= 0) return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
572
+ var newCellsAroundViewport;
573
+ if (props.disableVirtualization) {
574
+ var renderAhead = distanceFromEnd < onEndReachedThreshold * visibleLength ? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch) : 0;
575
+ newCellsAroundViewport = {
576
+ first: 0,
577
+ last: Math.min(cellsAroundViewport.last + renderAhead, getItemCount(data) - 1)
578
+ };
579
+ } else {
580
+ if (props.initialScrollIndex && !this._scrollMetrics.offset && Math.abs(distanceFromEnd) >= Number.EPSILON) return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList2._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
581
+ newCellsAroundViewport = computeWindowedRenderLimits(props, maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch), windowSizeOrDefault(props.windowSize), cellsAroundViewport, this.__getFrameMetricsApprox, this._scrollMetrics), invariant(newCellsAroundViewport.last < getItemCount(data), "computeWindowedRenderLimits() should return range in-bounds");
576
582
  }
577
- },
578
- {
579
- key: "setupWebWheelHandler",
580
- value: function() {
581
- var _this = this;
582
- if (this._scrollRef && this._scrollRef.getScrollableNode)
583
- this._scrollRef.getScrollableNode().addEventListener("wheel", this.invertedWheelEventHandler);
584
- else {
585
- setTimeout(function() {
586
- return _this.setupWebWheelHandler();
587
- }, 50);
588
- return;
589
- }
583
+ if (this._nestedChildLists.size() > 0) {
584
+ var childIdx = this._findFirstChildWithMore(newCellsAroundViewport.first, newCellsAroundViewport.last);
585
+ newCellsAroundViewport.last = childIdx ?? newCellsAroundViewport.last;
590
586
  }
591
- },
592
- {
593
- key: "teardownWebWheelHandler",
594
- value: function() {
595
- this._scrollRef && this._scrollRef.getScrollableNode && this._scrollRef.getScrollableNode().removeEventListener("wheel", this.invertedWheelEventHandler);
587
+ return newCellsAroundViewport;
588
+ }
589
+ }, {
590
+ key: "_findFirstChildWithMore",
591
+ value: function (first, last) {
592
+ for (var ii = first; ii <= last; ii++) {
593
+ var cellKeyForIndex = this._indicesToKeys.get(ii);
594
+ if (cellKeyForIndex != null && this._nestedChildLists.anyInCell(cellKeyForIndex, function (childList) {
595
+ return childList.hasMore();
596
+ })) return ii;
596
597
  }
597
- },
598
- {
599
- key: "_pushCells",
600
- value: function(cells, stickyHeaderIndices, stickyIndicesFromProps, first, last, inversionStyle) {
601
- var _this, _loop = function(ii2) {
602
- var item = getItem(data, ii2), key = _this._keyExtractor(item, ii2, _this.props);
598
+ return null;
599
+ }
600
+ }, {
601
+ key: "componentDidMount",
602
+ value: function () {
603
+ this._isNestedWithSameOrientation() && this.context.registerAsNestedChild({
604
+ ref: this,
605
+ cellKey: this.context.cellKey
606
+ }), this.setupWebWheelHandler();
607
+ }
608
+ }, {
609
+ key: "componentWillUnmount",
610
+ value: function () {
611
+ this._isNestedWithSameOrientation() && this.context.unregisterAsNestedChild({
612
+ ref: this
613
+ }), this._updateCellsToRenderBatcher.dispose({
614
+ abort: !0
615
+ }), this._viewabilityTuples.forEach(function (tuple) {
616
+ tuple.viewabilityHelper.dispose();
617
+ }), this._fillRateHelper.deactivateAndFlush(), this.teardownWebWheelHandler();
618
+ }
619
+ }, {
620
+ key: "setupWebWheelHandler",
621
+ value: function () {
622
+ var _this = this;
623
+ if (this._scrollRef && this._scrollRef.getScrollableNode) this._scrollRef.getScrollableNode().addEventListener("wheel", this.invertedWheelEventHandler);else {
624
+ setTimeout(function () {
625
+ return _this.setupWebWheelHandler();
626
+ }, 50);
627
+ return;
628
+ }
629
+ }
630
+ }, {
631
+ key: "teardownWebWheelHandler",
632
+ value: function () {
633
+ this._scrollRef && this._scrollRef.getScrollableNode && this._scrollRef.getScrollableNode().removeEventListener("wheel", this.invertedWheelEventHandler);
634
+ }
635
+ }, {
636
+ key: "_pushCells",
637
+ value: function (cells, stickyHeaderIndices, stickyIndicesFromProps, first, last, inversionStyle) {
638
+ var _this,
639
+ _loop = function (ii2) {
640
+ var item = getItem(data, ii2),
641
+ key = _this._keyExtractor(item, ii2, _this.props);
603
642
  _this._indicesToKeys.set(ii2, key), stickyIndicesFromProps.has(ii2 + stickyOffset) && stickyHeaderIndices.push(cells.length);
604
643
  var shouldListenForLayout = getItemLayout == null || debug || _this._fillRateHelper.enabled();
605
- cells.push(/* @__PURE__ */ _jsx(CellRenderer, {
644
+ cells.push(/* @__PURE__ */_jsx(CellRenderer, {
606
645
  CellRendererComponent,
607
646
  ItemSeparatorComponent: ii2 < end ? ItemSeparatorComponent : void 0,
608
647
  ListItemComponent,
@@ -613,141 +652,161 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
613
652
  item,
614
653
  prevCellKey,
615
654
  onUpdateSeparators: _this._onUpdateSeparators,
616
- onCellFocusCapture: function(e) {
655
+ onCellFocusCapture: function (e) {
617
656
  return _this1._onCellFocusCapture(key);
618
657
  },
619
658
  onUnmount: _this._onCellUnmount,
620
- ref: function(ref) {
659
+ ref: function (ref) {
621
660
  _this1._cellRefs[key] = ref;
622
661
  },
623
662
  renderItem,
624
- ...shouldListenForLayout && {
663
+ ...(shouldListenForLayout && {
625
664
  onCellLayout: _this._onCellLayout
626
- }
665
+ })
627
666
  }, key)), prevCellKey = key;
628
- }, _this1 = this, { CellRendererComponent, ItemSeparatorComponent, ListHeaderComponent, ListItemComponent, data, debug, getItem, getItemCount, getItemLayout, horizontal, renderItem } = this.props, stickyOffset = ListHeaderComponent ? 1 : 0, end = getItemCount(data) - 1, prevCellKey;
629
- last = Math.min(end, last);
630
- for (var ii = first; ii <= last; ii++) _this = this, _loop(ii);
631
- }
632
- },
633
- {
634
- key: "_isNestedWithSameOrientation",
635
- value: function() {
636
- var nestedContext = this.context;
637
- return !!(nestedContext && !!nestedContext.horizontal === horizontalOrDefault(this.props.horizontal));
667
+ },
668
+ _this1 = this,
669
+ {
670
+ CellRendererComponent,
671
+ ItemSeparatorComponent,
672
+ ListHeaderComponent,
673
+ ListItemComponent,
674
+ data,
675
+ debug,
676
+ getItem,
677
+ getItemCount,
678
+ getItemLayout,
679
+ horizontal,
680
+ renderItem
681
+ } = this.props,
682
+ stickyOffset = ListHeaderComponent ? 1 : 0,
683
+ end = getItemCount(data) - 1,
684
+ prevCellKey;
685
+ last = Math.min(end, last);
686
+ for (var ii = first; ii <= last; ii++) _this = this, _loop(ii);
687
+ }
688
+ }, {
689
+ key: "_isNestedWithSameOrientation",
690
+ value: function () {
691
+ var nestedContext = this.context;
692
+ return !!(nestedContext && !!nestedContext.horizontal === horizontalOrDefault(this.props.horizontal));
693
+ }
694
+ }, {
695
+ key: "_keyExtractor",
696
+ value: function (item, index, props) {
697
+ if (props.keyExtractor != null) return props.keyExtractor(item, index);
698
+ var key = defaultKeyExtractor(item, index);
699
+ return key === String(index) && (_usedIndexForKey = !0, item.type && item.type.displayName && (_keylessItemComponentName = item.type.displayName)), key;
700
+ }
701
+ }, {
702
+ key: "render",
703
+ value: function () {
704
+ var _this = this;
705
+ this._checkProps(this.props);
706
+ var {
707
+ ListEmptyComponent,
708
+ ListFooterComponent,
709
+ ListHeaderComponent
710
+ } = this.props,
711
+ {
712
+ data,
713
+ horizontal
714
+ } = this.props,
715
+ inversionStyle = this.props.inverted ? horizontalOrDefault(this.props.horizontal) ? styles.horizontallyInverted : styles.verticallyInverted : null,
716
+ cells = [],
717
+ stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices),
718
+ stickyHeaderIndices = [];
719
+ if (ListHeaderComponent) {
720
+ stickyIndicesFromProps.has(0) && stickyHeaderIndices.push(0);
721
+ var element = /* @__PURE__ */React.isValidElement(ListHeaderComponent) ? ListHeaderComponent : /* @__PURE__ */_jsx(ListHeaderComponent, {});
722
+ cells.push(/* @__PURE__ */_jsx(VirtualizedListCellContextProvider, {
723
+ cellKey: this._getCellKey() + "-header",
724
+ children: /* @__PURE__ */_jsx(View, {
725
+ onLayout: this._onLayoutHeader,
726
+ style: [inversionStyle, this.props.ListHeaderComponentStyle],
727
+ children: element
728
+ })
729
+ }, "$header"));
638
730
  }
639
- },
640
- {
641
- key: "_keyExtractor",
642
- value: function(item, index, props) {
643
- if (props.keyExtractor != null)
644
- return props.keyExtractor(item, index);
645
- var key = defaultKeyExtractor(item, index);
646
- return key === String(index) && (_usedIndexForKey = !0, item.type && item.type.displayName && (_keylessItemComponentName = item.type.displayName)), key;
731
+ var itemCount = this.props.getItemCount(data);
732
+ if (itemCount === 0 && ListEmptyComponent) {
733
+ var element1 = /* @__PURE__ */React.isValidElement(ListEmptyComponent) ? ListEmptyComponent : /* @__PURE__ */_jsx(ListEmptyComponent, {});
734
+ cells.push(/* @__PURE__ */_jsx(VirtualizedListCellContextProvider, {
735
+ cellKey: this._getCellKey() + "-empty",
736
+ children: /* @__PURE__ */React.cloneElement(element1, {
737
+ onLayout: function (event) {
738
+ _this._onLayoutEmpty(event), element1.props.onLayout && element1.props.onLayout(event);
739
+ },
740
+ style: [inversionStyle, element1.props.style]
741
+ })
742
+ }, "$empty"));
647
743
  }
648
- },
649
- {
650
- key: "render",
651
- value: function() {
652
- var _this = this;
653
- this._checkProps(this.props);
654
- var { ListEmptyComponent, ListFooterComponent, ListHeaderComponent } = this.props, { data, horizontal } = this.props, inversionStyle = this.props.inverted ? horizontalOrDefault(this.props.horizontal) ? styles.horizontallyInverted : styles.verticallyInverted : null, cells = [], stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices), stickyHeaderIndices = [];
655
- if (ListHeaderComponent) {
656
- stickyIndicesFromProps.has(0) && stickyHeaderIndices.push(0);
657
- var element = /* @__PURE__ */ React.isValidElement(ListHeaderComponent) ? ListHeaderComponent : /* @__PURE__ */ _jsx(ListHeaderComponent, {});
658
- cells.push(/* @__PURE__ */ _jsx(VirtualizedListCellContextProvider, {
659
- cellKey: this._getCellKey() + "-header",
660
- children: /* @__PURE__ */ _jsx(View, {
661
- onLayout: this._onLayoutHeader,
662
- style: [
663
- inversionStyle,
664
- this.props.ListHeaderComponentStyle
665
- ],
666
- children: element
667
- })
668
- }, "$header"));
669
- }
670
- var itemCount = this.props.getItemCount(data);
671
- if (itemCount === 0 && ListEmptyComponent) {
672
- var element1 = /* @__PURE__ */ React.isValidElement(ListEmptyComponent) ? ListEmptyComponent : /* @__PURE__ */ _jsx(ListEmptyComponent, {});
673
- cells.push(/* @__PURE__ */ _jsx(VirtualizedListCellContextProvider, {
674
- cellKey: this._getCellKey() + "-empty",
675
- children: /* @__PURE__ */ React.cloneElement(element1, {
676
- onLayout: function(event) {
677
- _this._onLayoutEmpty(event), element1.props.onLayout && element1.props.onLayout(event);
678
- },
679
- style: [
680
- inversionStyle,
681
- element1.props.style
682
- ]
683
- })
684
- }, "$empty"));
685
- }
686
- if (itemCount > 0) {
687
- _usedIndexForKey = !1, _keylessItemComponentName = "";
688
- var spacerKey = this._getSpacerKey(!horizontal), renderRegions = this.state.renderMask.enumerateRegions(), lastSpacer = findLastWhere(renderRegions, function(r) {
744
+ if (itemCount > 0) {
745
+ _usedIndexForKey = !1, _keylessItemComponentName = "";
746
+ var spacerKey = this._getSpacerKey(!horizontal),
747
+ renderRegions = this.state.renderMask.enumerateRegions(),
748
+ lastSpacer = findLastWhere(renderRegions, function (r) {
689
749
  return r.isSpacer;
690
- }), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
750
+ }),
751
+ _iteratorNormalCompletion = !0,
752
+ _didIteratorError = !1,
753
+ _iteratorError = void 0;
754
+ try {
755
+ for (var _iterator = renderRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
756
+ var section = _step.value;
757
+ if (section.isSpacer) {
758
+ if (this.props.disableVirtualization) continue;
759
+ var isLastSpacer = section === lastSpacer,
760
+ constrainToMeasured = isLastSpacer && !this.props.getItemLayout,
761
+ last = constrainToMeasured ? clamp(section.first - 1, section.last, this._highestMeasuredFrameIndex) : section.last,
762
+ firstMetrics = this.__getFrameMetricsApprox(section.first, this.props),
763
+ lastMetrics = this.__getFrameMetricsApprox(last, this.props),
764
+ spacerSize = lastMetrics.offset + lastMetrics.length - firstMetrics.offset;
765
+ cells.push(/* @__PURE__ */_jsx(View, {
766
+ style: {
767
+ [spacerKey]: spacerSize
768
+ }
769
+ }, `$spacer-${section.first}`));
770
+ } else this._pushCells(cells, stickyHeaderIndices, stickyIndicesFromProps, section.first, section.last, inversionStyle);
771
+ }
772
+ } catch (err) {
773
+ _didIteratorError = !0, _iteratorError = err;
774
+ } finally {
691
775
  try {
692
- for (var _iterator = renderRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
693
- var section = _step.value;
694
- if (section.isSpacer) {
695
- if (this.props.disableVirtualization)
696
- continue;
697
- var isLastSpacer = section === lastSpacer, constrainToMeasured = isLastSpacer && !this.props.getItemLayout, last = constrainToMeasured ? clamp(section.first - 1, section.last, this._highestMeasuredFrameIndex) : section.last, firstMetrics = this.__getFrameMetricsApprox(section.first, this.props), lastMetrics = this.__getFrameMetricsApprox(last, this.props), spacerSize = lastMetrics.offset + lastMetrics.length - firstMetrics.offset;
698
- cells.push(/* @__PURE__ */ _jsx(View, {
699
- style: {
700
- [spacerKey]: spacerSize
701
- }
702
- }, `$spacer-${section.first}`));
703
- } else
704
- this._pushCells(cells, stickyHeaderIndices, stickyIndicesFromProps, section.first, section.last, inversionStyle);
705
- }
706
- } catch (err) {
707
- _didIteratorError = !0, _iteratorError = err;
776
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
708
777
  } finally {
709
- try {
710
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
711
- } finally {
712
- if (_didIteratorError)
713
- throw _iteratorError;
714
- }
778
+ if (_didIteratorError) throw _iteratorError;
715
779
  }
716
- !this._hasWarned.keys && _usedIndexForKey && (console.warn("VirtualizedList: missing keys for items, make sure to specify a key or id property on each item or provide a custom keyExtractor.", _keylessItemComponentName), this._hasWarned.keys = !0);
717
- }
718
- if (ListFooterComponent) {
719
- var element2 = /* @__PURE__ */ React.isValidElement(ListFooterComponent) ? ListFooterComponent : /* @__PURE__ */ _jsx(ListFooterComponent, {});
720
- cells.push(/* @__PURE__ */ _jsx(VirtualizedListCellContextProvider, {
721
- cellKey: this._getFooterCellKey(),
722
- children: /* @__PURE__ */ _jsx(View, {
723
- onLayout: this._onLayoutFooter,
724
- style: [
725
- inversionStyle,
726
- this.props.ListFooterComponentStyle
727
- ],
728
- children: element2
729
- })
730
- }, "$footer"));
731
780
  }
732
- var scrollProps = {
733
- ...this.props,
734
- onContentSizeChange: this._onContentSizeChange,
735
- onLayout: this._onLayout,
736
- onScroll: this._onScroll,
737
- onScrollBeginDrag: this._onScrollBeginDrag,
738
- onScrollEndDrag: this._onScrollEndDrag,
739
- onMomentumScrollBegin: this._onMomentumScrollBegin,
740
- onMomentumScrollEnd: this._onMomentumScrollEnd,
741
- scrollEventThrottle: scrollEventThrottleOrDefault(this.props.scrollEventThrottle),
742
- invertStickyHeaders: this.props.invertStickyHeaders !== void 0 ? this.props.invertStickyHeaders : this.props.inverted,
743
- stickyHeaderIndices,
744
- style: inversionStyle ? [
745
- inversionStyle,
746
- this.props.style
747
- ] : this.props.style
748
- };
749
- this._hasMore = this.state.cellsAroundViewport.last < itemCount - 1;
750
- var innerRet = /* @__PURE__ */ _jsx(VirtualizedListContextProvider, {
781
+ !this._hasWarned.keys && _usedIndexForKey && (console.warn("VirtualizedList: missing keys for items, make sure to specify a key or id property on each item or provide a custom keyExtractor.", _keylessItemComponentName), this._hasWarned.keys = !0);
782
+ }
783
+ if (ListFooterComponent) {
784
+ var element2 = /* @__PURE__ */React.isValidElement(ListFooterComponent) ? ListFooterComponent : /* @__PURE__ */_jsx(ListFooterComponent, {});
785
+ cells.push(/* @__PURE__ */_jsx(VirtualizedListCellContextProvider, {
786
+ cellKey: this._getFooterCellKey(),
787
+ children: /* @__PURE__ */_jsx(View, {
788
+ onLayout: this._onLayoutFooter,
789
+ style: [inversionStyle, this.props.ListFooterComponentStyle],
790
+ children: element2
791
+ })
792
+ }, "$footer"));
793
+ }
794
+ var scrollProps = {
795
+ ...this.props,
796
+ onContentSizeChange: this._onContentSizeChange,
797
+ onLayout: this._onLayout,
798
+ onScroll: this._onScroll,
799
+ onScrollBeginDrag: this._onScrollBeginDrag,
800
+ onScrollEndDrag: this._onScrollEndDrag,
801
+ onMomentumScrollBegin: this._onMomentumScrollBegin,
802
+ onMomentumScrollEnd: this._onMomentumScrollEnd,
803
+ scrollEventThrottle: scrollEventThrottleOrDefault(this.props.scrollEventThrottle),
804
+ invertStickyHeaders: this.props.invertStickyHeaders !== void 0 ? this.props.invertStickyHeaders : this.props.inverted,
805
+ stickyHeaderIndices,
806
+ style: inversionStyle ? [inversionStyle, this.props.style] : this.props.style
807
+ };
808
+ this._hasMore = this.state.cellsAroundViewport.last < itemCount - 1;
809
+ var innerRet = /* @__PURE__ */_jsx(VirtualizedListContextProvider, {
751
810
  value: {
752
811
  cellKey: null,
753
812
  getScrollMetrics: this._getScrollMetrics,
@@ -756,310 +815,308 @@ var VirtualizedList = /* @__PURE__ */ function(StateSafePureComponent2) {
756
815
  registerAsNestedChild: this._registerAsNestedChild,
757
816
  unregisterAsNestedChild: this._unregisterAsNestedChild
758
817
  },
759
- children: /* @__PURE__ */ React.cloneElement((this.props.renderScrollComponent || this._defaultRenderScrollComponent)(scrollProps), {
818
+ children: /* @__PURE__ */React.cloneElement((this.props.renderScrollComponent || this._defaultRenderScrollComponent)(scrollProps), {
760
819
  ref: this._captureScrollRef
761
820
  }, cells)
762
- }), ret = innerRet;
763
- return ret;
764
- }
765
- },
766
- {
767
- key: "componentDidUpdate",
768
- value: function(prevProps) {
769
- var { data, extraData } = this.props;
770
- (data !== prevProps.data || extraData !== prevProps.extraData) && this._viewabilityTuples.forEach(function(tuple) {
771
- tuple.viewabilityHelper.resetViewableIndices();
821
+ }),
822
+ ret = innerRet;
823
+ return ret;
824
+ }
825
+ }, {
826
+ key: "componentDidUpdate",
827
+ value: function (prevProps) {
828
+ var {
829
+ data,
830
+ extraData
831
+ } = this.props;
832
+ (data !== prevProps.data || extraData !== prevProps.extraData) && this._viewabilityTuples.forEach(function (tuple) {
833
+ tuple.viewabilityHelper.resetViewableIndices();
834
+ });
835
+ var hiPriInProgress = this._hiPriInProgress;
836
+ this._scheduleCellsToRenderUpdate(), hiPriInProgress && (this._hiPriInProgress = !1);
837
+ }
838
+ }, {
839
+ key: "_computeBlankness",
840
+ value: function () {
841
+ this._fillRateHelper.computeBlankness(
842
+ // @ts-ignore
843
+ this.props, this.state.cellsAroundViewport, this._scrollMetrics);
844
+ }
845
+ }, {
846
+ key: "_onCellFocusCapture",
847
+ value: function (cellKey) {
848
+ this._lastFocusedCellKey = cellKey, this._updateCellsToRender();
849
+ }
850
+ }, {
851
+ key: "_triggerRemeasureForChildListsInCell",
852
+ value: function (cellKey) {
853
+ this._nestedChildLists.forEachInCell(cellKey, function (childList) {
854
+ childList.measureLayoutRelativeToContainingList();
855
+ });
856
+ }
857
+ }, {
858
+ key: "measureLayoutRelativeToContainingList",
859
+ value: function () {
860
+ var _this = this;
861
+ try {
862
+ if (!this._scrollRef) return;
863
+ this._scrollRef.measureLayout(this.context.getOutermostParentListRef().getScrollRef(), function (x, y, width, height) {
864
+ _this._offsetFromParentVirtualizedList = _this._selectOffset({
865
+ x,
866
+ y
867
+ }), _this._scrollMetrics.contentLength = _this._selectLength({
868
+ width,
869
+ height
870
+ });
871
+ var scrollMetrics = _this._convertParentScrollMetrics(_this.context.getScrollMetrics()),
872
+ metricsChanged = _this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength || _this._scrollMetrics.offset !== scrollMetrics.offset;
873
+ metricsChanged && (_this._scrollMetrics.visibleLength = scrollMetrics.visibleLength, _this._scrollMetrics.offset = scrollMetrics.offset, _this._nestedChildLists.forEach(function (childList) {
874
+ childList.measureLayoutRelativeToContainingList();
875
+ }));
876
+ }, function (error) {
877
+ console.warn("VirtualizedList: Encountered an error while measuring a list's offset from its containing VirtualizedList.");
772
878
  });
773
- var hiPriInProgress = this._hiPriInProgress;
774
- this._scheduleCellsToRenderUpdate(), hiPriInProgress && (this._hiPriInProgress = !1);
879
+ } catch (error) {
880
+ console.warn("measureLayoutRelativeToContainingList threw an error", error.stack);
775
881
  }
776
- },
777
- {
778
- key: "_computeBlankness",
779
- value: function() {
780
- this._fillRateHelper.computeBlankness(
781
- // @ts-ignore
782
- this.props,
783
- this.state.cellsAroundViewport,
784
- this._scrollMetrics
785
- );
882
+ }
883
+ }, {
884
+ key: "_getFooterCellKey",
885
+ value: function () {
886
+ return this._getCellKey() + "-footer";
887
+ }
888
+ }, {
889
+ key: "_renderDebugOverlay",
890
+ value: function () {
891
+ for (var normalize = this._scrollMetrics.visibleLength / (this._scrollMetrics.contentLength || 1), framesInLayout = [], itemCount = this.props.getItemCount(this.props.data), ii = 0; ii < itemCount; ii++) {
892
+ var frame = this.__getFrameMetricsApprox(ii, this.props);
893
+ frame.inLayout && framesInLayout.push(frame);
786
894
  }
787
- },
788
- {
789
- key: "_onCellFocusCapture",
790
- value: function(cellKey) {
791
- this._lastFocusedCellKey = cellKey, this._updateCellsToRender();
895
+ var windowTop = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.first, this.props).offset,
896
+ frameLast = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.last, this.props),
897
+ windowLen = frameLast.offset + frameLast.length - windowTop,
898
+ visTop = this._scrollMetrics.offset,
899
+ visLen = this._scrollMetrics.visibleLength;
900
+ return /* @__PURE__ */_jsxs(View, {
901
+ style: [styles.debugOverlayBase, styles.debugOverlay],
902
+ children: [framesInLayout.map(function (f, ii2) {
903
+ return /* @__PURE__ */_jsx(View, {
904
+ style: [styles.debugOverlayBase, styles.debugOverlayFrame, {
905
+ top: f.offset * normalize,
906
+ height: f.length * normalize
907
+ }]
908
+ }, "f" + ii2);
909
+ }), /* @__PURE__ */_jsx(View, {
910
+ style: [styles.debugOverlayBase, styles.debugOverlayFrameLast, {
911
+ top: windowTop * normalize,
912
+ height: windowLen * normalize
913
+ }]
914
+ }), /* @__PURE__ */_jsx(View, {
915
+ style: [styles.debugOverlayBase, styles.debugOverlayFrameVis, {
916
+ top: visTop * normalize,
917
+ height: visLen * normalize
918
+ }]
919
+ })]
920
+ });
921
+ }
922
+ }, {
923
+ key: "_selectLength",
924
+ value: function (metrics) {
925
+ return horizontalOrDefault(this.props.horizontal) ? metrics.width : metrics.height;
926
+ }
927
+ }, {
928
+ key: "_selectOffset",
929
+ value: function (metrics) {
930
+ return horizontalOrDefault(this.props.horizontal) ? metrics.x : metrics.y;
931
+ }
932
+ }, {
933
+ key: "_maybeCallOnEdgeReached",
934
+ value: function () {
935
+ var {
936
+ data,
937
+ getItemCount,
938
+ onStartReached,
939
+ onStartReachedThreshold,
940
+ onEndReached,
941
+ onEndReachedThreshold,
942
+ initialScrollIndex
943
+ } = this.props,
944
+ {
945
+ contentLength,
946
+ visibleLength,
947
+ offset
948
+ } = this._scrollMetrics,
949
+ distanceFromStart = offset,
950
+ distanceFromEnd = contentLength - visibleLength - offset;
951
+ distanceFromStart < ON_EDGE_REACHED_EPSILON && (distanceFromStart = 0), distanceFromEnd < ON_EDGE_REACHED_EPSILON && (distanceFromEnd = 0);
952
+ var DEFAULT_THRESHOLD_PX = 2,
953
+ startThreshold = onStartReachedThreshold != null ? onStartReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX,
954
+ endThreshold = onEndReachedThreshold != null ? onEndReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX,
955
+ isWithinStartThreshold = distanceFromStart <= startThreshold,
956
+ isWithinEndThreshold = distanceFromEnd <= endThreshold;
957
+ onEndReached && this.state.cellsAroundViewport.last === getItemCount(data) - 1 && isWithinEndThreshold && this._scrollMetrics.contentLength !== this._sentEndForContentLength ? (this._sentEndForContentLength = this._scrollMetrics.contentLength, onEndReached({
958
+ distanceFromEnd
959
+ })) : onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this._scrollMetrics.contentLength !== this._sentStartForContentLength ? (!initialScrollIndex || this._scrollMetrics.timestamp !== 0) && (this._sentStartForContentLength = this._scrollMetrics.contentLength, onStartReached({
960
+ distanceFromStart
961
+ })) : (this._sentStartForContentLength = isWithinStartThreshold ? this._sentStartForContentLength : 0, this._sentEndForContentLength = isWithinEndThreshold ? this._sentEndForContentLength : 0);
962
+ }
963
+ }, {
964
+ key: "_scheduleCellsToRenderUpdate",
965
+ value: function () {
966
+ var {
967
+ first,
968
+ last
969
+ } = this.state.cellsAroundViewport,
970
+ {
971
+ offset,
972
+ visibleLength,
973
+ velocity
974
+ } = this._scrollMetrics,
975
+ itemCount = this.props.getItemCount(this.props.data),
976
+ hiPri = !1,
977
+ onStartReachedThreshold = onStartReachedThresholdOrDefault(this.props.onStartReachedThreshold),
978
+ onEndReachedThreshold = onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold);
979
+ if (first > 0) {
980
+ var distTop = offset - this.__getFrameMetricsApprox(first, this.props).offset;
981
+ hiPri = distTop < 0 || velocity < -2 && distTop < getScrollingThreshold(onStartReachedThreshold, visibleLength);
792
982
  }
793
- },
794
- {
795
- key: "_triggerRemeasureForChildListsInCell",
796
- value: function(cellKey) {
797
- this._nestedChildLists.forEachInCell(cellKey, function(childList) {
798
- childList.measureLayoutRelativeToContainingList();
799
- });
983
+ if (!hiPri && last >= 0 && last < itemCount - 1) {
984
+ var distBottom = this.__getFrameMetricsApprox(last, this.props).offset - (offset + visibleLength);
985
+ hiPri = distBottom < 0 || velocity > 2 && distBottom < getScrollingThreshold(onEndReachedThreshold, visibleLength);
800
986
  }
801
- },
802
- {
803
- key: "measureLayoutRelativeToContainingList",
804
- value: function() {
805
- var _this = this;
987
+ if (hiPri && (this._averageCellLength || this.props.getItemLayout) && !this._hiPriInProgress) {
988
+ this._hiPriInProgress = !0, this._updateCellsToRenderBatcher.dispose({
989
+ abort: !0
990
+ }), this._updateCellsToRender();
991
+ return;
992
+ } else this._updateCellsToRenderBatcher.schedule();
993
+ }
994
+ }, {
995
+ key: "_updateViewableItems",
996
+ value: function (props, cellsAroundViewport) {
997
+ var _this = this;
998
+ this._viewabilityTuples.forEach(function (tuple) {
999
+ tuple.viewabilityHelper.onUpdate(props, _this._scrollMetrics.offset, _this._scrollMetrics.visibleLength, _this._getFrameMetrics, _this._createViewToken, tuple.onViewableItemsChanged, cellsAroundViewport);
1000
+ });
1001
+ }
1002
+ }], [{
1003
+ key: "_createRenderMask",
1004
+ value: function (props, cellsAroundViewport, additionalRegions) {
1005
+ var itemCount = props.getItemCount(props.data);
1006
+ invariant(cellsAroundViewport.first >= 0 && cellsAroundViewport.last >= cellsAroundViewport.first - 1 && cellsAroundViewport.last < itemCount, `Invalid cells around viewport "[${cellsAroundViewport.first}, ${cellsAroundViewport.last}]" was passed to VirtualizedList._createRenderMask`);
1007
+ var renderMask = new CellRenderMask(itemCount);
1008
+ if (itemCount > 0) {
1009
+ var allRegions = [cellsAroundViewport, ...(additionalRegions ?? [])],
1010
+ _iteratorNormalCompletion = !0,
1011
+ _didIteratorError = !1,
1012
+ _iteratorError = void 0;
806
1013
  try {
807
- if (!this._scrollRef)
808
- return;
809
- this._scrollRef.measureLayout(this.context.getOutermostParentListRef().getScrollRef(), function(x, y, width, height) {
810
- _this._offsetFromParentVirtualizedList = _this._selectOffset({
811
- x,
812
- y
813
- }), _this._scrollMetrics.contentLength = _this._selectLength({
814
- width,
815
- height
816
- });
817
- var scrollMetrics = _this._convertParentScrollMetrics(_this.context.getScrollMetrics()), metricsChanged = _this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength || _this._scrollMetrics.offset !== scrollMetrics.offset;
818
- metricsChanged && (_this._scrollMetrics.visibleLength = scrollMetrics.visibleLength, _this._scrollMetrics.offset = scrollMetrics.offset, _this._nestedChildLists.forEach(function(childList) {
819
- childList.measureLayoutRelativeToContainingList();
820
- }));
821
- }, function(error) {
822
- console.warn("VirtualizedList: Encountered an error while measuring a list's offset from its containing VirtualizedList.");
823
- });
824
- } catch (error) {
825
- console.warn("measureLayoutRelativeToContainingList threw an error", error.stack);
1014
+ for (var _iterator = allRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
1015
+ var region = _step.value;
1016
+ renderMask.addCells(region);
1017
+ }
1018
+ } catch (err) {
1019
+ _didIteratorError = !0, _iteratorError = err;
1020
+ } finally {
1021
+ try {
1022
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
1023
+ } finally {
1024
+ if (_didIteratorError) throw _iteratorError;
1025
+ }
826
1026
  }
827
- }
828
- },
829
- {
830
- key: "_getFooterCellKey",
831
- value: function() {
832
- return this._getCellKey() + "-footer";
833
- }
834
- },
835
- {
836
- key: "_renderDebugOverlay",
837
- value: function() {
838
- for (var normalize = this._scrollMetrics.visibleLength / (this._scrollMetrics.contentLength || 1), framesInLayout = [], itemCount = this.props.getItemCount(this.props.data), ii = 0; ii < itemCount; ii++) {
839
- var frame = this.__getFrameMetricsApprox(ii, this.props);
840
- frame.inLayout && framesInLayout.push(frame);
1027
+ if (props.initialScrollIndex == null || props.initialScrollIndex <= 0) {
1028
+ var initialRegion = VirtualizedList2._initialRenderRegion(props);
1029
+ renderMask.addCells(initialRegion);
841
1030
  }
842
- var windowTop = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.first, this.props).offset, frameLast = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.last, this.props), windowLen = frameLast.offset + frameLast.length - windowTop, visTop = this._scrollMetrics.offset, visLen = this._scrollMetrics.visibleLength;
843
- return /* @__PURE__ */ _jsxs(View, {
844
- style: [
845
- styles.debugOverlayBase,
846
- styles.debugOverlay
847
- ],
848
- children: [
849
- framesInLayout.map(function(f, ii2) {
850
- return /* @__PURE__ */ _jsx(View, {
851
- style: [
852
- styles.debugOverlayBase,
853
- styles.debugOverlayFrame,
854
- {
855
- top: f.offset * normalize,
856
- height: f.length * normalize
857
- }
858
- ]
859
- }, "f" + ii2);
860
- }),
861
- /* @__PURE__ */ _jsx(View, {
862
- style: [
863
- styles.debugOverlayBase,
864
- styles.debugOverlayFrameLast,
865
- {
866
- top: windowTop * normalize,
867
- height: windowLen * normalize
868
- }
869
- ]
870
- }),
871
- /* @__PURE__ */ _jsx(View, {
872
- style: [
873
- styles.debugOverlayBase,
874
- styles.debugOverlayFrameVis,
875
- {
876
- top: visTop * normalize,
877
- height: visLen * normalize
878
- }
879
- ]
880
- })
881
- ]
1031
+ var stickyIndicesSet = new Set(props.stickyHeaderIndices);
1032
+ VirtualizedList2._ensureClosestStickyHeader(props, stickyIndicesSet, renderMask, cellsAroundViewport.first);
1033
+ }
1034
+ return renderMask;
1035
+ }
1036
+ }, {
1037
+ key: "_initialRenderRegion",
1038
+ value: function (props) {
1039
+ var itemCount = props.getItemCount(props.data),
1040
+ _props_initialScrollIndex,
1041
+ firstCellIndex = Math.max(0, Math.min(itemCount - 1, Math.floor((_props_initialScrollIndex = props.initialScrollIndex) !== null && _props_initialScrollIndex !== void 0 ? _props_initialScrollIndex : 0))),
1042
+ lastCellIndex = Math.min(itemCount, firstCellIndex + initialNumToRenderOrDefault(props.initialNumToRender)) - 1;
1043
+ return {
1044
+ first: firstCellIndex,
1045
+ last: lastCellIndex
1046
+ };
1047
+ }
1048
+ }, {
1049
+ key: "_ensureClosestStickyHeader",
1050
+ value: function (props, stickyIndicesSet, renderMask, cellIdx) {
1051
+ for (var stickyOffset = props.ListHeaderComponent ? 1 : 0, itemIdx = cellIdx - 1; itemIdx >= 0; itemIdx--) if (stickyIndicesSet.has(itemIdx + stickyOffset)) {
1052
+ renderMask.addCells({
1053
+ first: itemIdx,
1054
+ last: itemIdx
882
1055
  });
1056
+ break;
883
1057
  }
1058
+ }
1059
+ }, {
1060
+ key: "getDerivedStateFromProps",
1061
+ value: function (newProps, prevState) {
1062
+ var itemCount = newProps.getItemCount(newProps.data);
1063
+ if (itemCount === prevState.renderMask.numCells()) return prevState;
1064
+ var constrainedCells = VirtualizedList2._constrainToItemCount(prevState.cellsAroundViewport, newProps);
1065
+ return {
1066
+ cellsAroundViewport: constrainedCells,
1067
+ renderMask: VirtualizedList2._createRenderMask(newProps, constrainedCells)
1068
+ };
1069
+ }
1070
+ }, {
1071
+ key: "_constrainToItemCount",
1072
+ value: function (cells, props) {
1073
+ var itemCount = props.getItemCount(props.data),
1074
+ last = Math.min(itemCount - 1, cells.last),
1075
+ maxToRenderPerBatch = maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch);
1076
+ return {
1077
+ first: clamp(0, itemCount - 1 - maxToRenderPerBatch, cells.first),
1078
+ last
1079
+ };
1080
+ }
1081
+ }]), VirtualizedList2;
1082
+ }(StateSafePureComponent);
1083
+ _define_property(VirtualizedList, "contextType", VirtualizedListContext);
1084
+ var styles = StyleSheet.create({
1085
+ verticallyInverted: {
1086
+ transform: "scaleY(-1)"
884
1087
  },
885
- {
886
- key: "_selectLength",
887
- value: function(metrics) {
888
- return horizontalOrDefault(this.props.horizontal) ? metrics.width : metrics.height;
889
- }
1088
+ horizontallyInverted: {
1089
+ transform: "scaleX(-1)"
890
1090
  },
891
- {
892
- key: "_selectOffset",
893
- value: function(metrics) {
894
- return horizontalOrDefault(this.props.horizontal) ? metrics.x : metrics.y;
895
- }
1091
+ debug: {
1092
+ flex: 1
896
1093
  },
897
- {
898
- key: "_maybeCallOnEdgeReached",
899
- value: function() {
900
- var { data, getItemCount, onStartReached, onStartReachedThreshold, onEndReached, onEndReachedThreshold, initialScrollIndex } = this.props, { contentLength, visibleLength, offset } = this._scrollMetrics, distanceFromStart = offset, distanceFromEnd = contentLength - visibleLength - offset;
901
- distanceFromStart < ON_EDGE_REACHED_EPSILON && (distanceFromStart = 0), distanceFromEnd < ON_EDGE_REACHED_EPSILON && (distanceFromEnd = 0);
902
- var DEFAULT_THRESHOLD_PX = 2, startThreshold = onStartReachedThreshold != null ? onStartReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX, endThreshold = onEndReachedThreshold != null ? onEndReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX, isWithinStartThreshold = distanceFromStart <= startThreshold, isWithinEndThreshold = distanceFromEnd <= endThreshold;
903
- onEndReached && this.state.cellsAroundViewport.last === getItemCount(data) - 1 && isWithinEndThreshold && this._scrollMetrics.contentLength !== this._sentEndForContentLength ? (this._sentEndForContentLength = this._scrollMetrics.contentLength, onEndReached({
904
- distanceFromEnd
905
- })) : onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this._scrollMetrics.contentLength !== this._sentStartForContentLength ? (!initialScrollIndex || this._scrollMetrics.timestamp !== 0) && (this._sentStartForContentLength = this._scrollMetrics.contentLength, onStartReached({
906
- distanceFromStart
907
- })) : (this._sentStartForContentLength = isWithinStartThreshold ? this._sentStartForContentLength : 0, this._sentEndForContentLength = isWithinEndThreshold ? this._sentEndForContentLength : 0);
908
- }
1094
+ debugOverlayBase: {
1095
+ position: "absolute",
1096
+ top: 0,
1097
+ right: 0
909
1098
  },
910
- {
911
- key: "_scheduleCellsToRenderUpdate",
912
- value: function() {
913
- var { first, last } = this.state.cellsAroundViewport, { offset, visibleLength, velocity } = this._scrollMetrics, itemCount = this.props.getItemCount(this.props.data), hiPri = !1, onStartReachedThreshold = onStartReachedThresholdOrDefault(this.props.onStartReachedThreshold), onEndReachedThreshold = onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold);
914
- if (first > 0) {
915
- var distTop = offset - this.__getFrameMetricsApprox(first, this.props).offset;
916
- hiPri = distTop < 0 || velocity < -2 && distTop < getScrollingThreshold(onStartReachedThreshold, visibleLength);
917
- }
918
- if (!hiPri && last >= 0 && last < itemCount - 1) {
919
- var distBottom = this.__getFrameMetricsApprox(last, this.props).offset - (offset + visibleLength);
920
- hiPri = distBottom < 0 || velocity > 2 && distBottom < getScrollingThreshold(onEndReachedThreshold, visibleLength);
921
- }
922
- if (hiPri && (this._averageCellLength || this.props.getItemLayout) && !this._hiPriInProgress) {
923
- this._hiPriInProgress = !0, this._updateCellsToRenderBatcher.dispose({
924
- abort: !0
925
- }), this._updateCellsToRender();
926
- return;
927
- } else
928
- this._updateCellsToRenderBatcher.schedule();
929
- }
930
- },
931
- {
932
- key: "_updateViewableItems",
933
- value: function(props, cellsAroundViewport) {
934
- var _this = this;
935
- this._viewabilityTuples.forEach(function(tuple) {
936
- tuple.viewabilityHelper.onUpdate(props, _this._scrollMetrics.offset, _this._scrollMetrics.visibleLength, _this._getFrameMetrics, _this._createViewToken, tuple.onViewableItemsChanged, cellsAroundViewport);
937
- });
938
- }
939
- }
940
- ], [
941
- {
942
- key: "_createRenderMask",
943
- value: function(props, cellsAroundViewport, additionalRegions) {
944
- var itemCount = props.getItemCount(props.data);
945
- invariant(cellsAroundViewport.first >= 0 && cellsAroundViewport.last >= cellsAroundViewport.first - 1 && cellsAroundViewport.last < itemCount, `Invalid cells around viewport "[${cellsAroundViewport.first}, ${cellsAroundViewport.last}]" was passed to VirtualizedList._createRenderMask`);
946
- var renderMask = new CellRenderMask(itemCount);
947
- if (itemCount > 0) {
948
- var allRegions = [
949
- cellsAroundViewport,
950
- ...additionalRegions ?? []
951
- ], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
952
- try {
953
- for (var _iterator = allRegions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
954
- var region = _step.value;
955
- renderMask.addCells(region);
956
- }
957
- } catch (err) {
958
- _didIteratorError = !0, _iteratorError = err;
959
- } finally {
960
- try {
961
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
962
- } finally {
963
- if (_didIteratorError)
964
- throw _iteratorError;
965
- }
966
- }
967
- if (props.initialScrollIndex == null || props.initialScrollIndex <= 0) {
968
- var initialRegion = VirtualizedList2._initialRenderRegion(props);
969
- renderMask.addCells(initialRegion);
970
- }
971
- var stickyIndicesSet = new Set(props.stickyHeaderIndices);
972
- VirtualizedList2._ensureClosestStickyHeader(props, stickyIndicesSet, renderMask, cellsAroundViewport.first);
973
- }
974
- return renderMask;
975
- }
976
- },
977
- {
978
- key: "_initialRenderRegion",
979
- value: function(props) {
980
- var itemCount = props.getItemCount(props.data), _props_initialScrollIndex, firstCellIndex = Math.max(0, Math.min(itemCount - 1, Math.floor((_props_initialScrollIndex = props.initialScrollIndex) !== null && _props_initialScrollIndex !== void 0 ? _props_initialScrollIndex : 0))), lastCellIndex = Math.min(itemCount, firstCellIndex + initialNumToRenderOrDefault(props.initialNumToRender)) - 1;
981
- return {
982
- first: firstCellIndex,
983
- last: lastCellIndex
984
- };
985
- }
1099
+ debugOverlay: {
1100
+ bottom: 0,
1101
+ width: 20,
1102
+ borderColor: "blue",
1103
+ borderWidth: 1
986
1104
  },
987
- {
988
- key: "_ensureClosestStickyHeader",
989
- value: function(props, stickyIndicesSet, renderMask, cellIdx) {
990
- for (var stickyOffset = props.ListHeaderComponent ? 1 : 0, itemIdx = cellIdx - 1; itemIdx >= 0; itemIdx--)
991
- if (stickyIndicesSet.has(itemIdx + stickyOffset)) {
992
- renderMask.addCells({
993
- first: itemIdx,
994
- last: itemIdx
995
- });
996
- break;
997
- }
998
- }
1105
+ debugOverlayFrame: {
1106
+ left: 0,
1107
+ backgroundColor: "orange"
999
1108
  },
1000
- {
1001
- key: "getDerivedStateFromProps",
1002
- value: function(newProps, prevState) {
1003
- var itemCount = newProps.getItemCount(newProps.data);
1004
- if (itemCount === prevState.renderMask.numCells())
1005
- return prevState;
1006
- var constrainedCells = VirtualizedList2._constrainToItemCount(prevState.cellsAroundViewport, newProps);
1007
- return {
1008
- cellsAroundViewport: constrainedCells,
1009
- renderMask: VirtualizedList2._createRenderMask(newProps, constrainedCells)
1010
- };
1011
- }
1109
+ debugOverlayFrameLast: {
1110
+ left: 0,
1111
+ borderColor: "green",
1112
+ borderWidth: 2
1012
1113
  },
1013
- {
1014
- key: "_constrainToItemCount",
1015
- value: function(cells, props) {
1016
- var itemCount = props.getItemCount(props.data), last = Math.min(itemCount - 1, cells.last), maxToRenderPerBatch = maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch);
1017
- return {
1018
- first: clamp(0, itemCount - 1 - maxToRenderPerBatch, cells.first),
1019
- last
1020
- };
1021
- }
1114
+ debugOverlayFrameVis: {
1115
+ left: 0,
1116
+ borderColor: "red",
1117
+ borderWidth: 2
1022
1118
  }
1023
- ]), VirtualizedList2;
1024
- }(StateSafePureComponent);
1025
- _define_property(VirtualizedList, "contextType", VirtualizedListContext);
1026
- var styles = StyleSheet.create({
1027
- verticallyInverted: {
1028
- transform: "scaleY(-1)"
1029
- },
1030
- horizontallyInverted: {
1031
- transform: "scaleX(-1)"
1032
- },
1033
- debug: {
1034
- flex: 1
1035
- },
1036
- debugOverlayBase: {
1037
- position: "absolute",
1038
- top: 0,
1039
- right: 0
1040
- },
1041
- debugOverlay: {
1042
- bottom: 0,
1043
- width: 20,
1044
- borderColor: "blue",
1045
- borderWidth: 1
1046
- },
1047
- debugOverlayFrame: {
1048
- left: 0,
1049
- backgroundColor: "orange"
1050
- },
1051
- debugOverlayFrameLast: {
1052
- left: 0,
1053
- borderColor: "green",
1054
- borderWidth: 2
1055
- },
1056
- debugOverlayFrameVis: {
1057
- left: 0,
1058
- borderColor: "red",
1059
- borderWidth: 2
1060
- }
1061
- }), VirtualizedList_default = VirtualizedList;
1062
- export {
1063
- VirtualizedList_default as default
1064
- };
1065
- //# sourceMappingURL=index.js.map
1119
+ }),
1120
+ VirtualizedList_default = VirtualizedList;
1121
+ export { VirtualizedList_default as default };
1122
+ //# sourceMappingURL=index.native.js.map