@tamagui/react-native-web-lite 1.116.1 → 1.116.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AccessibilityInfo/index.js +96 -0
- package/dist/cjs/ActivityIndicator/__tests__/index-test.js +116 -0
- package/dist/cjs/ActivityIndicator/index.js +108 -0
- package/dist/cjs/Alert/index.js +25 -0
- package/dist/cjs/AppRegistry/AppContainer.js +41 -0
- package/dist/cjs/AppRegistry/__tests__/index-test.js +77 -0
- package/dist/cjs/AppRegistry/__tests__/index-test.node.js +131 -0
- package/dist/cjs/AppRegistry/index.js +98 -0
- package/dist/cjs/AppRegistry/renderApplication.js +51 -0
- package/dist/cjs/AppState/__tests__/index-test.js +33 -0
- package/dist/cjs/AppState/index.js +71 -0
- package/dist/cjs/Appearance/index.js +41 -0
- package/dist/cjs/BackHandler/index.js +32 -0
- package/dist/cjs/Batchinator/index.cjs +68 -0
- package/dist/cjs/Batchinator/index.js +57 -0
- package/dist/cjs/Batchinator/index.js.map +6 -0
- package/dist/cjs/Batchinator/index.native.js +92 -0
- package/dist/cjs/Batchinator/index.native.js.map +6 -0
- package/dist/cjs/Clipboard/index.js +47 -0
- package/dist/cjs/DeviceEmitter.js +29 -0
- package/dist/cjs/DeviceInfo/index.js +62 -0
- package/dist/cjs/Dimensions/__tests__/index-test.js +51 -0
- package/dist/cjs/Dimensions/index.js +74 -0
- package/dist/cjs/FlatList.cjs +196 -0
- package/dist/cjs/FlatList.js +193 -0
- package/dist/cjs/FlatList.js.map +6 -0
- package/dist/cjs/FlatList.native.js +256 -0
- package/dist/cjs/FlatList.native.js.map +6 -0
- package/dist/cjs/I18nManager/index.js +30 -0
- package/dist/cjs/Image/index.js +253 -0
- package/dist/cjs/Image/types.js +14 -0
- package/dist/cjs/ImageBackground/__tests__/index-test.js +48 -0
- package/dist/cjs/ImageBackground/index.js +62 -0
- package/dist/cjs/InteractionManager/TaskQueue.cjs +88 -0
- package/dist/cjs/InteractionManager/TaskQueue.js +76 -0
- package/dist/cjs/InteractionManager/TaskQueue.js.map +6 -0
- package/dist/cjs/InteractionManager/TaskQueue.native.js +134 -0
- package/dist/cjs/InteractionManager/TaskQueue.native.js.map +6 -0
- package/dist/cjs/InteractionManager/index.cjs +114 -0
- package/dist/cjs/InteractionManager/index.js +95 -0
- package/dist/cjs/InteractionManager/index.js.map +6 -0
- package/dist/cjs/InteractionManager/index.native.js +99 -0
- package/dist/cjs/InteractionManager/index.native.js.map +6 -0
- package/dist/cjs/Keyboard/index.js +35 -0
- package/dist/cjs/KeyboardAvoidingView/index.js +56 -0
- package/dist/cjs/Linking/__tests__/index-test.js +38 -0
- package/dist/cjs/Linking/index.js +86 -0
- package/dist/cjs/LogBox/index.js +31 -0
- package/dist/cjs/Modal/ModalAnimation.js +137 -0
- package/dist/cjs/Modal/ModalContent.js +75 -0
- package/dist/cjs/Modal/ModalFocusTrap.js +105 -0
- package/dist/cjs/Modal/ModalPortal.js +43 -0
- package/dist/cjs/Modal/index.js +92 -0
- package/dist/cjs/NativeModules/index.js +25 -0
- package/dist/cjs/PanResponder/index.js +29 -0
- package/dist/cjs/PixelRatio/index.js +60 -0
- package/dist/cjs/Pressable/index.js +140 -0
- package/dist/cjs/RefreshControl/index.js +48 -0
- package/dist/cjs/SafeAreaView/index.js +43 -0
- package/dist/cjs/ScrollView/ScrollViewBase.js +124 -0
- package/dist/cjs/ScrollView/index.js +374 -0
- package/dist/cjs/Share/index.js +56 -0
- package/dist/cjs/StatusBar/index.js +31 -0
- package/dist/cjs/Text/index.js +152 -0
- package/dist/cjs/Text/types.js +14 -0
- package/dist/cjs/TextInput/__tests__/index-test.js +422 -0
- package/dist/cjs/TextInput/index.js +260 -0
- package/dist/cjs/TextInput/types.js +14 -0
- package/dist/cjs/TouchableOpacity.js +123 -0
- package/dist/cjs/TouchableWithoutFeedback.js +90 -0
- package/dist/cjs/UnimplementedView.js +36 -0
- package/dist/cjs/Vibration/index.js +31 -0
- package/dist/cjs/View/index.js +101 -0
- package/dist/cjs/View/types.js +14 -0
- package/dist/cjs/createElement/__tests__/index-test.js +536 -0
- package/dist/cjs/createElement/index.js +37 -0
- package/dist/cjs/createReactDOMStyle.js +21 -0
- package/dist/cjs/findNodeHandle.js +29 -0
- package/dist/cjs/index.cjs +7 -7
- package/dist/cjs/index.js +110 -0
- package/dist/cjs/{index.cjs.map → index.js.map} +1 -1
- package/dist/cjs/index.native.js +6 -6
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/render/index.js +45 -0
- package/dist/cjs/styleTypes.js +14 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/useColorScheme/index.js +39 -0
- package/dist/cjs/useLocaleContext/index.js +21 -0
- package/dist/cjs/useWindowDimensions/index.js +41 -0
- package/dist/cjs/vendor/react-native/Animated/Animated.js +35 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedEvent.js +143 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedImplementation.js +458 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedMock.js +126 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedPlatformConfig.js +2 -0
- package/dist/cjs/vendor/react-native/Animated/Easing.js +189 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedHelper.js +335 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedModule.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedTurboModule.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/SpringConfig.js +70 -0
- package/dist/cjs/vendor/react-native/Animated/animations/Animation.js +64 -0
- package/dist/cjs/vendor/react-native/Animated/animations/DecayAnimation.js +63 -0
- package/dist/cjs/vendor/react-native/Animated/animations/SpringAnimation.js +146 -0
- package/dist/cjs/vendor/react-native/Animated/animations/TimingAnimation.js +82 -0
- package/dist/cjs/vendor/react-native/Animated/bezier.js +72 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedImage.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedScrollView.js +38 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedText.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedView.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/createAnimatedComponent.js +42 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedAddition.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedColor.js +197 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js +60 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDivision.js +58 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedInterpolation.js +175 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedModulo.js +58 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedMultiplication.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedNode.js +136 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedProps.js +112 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedStyle.js +100 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedSubtraction.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTracking.js +76 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTransform.js +100 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValue.js +182 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValueXY.js +167 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedWithChildren.js +67 -0
- package/dist/cjs/vendor/react-native/Animated/useAnimatedProps.js +89 -0
- package/dist/cjs/vendor/react-native/FeatureFlags.js +28 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.cjs +138 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.js +124 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.native.js +158 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.js +29 -0
- package/dist/cjs/vendor/react-native/NativeEventEmitter/index.js +73 -0
- package/dist/cjs/vendor/react-native/PanResponder/index.js +272 -0
- package/dist/cjs/vendor/react-native/TouchHistoryMath/index.js +118 -0
- package/dist/cjs/vendor/react-native/TurboModule/RCTExport.js +2 -0
- package/dist/cjs/vendor/react-native/TurboModule/TurboModuleRegistry.js +28 -0
- package/dist/cjs/vendor/react-native/Types/CoreEventTypes.js +15 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.cjs +29 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.js +24 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.js.map +6 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.native.js +25 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/Utilities/setAndForwardRef.js +29 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.cjs +133 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.js +144 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.js.map +6 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.native.js +199 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.cjs +106 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.js +86 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.native.js +95 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.cjs +81 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.js +84 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.native.js +125 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.cjs +56 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.js +59 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.native.js +153 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.cjs +80 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.js +74 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +163 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.cjs +164 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +149 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +245 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.cjs +84 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.js +72 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +85 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.cjs +16 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.js +14 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +15 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.cjs +1003 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.js +1021 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.native.js +1075 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.cjs +41 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.js +47 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.js.map +6 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.native.js +48 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.native.js.map +6 -0
- package/dist/cjs/vendor/react-native/emitter/EventEmitter.js +30 -0
- package/dist/cjs/vendor/react-native/emitter/EventSubscription.js +2 -0
- package/dist/cjs/vendor/react-native/emitter/_EmitterSubscription.js +55 -0
- package/dist/cjs/vendor/react-native/emitter/_EventEmitter.js +135 -0
- package/dist/cjs/vendor/react-native/emitter/_EventSubscription.js +37 -0
- package/dist/cjs/vendor/react-native/emitter/_EventSubscriptionVendor.js +76 -0
- package/dist/cjs/vendor/react-native/infoLog/index.js +25 -0
- package/dist/cjs/vendor/react-native/useRefEffect.js +30 -0
- package/dist/cjs/without-animated.js +95 -0
- package/dist/esm/Batchinator/index.js +33 -0
- package/dist/esm/Batchinator/index.js.map +6 -0
- package/dist/esm/Batchinator/index.mjs +34 -0
- package/dist/esm/Batchinator/index.mjs.map +1 -0
- package/dist/esm/Batchinator/index.native.js +67 -0
- package/dist/esm/Batchinator/index.native.js.map +6 -0
- package/dist/esm/FlatList.js +176 -0
- package/dist/esm/FlatList.js.map +6 -0
- package/dist/esm/FlatList.mjs +162 -0
- package/dist/esm/FlatList.mjs.map +1 -0
- package/dist/esm/FlatList.native.js +238 -0
- package/dist/esm/FlatList.native.js.map +6 -0
- package/dist/esm/InteractionManager/TaskQueue.js +60 -0
- package/dist/esm/InteractionManager/TaskQueue.js.map +6 -0
- package/dist/esm/InteractionManager/TaskQueue.mjs +65 -0
- package/dist/esm/InteractionManager/TaskQueue.mjs.map +1 -0
- package/dist/esm/InteractionManager/TaskQueue.native.js +117 -0
- package/dist/esm/InteractionManager/TaskQueue.native.js.map +6 -0
- package/dist/esm/InteractionManager/index.js +73 -0
- package/dist/esm/InteractionManager/index.js.map +6 -0
- package/dist/esm/InteractionManager/index.mjs +80 -0
- package/dist/esm/InteractionManager/index.mjs.map +1 -0
- package/dist/esm/InteractionManager/index.native.js +77 -0
- package/dist/esm/InteractionManager/index.native.js.map +6 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/vendor/react-native/FillRateHelper/index.js +108 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.js.map +6 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.mjs +115 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js +141 -0
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.js +8 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.js.map +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.mjs +6 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.mjs.map +1 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js +8 -0
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js.map +6 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.js +128 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.js.map +6 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.mjs +110 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.mjs.map +1 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js +182 -0
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.js +70 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.mjs +80 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js +71 -0
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.js +68 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.mjs +58 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js +104 -0
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.js +43 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.mjs +33 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js +136 -0
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.js +51 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.mjs +46 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +139 -0
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +132 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.mjs +130 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +224 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.js +50 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.mjs +47 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +56 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.js +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.mjs +2 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.js +1016 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.js.map +6 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.mjs +969 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js +1065 -0
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js.map +6 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.js +31 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.js.map +6 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.mjs +18 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.mjs.map +1 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js +31 -0
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js.map +6 -0
- package/package.json +6 -6
- package/src/Batchinator/index.tsx +78 -0
- package/src/FlatList.tsx +330 -0
- package/src/InteractionManager/TaskQueue.tsx +114 -0
- package/src/InteractionManager/index.tsx +139 -0
- package/src/index.tsx +2 -2
- package/src/vendor/react-native/FillRateHelper/index.tsx +218 -0
- package/src/vendor/react-native/Utilities/clamp.ts +21 -0
- package/src/vendor/react-native/ViewabilityHelper.ts +291 -0
- package/src/vendor/react-native/VirtualizeUtils/index.tsx +212 -0
- package/src/vendor/react-native/VirtualizedList/CellRenderMask.ts +147 -0
- package/src/vendor/react-native/VirtualizedList/ChildListCollection.tsx +73 -0
- package/src/vendor/react-native/VirtualizedList/StateSafePureComponent.tsx +79 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.tsx +210 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListContext.tsx +116 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListProps.ts +130 -0
- package/src/vendor/react-native/VirtualizedList/index.tsx +1797 -0
- package/src/vendor/react-native/deepDiffer/index.tsx +56 -0
- package/dist/cjs/PanResponder/Alternative.cjs +0 -198
- package/dist/cjs/PanResponder/Alternative.cjs.map +0 -6
- /package/dist/cjs/AccessibilityInfo/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/ActivityIndicator/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/ActivityIndicator/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Alert/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{AppContainer.cjs.map → AppContainer.js.map} +0 -0
- /package/dist/cjs/AppRegistry/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/AppRegistry/__tests__/{index-test.node.cjs.map → index-test.node.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{renderApplication.cjs.map → renderApplication.js.map} +0 -0
- /package/dist/cjs/AppState/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/AppState/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Appearance/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/BackHandler/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Clipboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{DeviceEmitter.cjs.map → DeviceEmitter.js.map} +0 -0
- /package/dist/cjs/DeviceInfo/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Dimensions/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/Dimensions/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/I18nManager/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Image/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Image/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/ImageBackground/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/ImageBackground/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Keyboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/KeyboardAvoidingView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Linking/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/Linking/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/LogBox/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalAnimation.cjs.map → ModalAnimation.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalContent.cjs.map → ModalContent.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalFocusTrap.cjs.map → ModalFocusTrap.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalPortal.cjs.map → ModalPortal.js.map} +0 -0
- /package/dist/cjs/Modal/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/NativeModules/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/PanResponder/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/PixelRatio/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Pressable/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/RefreshControl/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/SafeAreaView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/ScrollView/{ScrollViewBase.cjs.map → ScrollViewBase.js.map} +0 -0
- /package/dist/cjs/ScrollView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Share/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StatusBar/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Text/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Text/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/TextInput/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/TextInput/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/TextInput/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/{TouchableOpacity.cjs.map → TouchableOpacity.js.map} +0 -0
- /package/dist/cjs/{TouchableWithoutFeedback.cjs.map → TouchableWithoutFeedback.js.map} +0 -0
- /package/dist/cjs/{UnimplementedView.cjs.map → UnimplementedView.js.map} +0 -0
- /package/dist/cjs/Vibration/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/View/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/View/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/createElement/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/createElement/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{createReactDOMStyle.cjs.map → createReactDOMStyle.js.map} +0 -0
- /package/dist/cjs/{findNodeHandle.cjs.map → findNodeHandle.js.map} +0 -0
- /package/dist/cjs/render/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{styleTypes.cjs.map → styleTypes.js.map} +0 -0
- /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/useColorScheme/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/useLocaleContext/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/useWindowDimensions/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{Animated.cjs.map → Animated.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedEvent.cjs.map → AnimatedEvent.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedImplementation.cjs.map → AnimatedImplementation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedMock.cjs.map → AnimatedMock.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedPlatformConfig.cjs.map → AnimatedPlatformConfig.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{Easing.cjs.map → Easing.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedHelper.cjs.map → NativeAnimatedHelper.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedModule.cjs.map → NativeAnimatedModule.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedTurboModule.cjs.map → NativeAnimatedTurboModule.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{SpringConfig.cjs.map → SpringConfig.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{Animation.cjs.map → Animation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{DecayAnimation.cjs.map → DecayAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{SpringAnimation.cjs.map → SpringAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{TimingAnimation.cjs.map → TimingAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{bezier.cjs.map → bezier.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedImage.cjs.map → AnimatedImage.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedScrollView.cjs.map → AnimatedScrollView.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedText.cjs.map → AnimatedText.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedView.cjs.map → AnimatedView.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{createAnimatedComponent.cjs.map → createAnimatedComponent.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedAddition.cjs.map → AnimatedAddition.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedColor.cjs.map → AnimatedColor.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedDiffClamp.cjs.map → AnimatedDiffClamp.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedDivision.cjs.map → AnimatedDivision.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedInterpolation.cjs.map → AnimatedInterpolation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedModulo.cjs.map → AnimatedModulo.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedMultiplication.cjs.map → AnimatedMultiplication.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedNode.cjs.map → AnimatedNode.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedProps.cjs.map → AnimatedProps.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedStyle.cjs.map → AnimatedStyle.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedSubtraction.cjs.map → AnimatedSubtraction.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedTracking.cjs.map → AnimatedTracking.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedTransform.cjs.map → AnimatedTransform.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedValue.cjs.map → AnimatedValue.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedValueXY.cjs.map → AnimatedValueXY.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedWithChildren.cjs.map → AnimatedWithChildren.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{useAnimatedProps.cjs.map → useAnimatedProps.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/{FeatureFlags.cjs.map → FeatureFlags.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/NativeEventEmitter/{RCTDeviceEventEmitter.cjs.map → RCTDeviceEventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/NativeEventEmitter/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/PanResponder/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TouchHistoryMath/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TurboModule/{RCTExport.cjs.map → RCTExport.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TurboModule/{TurboModuleRegistry.cjs.map → TurboModuleRegistry.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Types/{CoreEventTypes.cjs.map → CoreEventTypes.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Utilities/{setAndForwardRef.cjs.map → setAndForwardRef.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{EventEmitter.cjs.map → EventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{EventSubscription.cjs.map → EventSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EmitterSubscription.cjs.map → _EmitterSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventEmitter.cjs.map → _EventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventSubscription.cjs.map → _EventSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventSubscriptionVendor.cjs.map → _EventSubscriptionVendor.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/infoLog/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/{useRefEffect.cjs.map → useRefEffect.js.map} +0 -0
- /package/dist/cjs/{without-animated.cjs.map → without-animated.js.map} +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { invariant } from '@tamagui/react-native-web-internals'
|
|
9
|
+
import type { FrameMetricProps } from './VirtualizedList/VirtualizedListProps'
|
|
10
|
+
|
|
11
|
+
export type ViewToken = {
|
|
12
|
+
item: any
|
|
13
|
+
key: string
|
|
14
|
+
index?: number | null
|
|
15
|
+
isViewable: boolean
|
|
16
|
+
section?: any
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ViewabilityConfigCallbackPair = {
|
|
20
|
+
viewabilityConfig: ViewabilityConfig
|
|
21
|
+
onViewableItemsChanged: (info: {
|
|
22
|
+
viewableItems: ViewToken[]
|
|
23
|
+
changed: ViewToken[]
|
|
24
|
+
}) => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ViewabilityConfig = {
|
|
28
|
+
/**
|
|
29
|
+
* Minimum amount of time (in milliseconds) that an item must be physically viewable before the
|
|
30
|
+
* viewability callback will be fired. A high number means that scrolling through content without
|
|
31
|
+
* stopping will not mark the content as viewable.
|
|
32
|
+
*/
|
|
33
|
+
minimumViewTime?: number
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Percent of viewport that must be covered for a partially occluded item to count as
|
|
37
|
+
* "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
|
|
38
|
+
* that a single pixel in the viewport makes the item viewable, and a value of 100 means that
|
|
39
|
+
* an item must be either entirely visible or cover the entire viewport to count as viewable.
|
|
40
|
+
*/
|
|
41
|
+
viewAreaCoveragePercentThreshold?: number
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Similar to `viewAreaPercentThreshold`, but considers the percent of the item that is visible,
|
|
45
|
+
* rather than the fraction of the viewable area it covers.
|
|
46
|
+
*/
|
|
47
|
+
itemVisiblePercentThreshold?: number
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
|
|
51
|
+
* render.
|
|
52
|
+
*/
|
|
53
|
+
waitForInteraction?: boolean
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A Utility class for calculating viewable items based on current metrics like scroll position and
|
|
58
|
+
* layout.
|
|
59
|
+
*/
|
|
60
|
+
class ViewabilityHelper {
|
|
61
|
+
_config: ViewabilityConfig
|
|
62
|
+
_hasInteracted: boolean = false
|
|
63
|
+
_timers: Set<number> = new Set()
|
|
64
|
+
_viewableIndices: number[] = []
|
|
65
|
+
_viewableItems: Map<string, ViewToken> = new Map()
|
|
66
|
+
|
|
67
|
+
constructor(config: ViewabilityConfig = { viewAreaCoveragePercentThreshold: 0 }) {
|
|
68
|
+
this._config = config
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Cleanup, e.g. on unmount. Clears any pending timers.
|
|
73
|
+
*/
|
|
74
|
+
dispose() {
|
|
75
|
+
this._timers.forEach(clearTimeout)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Determines which items are viewable based on the current metrics and config.
|
|
80
|
+
*/
|
|
81
|
+
computeViewableItems(
|
|
82
|
+
props: FrameMetricProps,
|
|
83
|
+
scrollOffset: number,
|
|
84
|
+
viewportHeight: number,
|
|
85
|
+
getFrameMetrics: (
|
|
86
|
+
index: number,
|
|
87
|
+
props: FrameMetricProps
|
|
88
|
+
) => { length: number; offset: number } | null,
|
|
89
|
+
renderRange?: { first: number; last: number }
|
|
90
|
+
): number[] {
|
|
91
|
+
const itemCount = props.getItemCount(props.data)
|
|
92
|
+
const { itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold } = this._config
|
|
93
|
+
const viewAreaMode = viewAreaCoveragePercentThreshold != null
|
|
94
|
+
const viewablePercentThreshold = viewAreaMode
|
|
95
|
+
? viewAreaCoveragePercentThreshold
|
|
96
|
+
: itemVisiblePercentThreshold
|
|
97
|
+
invariant(
|
|
98
|
+
viewablePercentThreshold != null &&
|
|
99
|
+
(itemVisiblePercentThreshold != null) !==
|
|
100
|
+
(viewAreaCoveragePercentThreshold != null),
|
|
101
|
+
'Must set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold'
|
|
102
|
+
)
|
|
103
|
+
const viewableIndices: number[] = []
|
|
104
|
+
if (itemCount === 0) {
|
|
105
|
+
return viewableIndices
|
|
106
|
+
}
|
|
107
|
+
let firstVisible = -1
|
|
108
|
+
const { first, last } = renderRange || { first: 0, last: itemCount - 1 }
|
|
109
|
+
if (last >= itemCount) {
|
|
110
|
+
console.warn(
|
|
111
|
+
'Invalid render range computing viewability ' +
|
|
112
|
+
JSON.stringify({ renderRange, itemCount })
|
|
113
|
+
)
|
|
114
|
+
return []
|
|
115
|
+
}
|
|
116
|
+
for (let idx = first; idx <= last; idx++) {
|
|
117
|
+
const metrics = getFrameMetrics(idx, props)
|
|
118
|
+
if (!metrics) {
|
|
119
|
+
continue
|
|
120
|
+
}
|
|
121
|
+
const top = metrics.offset - scrollOffset
|
|
122
|
+
const bottom = top + metrics.length
|
|
123
|
+
if (top < viewportHeight && bottom > 0) {
|
|
124
|
+
firstVisible = idx
|
|
125
|
+
if (
|
|
126
|
+
_isViewable(
|
|
127
|
+
viewAreaMode,
|
|
128
|
+
viewablePercentThreshold!,
|
|
129
|
+
top,
|
|
130
|
+
bottom,
|
|
131
|
+
viewportHeight,
|
|
132
|
+
metrics.length
|
|
133
|
+
)
|
|
134
|
+
) {
|
|
135
|
+
viewableIndices.push(idx)
|
|
136
|
+
}
|
|
137
|
+
} else if (firstVisible >= 0) {
|
|
138
|
+
break
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return viewableIndices
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Figures out which items are viewable and how that has changed from before and calls
|
|
146
|
+
* `onViewableItemsChanged` as appropriate.
|
|
147
|
+
*/
|
|
148
|
+
onUpdate(
|
|
149
|
+
props: FrameMetricProps,
|
|
150
|
+
scrollOffset: number,
|
|
151
|
+
viewportHeight: number,
|
|
152
|
+
getFrameMetrics: (
|
|
153
|
+
index: number,
|
|
154
|
+
props: FrameMetricProps
|
|
155
|
+
) => { length: number; offset: number } | null,
|
|
156
|
+
createViewToken: (
|
|
157
|
+
index: number,
|
|
158
|
+
isViewable: boolean,
|
|
159
|
+
props: FrameMetricProps
|
|
160
|
+
) => ViewToken,
|
|
161
|
+
onViewableItemsChanged: (info: {
|
|
162
|
+
viewableItems: ViewToken[]
|
|
163
|
+
changed: ViewToken[]
|
|
164
|
+
}) => void,
|
|
165
|
+
renderRange?: { first: number; last: number }
|
|
166
|
+
): void {
|
|
167
|
+
const itemCount = props.getItemCount(props.data)
|
|
168
|
+
if (
|
|
169
|
+
(this._config.waitForInteraction && !this._hasInteracted) ||
|
|
170
|
+
itemCount === 0 ||
|
|
171
|
+
!getFrameMetrics(0, props)
|
|
172
|
+
) {
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
let viewableIndices: number[] = []
|
|
176
|
+
if (itemCount) {
|
|
177
|
+
viewableIndices = this.computeViewableItems(
|
|
178
|
+
props,
|
|
179
|
+
scrollOffset,
|
|
180
|
+
viewportHeight,
|
|
181
|
+
getFrameMetrics,
|
|
182
|
+
renderRange
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
if (
|
|
186
|
+
this._viewableIndices.length === viewableIndices.length &&
|
|
187
|
+
this._viewableIndices.every((v, ii) => v === viewableIndices[ii])
|
|
188
|
+
) {
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
this._viewableIndices = viewableIndices
|
|
192
|
+
if (this._config.minimumViewTime) {
|
|
193
|
+
const handle = setTimeout(() => {
|
|
194
|
+
this._timers.delete(handle as any)
|
|
195
|
+
this._onUpdateSync(
|
|
196
|
+
props,
|
|
197
|
+
viewableIndices,
|
|
198
|
+
onViewableItemsChanged,
|
|
199
|
+
createViewToken
|
|
200
|
+
)
|
|
201
|
+
}, this._config.minimumViewTime)
|
|
202
|
+
this._timers.add(handle as any)
|
|
203
|
+
} else {
|
|
204
|
+
this._onUpdateSync(props, viewableIndices, onViewableItemsChanged, createViewToken)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
resetViewableIndices() {
|
|
209
|
+
this._viewableIndices = []
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
recordInteraction() {
|
|
213
|
+
this._hasInteracted = true
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
_onUpdateSync(
|
|
217
|
+
props: FrameMetricProps,
|
|
218
|
+
viewableIndicesToCheck: number[],
|
|
219
|
+
onViewableItemsChanged: (info: {
|
|
220
|
+
changed: ViewToken[]
|
|
221
|
+
viewableItems: ViewToken[]
|
|
222
|
+
}) => void,
|
|
223
|
+
createViewToken: (
|
|
224
|
+
index: number,
|
|
225
|
+
isViewable: boolean,
|
|
226
|
+
props: FrameMetricProps
|
|
227
|
+
) => ViewToken
|
|
228
|
+
) {
|
|
229
|
+
viewableIndicesToCheck = viewableIndicesToCheck.filter((ii) =>
|
|
230
|
+
this._viewableIndices.includes(ii)
|
|
231
|
+
)
|
|
232
|
+
const prevItems = this._viewableItems
|
|
233
|
+
const nextItems = new Map(
|
|
234
|
+
viewableIndicesToCheck.map((ii) => {
|
|
235
|
+
const viewable = createViewToken(ii, true, props)
|
|
236
|
+
return [viewable.key, viewable]
|
|
237
|
+
})
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
const changed: ViewToken[] = []
|
|
241
|
+
for (const [key, viewable] of nextItems) {
|
|
242
|
+
if (!prevItems.has(key)) {
|
|
243
|
+
changed.push(viewable)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
for (const [key, viewable] of prevItems) {
|
|
247
|
+
if (!nextItems.has(key)) {
|
|
248
|
+
changed.push({ ...viewable, isViewable: false })
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (changed.length > 0) {
|
|
252
|
+
this._viewableItems = nextItems
|
|
253
|
+
onViewableItemsChanged({
|
|
254
|
+
viewableItems: Array.from(nextItems.values()),
|
|
255
|
+
changed,
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function _isViewable(
|
|
262
|
+
viewAreaMode: boolean,
|
|
263
|
+
viewablePercentThreshold: number,
|
|
264
|
+
top: number,
|
|
265
|
+
bottom: number,
|
|
266
|
+
viewportHeight: number,
|
|
267
|
+
itemLength: number
|
|
268
|
+
): boolean {
|
|
269
|
+
if (_isEntirelyVisible(top, bottom, viewportHeight)) {
|
|
270
|
+
return true
|
|
271
|
+
} else {
|
|
272
|
+
const pixels = _getPixelsVisible(top, bottom, viewportHeight)
|
|
273
|
+
const percent = 100 * (viewAreaMode ? pixels / viewportHeight : pixels / itemLength)
|
|
274
|
+
return percent >= viewablePercentThreshold
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function _getPixelsVisible(top: number, bottom: number, viewportHeight: number): number {
|
|
279
|
+
const visibleHeight = Math.min(bottom, viewportHeight) - Math.max(top, 0)
|
|
280
|
+
return Math.max(0, visibleHeight)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function _isEntirelyVisible(
|
|
284
|
+
top: number,
|
|
285
|
+
bottom: number,
|
|
286
|
+
viewportHeight: number
|
|
287
|
+
): boolean {
|
|
288
|
+
return top >= 0 && bottom <= viewportHeight && bottom > top
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export default ViewabilityHelper
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface FrameMetric {
|
|
9
|
+
length: number
|
|
10
|
+
offset: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ScrollMetrics {
|
|
14
|
+
dt: number
|
|
15
|
+
offset: number
|
|
16
|
+
velocity: number
|
|
17
|
+
visibleLength: number
|
|
18
|
+
zoomScale?: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Range {
|
|
22
|
+
first: number
|
|
23
|
+
last: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FrameMetricProps {
|
|
27
|
+
data: any
|
|
28
|
+
getItemCount: (data: any) => number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Used to find the indices of the frames that overlap the given offsets. Useful for finding the
|
|
33
|
+
* items that bound different windows of content, such as the visible area or the buffered overscan
|
|
34
|
+
* area.
|
|
35
|
+
*/
|
|
36
|
+
export function elementsThatOverlapOffsets(
|
|
37
|
+
offsets: number[],
|
|
38
|
+
props: FrameMetricProps,
|
|
39
|
+
getFrameMetrics: (index: number, props: FrameMetricProps) => FrameMetric,
|
|
40
|
+
zoomScale = 1
|
|
41
|
+
): number[] {
|
|
42
|
+
const itemCount = props.getItemCount(props.data)
|
|
43
|
+
const result: number[] = []
|
|
44
|
+
|
|
45
|
+
for (let offsetIndex = 0; offsetIndex < offsets.length; offsetIndex++) {
|
|
46
|
+
const currentOffset = offsets[offsetIndex]
|
|
47
|
+
let left = 0
|
|
48
|
+
let right = itemCount - 1
|
|
49
|
+
|
|
50
|
+
while (left <= right) {
|
|
51
|
+
const mid = left + ((right - left) >>> 1)
|
|
52
|
+
const frame = getFrameMetrics(mid, props)
|
|
53
|
+
const scaledOffsetStart = frame.offset * zoomScale
|
|
54
|
+
const scaledOffsetEnd = (frame.offset + frame.length) * zoomScale
|
|
55
|
+
|
|
56
|
+
if (
|
|
57
|
+
(mid === 0 && currentOffset < scaledOffsetStart) ||
|
|
58
|
+
(mid !== 0 && currentOffset <= scaledOffsetStart)
|
|
59
|
+
) {
|
|
60
|
+
right = mid - 1
|
|
61
|
+
} else if (currentOffset > scaledOffsetEnd) {
|
|
62
|
+
left = mid + 1
|
|
63
|
+
} else {
|
|
64
|
+
result[offsetIndex] = mid
|
|
65
|
+
break
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return result
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Computes the number of elements in the `next` range that are new compared to the `prev` range.
|
|
75
|
+
* Handy for calculating how many new items will be rendered when the render window changes so we
|
|
76
|
+
* can restrict the number of new items render at once so that content can appear on the screen
|
|
77
|
+
* faster.
|
|
78
|
+
*/
|
|
79
|
+
export function newRangeCount(prev: Range, next: Range): number {
|
|
80
|
+
return (
|
|
81
|
+
next.last -
|
|
82
|
+
next.first +
|
|
83
|
+
1 -
|
|
84
|
+
Math.max(0, 1 + Math.min(next.last, prev.last) - Math.max(next.first, prev.first))
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Custom logic for determining which items should be rendered given the current frame and scroll
|
|
90
|
+
* metrics, as well as the previous render state.
|
|
91
|
+
*/
|
|
92
|
+
export function computeWindowedRenderLimits(
|
|
93
|
+
props: FrameMetricProps,
|
|
94
|
+
maxToRenderPerBatch: number,
|
|
95
|
+
windowSize: number,
|
|
96
|
+
prev: Range,
|
|
97
|
+
getFrameMetricsApprox: (index: number, props: FrameMetricProps) => FrameMetric,
|
|
98
|
+
scrollMetrics: ScrollMetrics
|
|
99
|
+
): Range {
|
|
100
|
+
const itemCount = props.getItemCount(props.data)
|
|
101
|
+
if (itemCount === 0) {
|
|
102
|
+
return { first: 0, last: -1 }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const { offset, velocity, visibleLength, zoomScale = 1 } = scrollMetrics
|
|
106
|
+
|
|
107
|
+
const visibleBegin = Math.max(0, offset)
|
|
108
|
+
const visibleEnd = visibleBegin + visibleLength
|
|
109
|
+
const overscanLength = (windowSize - 1) * visibleLength
|
|
110
|
+
|
|
111
|
+
const leadFactor = 0.5
|
|
112
|
+
const fillPreference = velocity > 1 ? 'after' : velocity < -1 ? 'before' : 'none'
|
|
113
|
+
|
|
114
|
+
const overscanBegin = Math.max(0, visibleBegin - (1 - leadFactor) * overscanLength)
|
|
115
|
+
const overscanEnd = Math.max(0, visibleEnd + leadFactor * overscanLength)
|
|
116
|
+
|
|
117
|
+
const lastItemOffset = getFrameMetricsApprox(itemCount - 1, props).offset * zoomScale
|
|
118
|
+
if (lastItemOffset < overscanBegin) {
|
|
119
|
+
return {
|
|
120
|
+
first: Math.max(0, itemCount - 1 - maxToRenderPerBatch),
|
|
121
|
+
last: itemCount - 1,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let [overscanFirst, first, last, overscanLast] = elementsThatOverlapOffsets(
|
|
126
|
+
[overscanBegin, visibleBegin, visibleEnd, overscanEnd],
|
|
127
|
+
props,
|
|
128
|
+
getFrameMetricsApprox,
|
|
129
|
+
zoomScale
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
overscanFirst = overscanFirst == null ? 0 : overscanFirst
|
|
133
|
+
first = first == null ? Math.max(0, overscanFirst) : first
|
|
134
|
+
overscanLast = overscanLast == null ? itemCount - 1 : overscanLast
|
|
135
|
+
last = last == null ? Math.min(overscanLast, first + maxToRenderPerBatch - 1) : last
|
|
136
|
+
const visible = { first, last }
|
|
137
|
+
|
|
138
|
+
let newCellCount = newRangeCount(prev, visible)
|
|
139
|
+
|
|
140
|
+
while (true) {
|
|
141
|
+
if (first <= overscanFirst && last >= overscanLast) {
|
|
142
|
+
break
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const maxNewCells = newCellCount >= maxToRenderPerBatch
|
|
146
|
+
const firstWillAddMore = first <= prev.first || first > prev.last
|
|
147
|
+
const firstShouldIncrement =
|
|
148
|
+
first > overscanFirst && (!maxNewCells || !firstWillAddMore)
|
|
149
|
+
const lastWillAddMore = last >= prev.last || last < prev.first
|
|
150
|
+
const lastShouldIncrement = last < overscanLast && (!maxNewCells || !lastWillAddMore)
|
|
151
|
+
|
|
152
|
+
if (maxNewCells && !firstShouldIncrement && !lastShouldIncrement) {
|
|
153
|
+
break
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (
|
|
157
|
+
firstShouldIncrement &&
|
|
158
|
+
!(fillPreference === 'after' && lastShouldIncrement && lastWillAddMore)
|
|
159
|
+
) {
|
|
160
|
+
if (firstWillAddMore) {
|
|
161
|
+
newCellCount++
|
|
162
|
+
}
|
|
163
|
+
first--
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (
|
|
167
|
+
lastShouldIncrement &&
|
|
168
|
+
!(fillPreference === 'before' && firstShouldIncrement && firstWillAddMore)
|
|
169
|
+
) {
|
|
170
|
+
if (lastWillAddMore) {
|
|
171
|
+
newCellCount++
|
|
172
|
+
}
|
|
173
|
+
last++
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (
|
|
178
|
+
!(
|
|
179
|
+
last >= first &&
|
|
180
|
+
first >= 0 &&
|
|
181
|
+
last < itemCount &&
|
|
182
|
+
first >= overscanFirst &&
|
|
183
|
+
last <= overscanLast &&
|
|
184
|
+
first <= visible.first &&
|
|
185
|
+
last >= visible.last
|
|
186
|
+
)
|
|
187
|
+
) {
|
|
188
|
+
throw new Error(
|
|
189
|
+
'Bad window calculation ' +
|
|
190
|
+
JSON.stringify({
|
|
191
|
+
first,
|
|
192
|
+
last,
|
|
193
|
+
itemCount,
|
|
194
|
+
overscanFirst,
|
|
195
|
+
overscanLast,
|
|
196
|
+
visible,
|
|
197
|
+
})
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return { first, last }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function keyExtractor(item: any, index: number): string {
|
|
205
|
+
if (typeof item === 'object' && item?.key != null) {
|
|
206
|
+
return item.key
|
|
207
|
+
}
|
|
208
|
+
if (typeof item === 'object' && item?.id != null) {
|
|
209
|
+
return item.id
|
|
210
|
+
}
|
|
211
|
+
return String(index)
|
|
212
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { invariant } from '@tamagui/react-native-web-internals'
|
|
11
|
+
|
|
12
|
+
export type CellRegion = {
|
|
13
|
+
first: number
|
|
14
|
+
last: number
|
|
15
|
+
isSpacer: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class CellRenderMask {
|
|
19
|
+
private _numCells: number
|
|
20
|
+
private _regions: Array<CellRegion>
|
|
21
|
+
|
|
22
|
+
constructor(numCells: number) {
|
|
23
|
+
invariant(numCells >= 0, 'CellRenderMask must contain a non-negative number of cells')
|
|
24
|
+
|
|
25
|
+
this._numCells = numCells
|
|
26
|
+
|
|
27
|
+
if (numCells === 0) {
|
|
28
|
+
this._regions = []
|
|
29
|
+
} else {
|
|
30
|
+
this._regions = [
|
|
31
|
+
{
|
|
32
|
+
first: 0,
|
|
33
|
+
last: numCells - 1,
|
|
34
|
+
isSpacer: true,
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
enumerateRegions(): ReadonlyArray<CellRegion> {
|
|
41
|
+
return this._regions
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
addCells(cells: { first: number; last: number }): void {
|
|
45
|
+
invariant(
|
|
46
|
+
cells.first >= 0 &&
|
|
47
|
+
cells.first < this._numCells &&
|
|
48
|
+
cells.last >= -1 &&
|
|
49
|
+
cells.last < this._numCells &&
|
|
50
|
+
cells.last >= cells.first - 1,
|
|
51
|
+
'CellRenderMask.addCells called with invalid cell range'
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
// VirtualizedList uses inclusive ranges, where zero-count states are
|
|
55
|
+
// possible. E.g. [0, -1] for no cells, starting at 0.
|
|
56
|
+
if (cells.last < cells.first) {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const [firstIntersect, firstIntersectIdx] = this._findRegion(cells.first)
|
|
61
|
+
const [lastIntersect, lastIntersectIdx] = this._findRegion(cells.last)
|
|
62
|
+
|
|
63
|
+
// Fast-path if the cells to add are already all present in the mask. We
|
|
64
|
+
// will otherwise need to do some mutation.
|
|
65
|
+
if (firstIntersectIdx === lastIntersectIdx && !firstIntersect.isSpacer) {
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// We need to replace the existing covered regions with 1-3 new regions
|
|
70
|
+
// depending whether we need to split spacers out of overlapping regions.
|
|
71
|
+
const newLeadRegion: Array<CellRegion> = []
|
|
72
|
+
const newTailRegion: Array<CellRegion> = []
|
|
73
|
+
const newMainRegion: CellRegion = {
|
|
74
|
+
...cells,
|
|
75
|
+
isSpacer: false,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (firstIntersect.first < newMainRegion.first) {
|
|
79
|
+
if (firstIntersect.isSpacer) {
|
|
80
|
+
newLeadRegion.push({
|
|
81
|
+
first: firstIntersect.first,
|
|
82
|
+
last: newMainRegion.first - 1,
|
|
83
|
+
isSpacer: true,
|
|
84
|
+
})
|
|
85
|
+
} else {
|
|
86
|
+
newMainRegion.first = firstIntersect.first
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (lastIntersect.last > newMainRegion.last) {
|
|
91
|
+
if (lastIntersect.isSpacer) {
|
|
92
|
+
newTailRegion.push({
|
|
93
|
+
first: newMainRegion.last + 1,
|
|
94
|
+
last: lastIntersect.last,
|
|
95
|
+
isSpacer: true,
|
|
96
|
+
})
|
|
97
|
+
} else {
|
|
98
|
+
newMainRegion.last = lastIntersect.last
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const replacementRegions: Array<CellRegion> = [
|
|
103
|
+
...newLeadRegion,
|
|
104
|
+
newMainRegion,
|
|
105
|
+
...newTailRegion,
|
|
106
|
+
]
|
|
107
|
+
const numRegionsToDelete = lastIntersectIdx - firstIntersectIdx + 1
|
|
108
|
+
this._regions.splice(firstIntersectIdx, numRegionsToDelete, ...replacementRegions)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
numCells(): number {
|
|
112
|
+
return this._numCells
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
equals(other: CellRenderMask): boolean {
|
|
116
|
+
return (
|
|
117
|
+
this._numCells === other._numCells &&
|
|
118
|
+
this._regions.length === other._regions.length &&
|
|
119
|
+
this._regions.every(
|
|
120
|
+
(region, i) =>
|
|
121
|
+
region.first === other._regions[i].first &&
|
|
122
|
+
region.last === other._regions[i].last &&
|
|
123
|
+
region.isSpacer === other._regions[i].isSpacer
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private _findRegion(cellIdx: number): [CellRegion, number] {
|
|
129
|
+
let firstIdx = 0
|
|
130
|
+
let lastIdx = this._regions.length - 1
|
|
131
|
+
|
|
132
|
+
while (firstIdx <= lastIdx) {
|
|
133
|
+
const middleIdx = Math.floor((firstIdx + lastIdx) / 2)
|
|
134
|
+
const middleRegion = this._regions[middleIdx]
|
|
135
|
+
|
|
136
|
+
if (cellIdx >= middleRegion.first && cellIdx <= middleRegion.last) {
|
|
137
|
+
return [middleRegion, middleIdx]
|
|
138
|
+
} else if (cellIdx < middleRegion.first) {
|
|
139
|
+
lastIdx = middleIdx - 1
|
|
140
|
+
} else if (cellIdx > middleRegion.last) {
|
|
141
|
+
firstIdx = middleIdx + 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
invariant(false, `A region was not found containing cellIdx ${cellIdx}`)
|
|
146
|
+
}
|
|
147
|
+
}
|