@hps1978/react-native-web-tv 0.21.2-tv.0
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/APACHE-2.0.txt +201 -0
- package/LICENSE +22 -0
- package/README.md +164 -0
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/cjs/exports/AccessibilityInfo/index.js +99 -0
- package/dist/cjs/exports/ActivityIndicator/index.js +106 -0
- package/dist/cjs/exports/Alert/index.js +18 -0
- package/dist/cjs/exports/Animated/index.js +18 -0
- package/dist/cjs/exports/AppRegistry/AppContainer.js +47 -0
- package/dist/cjs/exports/AppRegistry/index.js +95 -0
- package/dist/cjs/exports/AppRegistry/renderApplication.js +55 -0
- package/dist/cjs/exports/AppState/index.js +63 -0
- package/dist/cjs/exports/Appearance/index.js +54 -0
- package/dist/cjs/exports/BackHandler/index.js +67 -0
- package/dist/cjs/exports/Button/index.js +70 -0
- package/dist/cjs/exports/CheckBox/index.js +112 -0
- package/dist/cjs/exports/Clipboard/index.js +61 -0
- package/dist/cjs/exports/DeviceEventEmitter/index.js +8 -0
- package/dist/cjs/exports/Dimensions/index.js +128 -0
- package/dist/cjs/exports/Easing/index.js +16 -0
- package/dist/cjs/exports/FlatList/index.js +19 -0
- package/dist/cjs/exports/I18nManager/index.js +30 -0
- package/dist/cjs/exports/Image/index.js +364 -0
- package/dist/cjs/exports/Image/types.js +1 -0
- package/dist/cjs/exports/ImageBackground/index.js +59 -0
- package/dist/cjs/exports/InputAccessoryView/index.js +8 -0
- package/dist/cjs/exports/InteractionManager/TaskQueue.js +93 -0
- package/dist/cjs/exports/InteractionManager/index.js +130 -0
- package/dist/cjs/exports/Keyboard/index.js +34 -0
- package/dist/cjs/exports/KeyboardAvoidingView/index.js +52 -0
- package/dist/cjs/exports/LayoutAnimation/index.js +17 -0
- package/dist/cjs/exports/Linking/index.js +109 -0
- package/dist/cjs/exports/LogBox/index.js +21 -0
- package/dist/cjs/exports/Modal/ModalAnimation.js +149 -0
- package/dist/cjs/exports/Modal/ModalContent.js +75 -0
- package/dist/cjs/exports/Modal/ModalFocusTrap.js +138 -0
- package/dist/cjs/exports/Modal/ModalPortal.js +43 -0
- package/dist/cjs/exports/Modal/index.js +106 -0
- package/dist/cjs/exports/NativeEventEmitter/index.js +16 -0
- package/dist/cjs/exports/NativeModules/index.js +21 -0
- package/dist/cjs/exports/PanResponder/Alternative.js +273 -0
- package/dist/cjs/exports/PanResponder/index.js +8 -0
- package/dist/cjs/exports/Picker/PickerItem.js +32 -0
- package/dist/cjs/exports/Picker/index.js +73 -0
- package/dist/cjs/exports/PixelRatio/index.js +55 -0
- package/dist/cjs/exports/Platform/index.js +31 -0
- package/dist/cjs/exports/Pressable/index.js +163 -0
- package/dist/cjs/exports/ProgressBar/index.js +81 -0
- package/dist/cjs/exports/RefreshControl/index.js +34 -0
- package/dist/cjs/exports/SafeAreaView/index.js +47 -0
- package/dist/cjs/exports/ScrollView/ScrollViewBase.js +153 -0
- package/dist/cjs/exports/ScrollView/index.js +637 -0
- package/dist/cjs/exports/ScrollView/types.js +1 -0
- package/dist/cjs/exports/SectionList/index.js +18 -0
- package/dist/cjs/exports/Share/index.js +53 -0
- package/dist/cjs/exports/StatusBar/index.js +24 -0
- package/dist/cjs/exports/StyleSheet/compiler/createReactDOMStyle.js +183 -0
- package/dist/cjs/exports/StyleSheet/compiler/hash.js +52 -0
- package/dist/cjs/exports/StyleSheet/compiler/hyphenateStyleName.js +28 -0
- package/dist/cjs/exports/StyleSheet/compiler/index.js +483 -0
- package/dist/cjs/exports/StyleSheet/compiler/normalizeColor.js +36 -0
- package/dist/cjs/exports/StyleSheet/compiler/normalizeValueWithProperty.js +38 -0
- package/dist/cjs/exports/StyleSheet/compiler/resolveShadowValue.js +38 -0
- package/dist/cjs/exports/StyleSheet/compiler/unitlessNumbers.js +80 -0
- package/dist/cjs/exports/StyleSheet/dom/createCSSStyleSheet.js +42 -0
- package/dist/cjs/exports/StyleSheet/dom/createOrderedCSSStyleSheet.js +168 -0
- package/dist/cjs/exports/StyleSheet/dom/index.js +78 -0
- package/dist/cjs/exports/StyleSheet/index.js +190 -0
- package/dist/cjs/exports/StyleSheet/preprocess.js +222 -0
- package/dist/cjs/exports/StyleSheet/validate.js +89 -0
- package/dist/cjs/exports/Switch/index.js +194 -0
- package/dist/cjs/exports/TV/NativeTVNavigationEventEmitter.js +109 -0
- package/dist/cjs/exports/TV/TVEventControl.js +47 -0
- package/dist/cjs/exports/TV/TVEventHandler.js +41 -0
- package/dist/cjs/exports/TV/TVFocusEventHandler.js +36 -0
- package/dist/cjs/exports/TV/TVFocusGuideView.js +106 -0
- package/dist/cjs/exports/TV/TVTextScrollView.js +113 -0
- package/dist/cjs/exports/TV/tagForComponentOrHandle.js +44 -0
- package/dist/cjs/exports/TV/types.js +16 -0
- package/dist/cjs/exports/TV/useTVEventHandler.js +20 -0
- package/dist/cjs/exports/TV/utils.js +26 -0
- package/dist/cjs/exports/Text/TextAncestorContext.js +18 -0
- package/dist/cjs/exports/Text/index.js +199 -0
- package/dist/cjs/exports/Text/types.js +1 -0
- package/dist/cjs/exports/TextInput/index.js +443 -0
- package/dist/cjs/exports/TextInput/types.js +1 -0
- package/dist/cjs/exports/Touchable/BoundingDimensions.js +35 -0
- package/dist/cjs/exports/Touchable/Position.js +27 -0
- package/dist/cjs/exports/Touchable/ensurePositiveDelayProps.js +20 -0
- package/dist/cjs/exports/Touchable/index.js +839 -0
- package/dist/cjs/exports/TouchableHighlight/index.js +154 -0
- package/dist/cjs/exports/TouchableNativeFeedback/index.js +16 -0
- package/dist/cjs/exports/TouchableOpacity/index.js +123 -0
- package/dist/cjs/exports/TouchableWithoutFeedback/index.js +78 -0
- package/dist/cjs/exports/UIManager/index.js +133 -0
- package/dist/cjs/exports/Vibration/index.js +32 -0
- package/dist/cjs/exports/View/index.js +177 -0
- package/dist/cjs/exports/View/types.js +1 -0
- package/dist/cjs/exports/VirtualizedList/index.js +18 -0
- package/dist/cjs/exports/YellowBox/index.js +23 -0
- package/dist/cjs/exports/createElement/index.js +39 -0
- package/dist/cjs/exports/findNodeHandle/index.js +19 -0
- package/dist/cjs/exports/processColor/index.js +31 -0
- package/dist/cjs/exports/render/index.js +27 -0
- package/dist/cjs/exports/unmountComponentAtNode/index.js +18 -0
- package/dist/cjs/exports/useColorScheme/index.js +34 -0
- package/dist/cjs/exports/useLocaleContext/index.js +17 -0
- package/dist/cjs/exports/useWindowDimensions/index.js +41 -0
- package/dist/cjs/index.js +137 -0
- package/dist/cjs/modules/AccessibilityUtil/index.js +24 -0
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.js +16 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.js +60 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.js +41 -0
- package/dist/cjs/modules/AssetRegistry/index.js +23 -0
- package/dist/cjs/modules/ImageLoader/index.js +149 -0
- package/dist/cjs/modules/SpatialManager/index.js +464 -0
- package/dist/cjs/modules/SpatialManager/mutationObserver.js +112 -0
- package/dist/cjs/modules/SpatialManager/scrollHandler.js +581 -0
- package/dist/cjs/modules/SpatialManager/utils.js +417 -0
- package/dist/cjs/modules/TextInputState/index.js +65 -0
- package/dist/cjs/modules/UnimplementedView/index.js +35 -0
- package/dist/cjs/modules/addEventListener/index.js +75 -0
- package/dist/cjs/modules/canUseDom/index.js +16 -0
- package/dist/cjs/modules/createDOMProps/index.js +896 -0
- package/dist/cjs/modules/dismissKeyboard/index.js +20 -0
- package/dist/cjs/modules/forwardedProps/index.js +188 -0
- package/dist/cjs/modules/getBoundingClientRect/index.js +23 -0
- package/dist/cjs/modules/isSelectionValid/index.js +22 -0
- package/dist/cjs/modules/isWebColor/index.js +16 -0
- package/dist/cjs/modules/mergeRefs/index.js +37 -0
- package/dist/cjs/modules/modality/index.js +196 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/index.js +29 -0
- package/dist/cjs/modules/normalizeColor/index.js +36 -0
- package/dist/cjs/modules/pick/index.js +25 -0
- package/dist/cjs/modules/prefixStyles/index.js +19 -0
- package/dist/cjs/modules/prefixStyles/static.js +74 -0
- package/dist/cjs/modules/requestIdleCallback/index.js +33 -0
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.js +49 -0
- package/dist/cjs/modules/setValueForStyles/index.js +45 -0
- package/dist/cjs/modules/unitlessNumbers/index.js +80 -0
- package/dist/cjs/modules/useElementLayout/index.js +91 -0
- package/dist/cjs/modules/useEvent/index.js +54 -0
- package/dist/cjs/modules/useHover/index.js +158 -0
- package/dist/cjs/modules/useLayoutEffect/index.js +22 -0
- package/dist/cjs/modules/useLocale/index.js +42 -0
- package/dist/cjs/modules/useLocale/isLocaleRTL.js +87 -0
- package/dist/cjs/modules/useMergeRefs/index.js +26 -0
- package/dist/cjs/modules/usePlatformMethods/index.js +34 -0
- package/dist/cjs/modules/usePressEvents/PressResponder.js +496 -0
- package/dist/cjs/modules/usePressEvents/index.js +40 -0
- package/dist/cjs/modules/useResponderEvents/ResponderEventTypes.js +51 -0
- package/dist/cjs/modules/useResponderEvents/ResponderSystem.js +598 -0
- package/dist/cjs/modules/useResponderEvents/ResponderTouchHistoryStore.js +175 -0
- package/dist/cjs/modules/useResponderEvents/createResponderEvent.js +152 -0
- package/dist/cjs/modules/useResponderEvents/index.js +79 -0
- package/dist/cjs/modules/useResponderEvents/utils.js +175 -0
- package/dist/cjs/modules/useStable/index.js +25 -0
- package/dist/cjs/modules/warnOnce/index.js +31 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/styles.js +1 -0
- package/dist/cjs/vendor/hash/index.js +52 -0
- package/dist/cjs/vendor/react-native/Animated/Animated.js +35 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedEvent.js +167 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedImplementation.js +582 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedMock.js +140 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedPlatformConfig.js +11 -0
- package/dist/cjs/vendor/react-native/Animated/Easing.js +253 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedHelper.js +480 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedModule.js +19 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedTurboModule.js +19 -0
- package/dist/cjs/vendor/react-native/Animated/SpringConfig.js +72 -0
- package/dist/cjs/vendor/react-native/Animated/animations/Animation.js +59 -0
- package/dist/cjs/vendor/react-native/Animated/animations/DecayAnimation.js +74 -0
- package/dist/cjs/vendor/react-native/Animated/animations/SpringAnimation.js +226 -0
- package/dist/cjs/vendor/react-native/Animated/animations/TimingAnimation.js +120 -0
- package/dist/cjs/vendor/react-native/Animated/bezier.js +125 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedFlatList.js +30 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedImage.js +20 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedScrollView.js +30 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedSectionList.js +30 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedText.js +20 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedView.js +20 -0
- package/dist/cjs/vendor/react-native/Animated/createAnimatedComponent.js +52 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedAddition.js +53 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedColor.js +288 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDivision.js +70 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedInterpolation.js +269 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedModulo.js +50 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedMultiplication.js +53 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedNode.js +163 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedProps.js +145 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedStyle.js +128 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedSubtraction.js +53 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTracking.js +76 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTransform.js +113 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValue.js +271 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValueXY.js +191 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedWithChildren.js +77 -0
- package/dist/cjs/vendor/react-native/Animated/useAnimatedProps.js +158 -0
- package/dist/cjs/vendor/react-native/Batchinator/index.js +82 -0
- package/dist/cjs/vendor/react-native/EventEmitter/NativeEventEmitter.js +85 -0
- package/dist/cjs/vendor/react-native/EventEmitter/RCTDeviceEventEmitter.js +24 -0
- package/dist/cjs/vendor/react-native/FillRateHelper/index.js +196 -0
- package/dist/cjs/vendor/react-native/FlatList/index.js +452 -0
- package/dist/cjs/vendor/react-native/JSEventLoopWatchdog/index.js +90 -0
- package/dist/cjs/vendor/react-native/LayoutAnimation/index.js +112 -0
- package/dist/cjs/vendor/react-native/PanResponder/index.js +420 -0
- package/dist/cjs/vendor/react-native/PooledClass/index.js +64 -0
- package/dist/cjs/vendor/react-native/ReactNative/ReactNativeFeatureFlags.js +23 -0
- package/dist/cjs/vendor/react-native/SectionList/index.js +150 -0
- package/dist/cjs/vendor/react-native/StaticContainer/index.js +43 -0
- package/dist/cjs/vendor/react-native/StaticRenderer/index.js +26 -0
- package/dist/cjs/vendor/react-native/TouchHistoryMath/index.js +105 -0
- package/dist/cjs/vendor/react-native/TurboModule/RCTExport.js +29 -0
- package/dist/cjs/vendor/react-native/TurboModule/TurboModuleRegistry.js +25 -0
- package/dist/cjs/vendor/react-native/Types/CoreEventTypes.js +11 -0
- package/dist/cjs/vendor/react-native/Utilities/Platform.js +8 -0
- package/dist/cjs/vendor/react-native/Utilities/clamp.js +25 -0
- package/dist/cjs/vendor/react-native/Utilities/setAndForwardRef.js +64 -0
- package/dist/cjs/vendor/react-native/Utilities/useMergeRefs.js +43 -0
- package/dist/cjs/vendor/react-native/Utilities/useRefEffect.js +42 -0
- package/dist/cjs/vendor/react-native/ViewabilityHelper/index.js +210 -0
- package/dist/cjs/vendor/react-native/VirtualizeUtils/index.js +180 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/CellRenderMask.js +112 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/ChildListCollection.js +75 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/StateSafePureComponent.js +77 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +159 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListContext.js +73 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListProps.js +6 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/VirtualizedListRLVAdapter.js +951 -0
- package/dist/cjs/vendor/react-native/VirtualizedList/index.js +1506 -0
- package/dist/cjs/vendor/react-native/VirtualizedSectionList/index.js +388 -0
- package/dist/cjs/vendor/react-native/deepDiffer/index.js +73 -0
- package/dist/cjs/vendor/react-native/infoLog/index.js +22 -0
- package/dist/cjs/vendor/react-native/vendor/emitter/EventEmitter.js +104 -0
- package/dist/exports/AccessibilityInfo/index.js +94 -0
- package/dist/exports/AccessibilityInfo/index.js.flow +76 -0
- package/dist/exports/ActivityIndicator/index.js +100 -0
- package/dist/exports/ActivityIndicator/index.js.flow +88 -0
- package/dist/exports/Alert/index.js +13 -0
- package/dist/exports/Alert/index.js.flow +12 -0
- package/dist/exports/Animated/index.js +13 -0
- package/dist/exports/Animated/index.js.flow +13 -0
- package/dist/exports/AppRegistry/AppContainer.js +40 -0
- package/dist/exports/AppRegistry/AppContainer.js.flow +43 -0
- package/dist/exports/AppRegistry/index.js +88 -0
- package/dist/exports/AppRegistry/index.js.flow +59 -0
- package/dist/exports/AppRegistry/renderApplication.js +48 -0
- package/dist/exports/AppRegistry/renderApplication.js.flow +28 -0
- package/dist/exports/AppState/index.js +58 -0
- package/dist/exports/AppState/index.js.flow +31 -0
- package/dist/exports/Appearance/index.js +49 -0
- package/dist/exports/Appearance/index.js.flow +50 -0
- package/dist/exports/BackHandler/index.js +63 -0
- package/dist/exports/BackHandler/index.js.flow +77 -0
- package/dist/exports/Button/index.js +63 -0
- package/dist/exports/Button/index.js.flow +67 -0
- package/dist/exports/CheckBox/index.js +106 -0
- package/dist/exports/CheckBox/index.js.flow +108 -0
- package/dist/exports/Clipboard/index.js +56 -0
- package/dist/exports/Clipboard/index.js.flow +18 -0
- package/dist/exports/DeviceEventEmitter/index.js +2 -0
- package/dist/exports/Dimensions/index.js +122 -0
- package/dist/exports/Dimensions/index.js.flow +58 -0
- package/dist/exports/Easing/index.js +11 -0
- package/dist/exports/Easing/index.js.flow +11 -0
- package/dist/exports/FlatList/index.js +14 -0
- package/dist/exports/FlatList/index.js.flow +14 -0
- package/dist/exports/I18nManager/index.js +25 -0
- package/dist/exports/I18nManager/index.js.flow +34 -0
- package/dist/exports/Image/index.js +358 -0
- package/dist/exports/Image/index.js.flow +225 -0
- package/dist/exports/Image/types.js +0 -0
- package/dist/exports/Image/types.js.flow +94 -0
- package/dist/exports/ImageBackground/index.js +53 -0
- package/dist/exports/ImageBackground/index.js.flow +57 -0
- package/dist/exports/InputAccessoryView/index.js +2 -0
- package/dist/exports/InteractionManager/TaskQueue.js +87 -0
- package/dist/exports/InteractionManager/TaskQueue.js.flow +40 -0
- package/dist/exports/InteractionManager/index.js +124 -0
- package/dist/exports/InteractionManager/index.js.flow +99 -0
- package/dist/exports/Keyboard/index.js +29 -0
- package/dist/exports/Keyboard/index.js.flow +31 -0
- package/dist/exports/KeyboardAvoidingView/index.js +46 -0
- package/dist/exports/KeyboardAvoidingView/index.js.flow +30 -0
- package/dist/exports/LayoutAnimation/index.js +12 -0
- package/dist/exports/LayoutAnimation/index.js.flow +12 -0
- package/dist/exports/Linking/index.js +103 -0
- package/dist/exports/Linking/index.js.flow +30 -0
- package/dist/exports/LogBox/index.js +16 -0
- package/dist/exports/LogBox/index.js.flow +16 -0
- package/dist/exports/Modal/ModalAnimation.js +142 -0
- package/dist/exports/Modal/ModalAnimation.js.flow +94 -0
- package/dist/exports/Modal/ModalContent.js +69 -0
- package/dist/exports/Modal/ModalContent.js.flow +64 -0
- package/dist/exports/Modal/ModalFocusTrap.js +132 -0
- package/dist/exports/Modal/ModalFocusTrap.js.flow +39 -0
- package/dist/exports/Modal/ModalPortal.js +36 -0
- package/dist/exports/Modal/ModalPortal.js.flow +18 -0
- package/dist/exports/Modal/index.js +100 -0
- package/dist/exports/Modal/index.js.flow +83 -0
- package/dist/exports/NativeEventEmitter/index.js +11 -0
- package/dist/exports/NativeEventEmitter/index.js.flow +11 -0
- package/dist/exports/NativeModules/index.js +16 -0
- package/dist/exports/NativeModules/index.js.flow +16 -0
- package/dist/exports/PanResponder/Alternative.js +269 -0
- package/dist/exports/PanResponder/Alternative.js.flow +335 -0
- package/dist/exports/PanResponder/index.js +2 -0
- package/dist/exports/PanResponder/index.js.flow +4 -0
- package/dist/exports/Picker/PickerItem.js +26 -0
- package/dist/exports/Picker/PickerItem.js.flow +19 -0
- package/dist/exports/Picker/index.js +67 -0
- package/dist/exports/Picker/index.js.flow +74 -0
- package/dist/exports/PixelRatio/index.js +49 -0
- package/dist/exports/PixelRatio/index.js.flow +21 -0
- package/dist/exports/Platform/index.js +26 -0
- package/dist/exports/Platform/index.js.flow +26 -0
- package/dist/exports/Pressable/index.js +157 -0
- package/dist/exports/Pressable/index.js.flow +84 -0
- package/dist/exports/ProgressBar/index.js +75 -0
- package/dist/exports/ProgressBar/index.js.flow +72 -0
- package/dist/exports/RefreshControl/index.js +29 -0
- package/dist/exports/RefreshControl/index.js.flow +30 -0
- package/dist/exports/SafeAreaView/index.js +41 -0
- package/dist/exports/SafeAreaView/index.js.flow +38 -0
- package/dist/exports/ScrollView/ScrollViewBase.js +147 -0
- package/dist/exports/ScrollView/ScrollViewBase.js.flow +76 -0
- package/dist/exports/ScrollView/index.js +632 -0
- package/dist/exports/ScrollView/index.js.flow +126 -0
- package/dist/exports/ScrollView/types.js +0 -0
- package/dist/exports/ScrollView/types.js.flow +25 -0
- package/dist/exports/SectionList/index.js +13 -0
- package/dist/exports/SectionList/index.js.flow +13 -0
- package/dist/exports/Share/index.js +47 -0
- package/dist/exports/Share/index.js.flow +26 -0
- package/dist/exports/StatusBar/index.js +19 -0
- package/dist/exports/StatusBar/index.js.flow +16 -0
- package/dist/exports/StyleSheet/compiler/createReactDOMStyle.js +177 -0
- package/dist/exports/StyleSheet/compiler/createReactDOMStyle.js.flow +84 -0
- package/dist/exports/StyleSheet/compiler/hash.js +47 -0
- package/dist/exports/StyleSheet/compiler/hash.js.flow +18 -0
- package/dist/exports/StyleSheet/compiler/hyphenateStyleName.js +23 -0
- package/dist/exports/StyleSheet/compiler/hyphenateStyleName.js.flow +15 -0
- package/dist/exports/StyleSheet/compiler/index.js +476 -0
- package/dist/exports/StyleSheet/compiler/index.js.flow +180 -0
- package/dist/exports/StyleSheet/compiler/normalizeColor.js +30 -0
- package/dist/exports/StyleSheet/compiler/normalizeColor.js.flow +13 -0
- package/dist/exports/StyleSheet/compiler/normalizeValueWithProperty.js +32 -0
- package/dist/exports/StyleSheet/compiler/normalizeValueWithProperty.js.flow +24 -0
- package/dist/exports/StyleSheet/compiler/resolveShadowValue.js +32 -0
- package/dist/exports/StyleSheet/compiler/resolveShadowValue.js.flow +17 -0
- package/dist/exports/StyleSheet/compiler/unitlessNumbers.js +75 -0
- package/dist/exports/StyleSheet/compiler/unitlessNumbers.js.flow +73 -0
- package/dist/exports/StyleSheet/dom/createCSSStyleSheet.js +36 -0
- package/dist/exports/StyleSheet/dom/createCSSStyleSheet.js.flow +12 -0
- package/dist/exports/StyleSheet/dom/createOrderedCSSStyleSheet.js +163 -0
- package/dist/exports/StyleSheet/dom/createOrderedCSSStyleSheet.js.flow +52 -0
- package/dist/exports/StyleSheet/dom/index.js +73 -0
- package/dist/exports/StyleSheet/dom/index.js.flow +26 -0
- package/dist/exports/StyleSheet/index.js +185 -0
- package/dist/exports/StyleSheet/index.js.flow +97 -0
- package/dist/exports/StyleSheet/preprocess.js +212 -0
- package/dist/exports/StyleSheet/preprocess.js.flow +73 -0
- package/dist/exports/StyleSheet/validate.js +84 -0
- package/dist/exports/StyleSheet/validate.js.flow +46 -0
- package/dist/exports/Switch/index.js +188 -0
- package/dist/exports/Switch/index.js.flow +187 -0
- package/dist/exports/TV/NativeTVNavigationEventEmitter.js +103 -0
- package/dist/exports/TV/NativeTVNavigationEventEmitter.js.flow +89 -0
- package/dist/exports/TV/TVEventControl.js +44 -0
- package/dist/exports/TV/TVEventControl.js.flow +44 -0
- package/dist/exports/TV/TVEventHandler.js +37 -0
- package/dist/exports/TV/TVEventHandler.js.flow +59 -0
- package/dist/exports/TV/TVFocusEventHandler.js +33 -0
- package/dist/exports/TV/TVFocusEventHandler.js.flow +24 -0
- package/dist/exports/TV/TVFocusGuideView.js +98 -0
- package/dist/exports/TV/TVFocusGuideView.js.flow +121 -0
- package/dist/exports/TV/TVTextScrollView.js +106 -0
- package/dist/exports/TV/TVTextScrollView.js.flow +78 -0
- package/dist/exports/TV/tagForComponentOrHandle.js +39 -0
- package/dist/exports/TV/tagForComponentOrHandle.js.flow +16 -0
- package/dist/exports/TV/types.js +16 -0
- package/dist/exports/TV/types.js.flow +133 -0
- package/dist/exports/TV/useTVEventHandler.js +13 -0
- package/dist/exports/TV/useTVEventHandler.js.flow +10 -0
- package/dist/exports/TV/utils.js +23 -0
- package/dist/exports/TV/utils.js.flow +14 -0
- package/dist/exports/Text/TextAncestorContext.js +14 -0
- package/dist/exports/Text/TextAncestorContext.js.flow +15 -0
- package/dist/exports/Text/index.js +193 -0
- package/dist/exports/Text/index.js.flow +198 -0
- package/dist/exports/Text/types.js +0 -0
- package/dist/exports/Text/types.js.flow +65 -0
- package/dist/exports/TextInput/index.js +437 -0
- package/dist/exports/TextInput/index.js.flow +333 -0
- package/dist/exports/TextInput/types.js +0 -0
- package/dist/exports/TextInput/types.js.flow +65 -0
- package/dist/exports/Touchable/BoundingDimensions.js +29 -0
- package/dist/exports/Touchable/BoundingDimensions.js.flow +26 -0
- package/dist/exports/Touchable/Position.js +21 -0
- package/dist/exports/Touchable/Position.js.flow +18 -0
- package/dist/exports/Touchable/ensurePositiveDelayProps.js +14 -0
- package/dist/exports/Touchable/ensurePositiveDelayProps.js.flow +12 -0
- package/dist/exports/Touchable/index.js +835 -0
- package/dist/exports/Touchable/index.js.flow +849 -0
- package/dist/exports/TouchableHighlight/index.js +148 -0
- package/dist/exports/TouchableHighlight/index.js.flow +67 -0
- package/dist/exports/TouchableNativeFeedback/index.js +11 -0
- package/dist/exports/TouchableNativeFeedback/index.js.flow +11 -0
- package/dist/exports/TouchableOpacity/index.js +117 -0
- package/dist/exports/TouchableOpacity/index.js.flow +50 -0
- package/dist/exports/TouchableWithoutFeedback/index.js +72 -0
- package/dist/exports/TouchableWithoutFeedback/index.js.flow +65 -0
- package/dist/exports/UIManager/index.js +127 -0
- package/dist/exports/UIManager/index.js.flow +92 -0
- package/dist/exports/Vibration/index.js +27 -0
- package/dist/exports/Vibration/index.js.flow +21 -0
- package/dist/exports/View/index.js +171 -0
- package/dist/exports/View/index.js.flow +176 -0
- package/dist/exports/View/types.js +0 -0
- package/dist/exports/View/types.js.flow +225 -0
- package/dist/exports/VirtualizedList/index.js +13 -0
- package/dist/exports/VirtualizedList/index.js.flow +13 -0
- package/dist/exports/YellowBox/index.js +17 -0
- package/dist/exports/YellowBox/index.js.flow +16 -0
- package/dist/exports/createElement/index.js +34 -0
- package/dist/exports/createElement/index.js.flow +17 -0
- package/dist/exports/findNodeHandle/index.js +14 -0
- package/dist/exports/findNodeHandle/index.js.flow +11 -0
- package/dist/exports/processColor/index.js +25 -0
- package/dist/exports/processColor/index.js.flow +13 -0
- package/dist/exports/render/index.js +23 -0
- package/dist/exports/render/index.js.flow +15 -0
- package/dist/exports/unmountComponentAtNode/index.js +13 -0
- package/dist/exports/unmountComponentAtNode/index.js.flow +9 -0
- package/dist/exports/useColorScheme/index.js +28 -0
- package/dist/exports/useColorScheme/index.js.flow +16 -0
- package/dist/exports/useLocaleContext/index.js +13 -0
- package/dist/exports/useLocaleContext/index.js.flow +13 -0
- package/dist/exports/useWindowDimensions/index.js +36 -0
- package/dist/exports/useWindowDimensions/index.js.flow +16 -0
- package/dist/index.js +77 -0
- package/dist/index.js.flow +79 -0
- package/dist/modules/AccessibilityUtil/index.js +18 -0
- package/dist/modules/AccessibilityUtil/index.js.flow +18 -0
- package/dist/modules/AccessibilityUtil/isDisabled.js +11 -0
- package/dist/modules/AccessibilityUtil/isDisabled.js.flow +10 -0
- package/dist/modules/AccessibilityUtil/propsToAccessibilityComponent.js +54 -0
- package/dist/modules/AccessibilityUtil/propsToAccessibilityComponent.js.flow +34 -0
- package/dist/modules/AccessibilityUtil/propsToAriaRole.js +36 -0
- package/dist/modules/AccessibilityUtil/propsToAriaRole.js.flow +28 -0
- package/dist/modules/AssetRegistry/index.js +18 -0
- package/dist/modules/AssetRegistry/index.js.flow +23 -0
- package/dist/modules/ImageLoader/index.js +144 -0
- package/dist/modules/ImageLoader/index.js.flow +84 -0
- package/dist/modules/SpatialManager/index.js +460 -0
- package/dist/modules/SpatialManager/index.js.flow +66 -0
- package/dist/modules/SpatialManager/mutationObserver.js +105 -0
- package/dist/modules/SpatialManager/mutationObserver.js.flow +30 -0
- package/dist/modules/SpatialManager/scrollHandler.js +571 -0
- package/dist/modules/SpatialManager/scrollHandler.js.flow +90 -0
- package/dist/modules/SpatialManager/utils.js +405 -0
- package/dist/modules/SpatialManager/utils.js.flow +147 -0
- package/dist/modules/TextInputState/index.js +60 -0
- package/dist/modules/TextInputState/index.js.flow +60 -0
- package/dist/modules/UnimplementedView/index.js +31 -0
- package/dist/modules/UnimplementedView/index.js.flow +23 -0
- package/dist/modules/addEventListener/index.js +72 -0
- package/dist/modules/addEventListener/index.js.flow +34 -0
- package/dist/modules/canUseDom/index.js +11 -0
- package/dist/modules/canUseDom/index.js.flow +11 -0
- package/dist/modules/createDOMProps/index.js +891 -0
- package/dist/modules/createDOMProps/index.js.flow +36 -0
- package/dist/modules/dismissKeyboard/index.js +14 -0
- package/dist/modules/dismissKeyboard/index.js.flow +12 -0
- package/dist/modules/forwardedProps/index.js +184 -0
- package/dist/modules/forwardedProps/index.js.flow +184 -0
- package/dist/modules/getBoundingClientRect/index.js +18 -0
- package/dist/modules/getBoundingClientRect/index.js.flow +10 -0
- package/dist/modules/isSelectionValid/index.js +17 -0
- package/dist/modules/isSelectionValid/index.js.flow +9 -0
- package/dist/modules/isWebColor/index.js +11 -0
- package/dist/modules/isWebColor/index.js.flow +10 -0
- package/dist/modules/mergeRefs/index.js +31 -0
- package/dist/modules/mergeRefs/index.js.flow +11 -0
- package/dist/modules/modality/index.js +188 -0
- package/dist/modules/modality/index.js.flow +79 -0
- package/dist/modules/multiplyStyleLengthValue/index.js +24 -0
- package/dist/modules/multiplyStyleLengthValue/index.js.flow +14 -0
- package/dist/modules/normalizeColor/index.js +30 -0
- package/dist/modules/normalizeColor/index.js.flow +13 -0
- package/dist/modules/pick/index.js +20 -0
- package/dist/modules/pick/index.js.flow +11 -0
- package/dist/modules/prefixStyles/index.js +13 -0
- package/dist/modules/prefixStyles/index.js.flow +14 -0
- package/dist/modules/prefixStyles/static.js +68 -0
- package/dist/modules/requestIdleCallback/index.js +28 -0
- package/dist/modules/requestIdleCallback/index.js.flow +28 -0
- package/dist/modules/setValueForStyles/dangerousStyleValue.js +44 -0
- package/dist/modules/setValueForStyles/dangerousStyleValue.js.flow +25 -0
- package/dist/modules/setValueForStyles/index.js +40 -0
- package/dist/modules/setValueForStyles/index.js.flow +23 -0
- package/dist/modules/unitlessNumbers/index.js +75 -0
- package/dist/modules/unitlessNumbers/index.js.flow +73 -0
- package/dist/modules/useElementLayout/index.js +85 -0
- package/dist/modules/useElementLayout/index.js.flow +19 -0
- package/dist/modules/useEvent/index.js +48 -0
- package/dist/modules/useEvent/index.js.flow +29 -0
- package/dist/modules/useHover/index.js +153 -0
- package/dist/modules/useHover/index.js.flow +46 -0
- package/dist/modules/useLayoutEffect/index.js +16 -0
- package/dist/modules/useLayoutEffect/index.js.flow +16 -0
- package/dist/modules/useLocale/index.js +35 -0
- package/dist/modules/useLocale/index.js.flow +32 -0
- package/dist/modules/useLocale/isLocaleRTL.js +83 -0
- package/dist/modules/useLocale/isLocaleRTL.js.flow +58 -0
- package/dist/modules/useMergeRefs/index.js +19 -0
- package/dist/modules/useMergeRefs/index.js.flow +12 -0
- package/dist/modules/usePlatformMethods/index.js +29 -0
- package/dist/modules/usePlatformMethods/index.js.flow +22 -0
- package/dist/modules/usePressEvents/PressResponder.js +492 -0
- package/dist/modules/usePressEvents/PressResponder.js.flow +216 -0
- package/dist/modules/usePressEvents/index.js +36 -0
- package/dist/modules/usePressEvents/index.js.flow +16 -0
- package/dist/modules/useResponderEvents/ResponderEventTypes.js +41 -0
- package/dist/modules/useResponderEvents/ResponderEventTypes.js.flow +61 -0
- package/dist/modules/useResponderEvents/ResponderSystem.js +590 -0
- package/dist/modules/useResponderEvents/ResponderSystem.js.flow +269 -0
- package/dist/modules/useResponderEvents/ResponderTouchHistoryStore.js +170 -0
- package/dist/modules/useResponderEvents/ResponderTouchHistoryStore.js.flow +56 -0
- package/dist/modules/useResponderEvents/createResponderEvent.js +146 -0
- package/dist/modules/useResponderEvents/createResponderEvent.js.flow +51 -0
- package/dist/modules/useResponderEvents/index.js +73 -0
- package/dist/modules/useResponderEvents/index.js.flow +26 -0
- package/dist/modules/useResponderEvents/utils.js +165 -0
- package/dist/modules/useResponderEvents/utils.js.flow +46 -0
- package/dist/modules/useStable/index.js +19 -0
- package/dist/modules/useStable/index.js.flow +12 -0
- package/dist/modules/warnOnce/index.js +27 -0
- package/dist/modules/warnOnce/index.js.flow +22 -0
- package/dist/types/index.js +0 -0
- package/dist/types/index.js.flow +46 -0
- package/dist/types/styles.js +0 -0
- package/dist/types/styles.js.flow +279 -0
- package/dist/vendor/hash/index.js +47 -0
- package/dist/vendor/hash/index.js.flow +18 -0
- package/dist/vendor/react-native/Animated/Animated.js +29 -0
- package/dist/vendor/react-native/Animated/Animated.js.flow +35 -0
- package/dist/vendor/react-native/Animated/AnimatedEvent.js +162 -0
- package/dist/vendor/react-native/Animated/AnimatedEvent.js.flow +46 -0
- package/dist/vendor/react-native/Animated/AnimatedImplementation.js +579 -0
- package/dist/vendor/react-native/Animated/AnimatedImplementation.js.flow +605 -0
- package/dist/vendor/react-native/Animated/AnimatedMock.js +137 -0
- package/dist/vendor/react-native/Animated/AnimatedMock.js.flow +139 -0
- package/dist/vendor/react-native/Animated/AnimatedPlatformConfig.js +11 -0
- package/dist/vendor/react-native/Animated/AnimatedPlatformConfig.js.flow +13 -0
- package/dist/vendor/react-native/Animated/Easing.js +249 -0
- package/dist/vendor/react-native/Animated/Easing.js.flow +80 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedHelper.js +460 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedHelper.js.flow +396 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedModule.js +16 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedModule.js.flow +56 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedTurboModule.js +16 -0
- package/dist/vendor/react-native/Animated/NativeAnimatedTurboModule.js.flow +53 -0
- package/dist/vendor/react-native/Animated/SpringConfig.js +69 -0
- package/dist/vendor/react-native/Animated/SpringConfig.js.flow +25 -0
- package/dist/vendor/react-native/Animated/animations/Animation.js +55 -0
- package/dist/vendor/react-native/Animated/animations/Animation.js.flow +45 -0
- package/dist/vendor/react-native/Animated/animations/DecayAnimation.js +70 -0
- package/dist/vendor/react-native/Animated/animations/DecayAnimation.js.flow +51 -0
- package/dist/vendor/react-native/Animated/animations/SpringAnimation.js +222 -0
- package/dist/vendor/react-native/Animated/animations/SpringAnimation.js.flow +110 -0
- package/dist/vendor/react-native/Animated/animations/TimingAnimation.js +116 -0
- package/dist/vendor/react-native/Animated/animations/TimingAnimation.js.flow +61 -0
- package/dist/vendor/react-native/Animated/bezier.js +122 -0
- package/dist/vendor/react-native/Animated/bezier.js.flow +35 -0
- package/dist/vendor/react-native/Animated/components/AnimatedFlatList.js +23 -0
- package/dist/vendor/react-native/Animated/components/AnimatedFlatList.js.flow +20 -0
- package/dist/vendor/react-native/Animated/components/AnimatedImage.js +14 -0
- package/dist/vendor/react-native/Animated/components/AnimatedImage.js.flow +15 -0
- package/dist/vendor/react-native/Animated/components/AnimatedScrollView.js +23 -0
- package/dist/vendor/react-native/Animated/components/AnimatedScrollView.js.flow +20 -0
- package/dist/vendor/react-native/Animated/components/AnimatedSectionList.js +23 -0
- package/dist/vendor/react-native/Animated/components/AnimatedSectionList.js.flow +20 -0
- package/dist/vendor/react-native/Animated/components/AnimatedText.js +14 -0
- package/dist/vendor/react-native/Animated/components/AnimatedText.js.flow +15 -0
- package/dist/vendor/react-native/Animated/components/AnimatedView.js +14 -0
- package/dist/vendor/react-native/Animated/components/AnimatedView.js.flow +15 -0
- package/dist/vendor/react-native/Animated/createAnimatedComponent.js +46 -0
- package/dist/vendor/react-native/Animated/createAnimatedComponent.js.flow +27 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedAddition.js +49 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedAddition.js.flow +30 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedColor.js +283 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedColor.js.flow +83 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js +53 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js.flow +32 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedDivision.js +66 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedDivision.js.flow +31 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedInterpolation.js +265 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedInterpolation.js.flow +69 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedModulo.js +46 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedModulo.js.flow +29 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedMultiplication.js +49 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedMultiplication.js.flow +30 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedNode.js +159 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedNode.js.flow +58 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedProps.js +141 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedProps.js.flow +35 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedStyle.js +124 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedStyle.js.flow +33 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedSubtraction.js +49 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedSubtraction.js.flow +30 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedTracking.js +72 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedTracking.js.flow +32 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedTransform.js +109 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedTransform.js.flow +26 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedValue.js +267 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedValue.js.flow +86 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedValueXY.js +187 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedValueXY.js.flow +84 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedWithChildren.js +73 -0
- package/dist/vendor/react-native/Animated/nodes/AnimatedWithChildren.js.flow +25 -0
- package/dist/vendor/react-native/Animated/useAnimatedProps.js +154 -0
- package/dist/vendor/react-native/Animated/useAnimatedProps.js.flow +37 -0
- package/dist/vendor/react-native/Batchinator/index.js +79 -0
- package/dist/vendor/react-native/Batchinator/index.js.flow +51 -0
- package/dist/vendor/react-native/EventEmitter/NativeEventEmitter.js +80 -0
- package/dist/vendor/react-native/EventEmitter/NativeEventEmitter.js.flow +42 -0
- package/dist/vendor/react-native/EventEmitter/RCTDeviceEventEmitter.js +21 -0
- package/dist/vendor/react-native/EventEmitter/RCTDeviceEventEmitter.js.flow +22 -0
- package/dist/vendor/react-native/FillRateHelper/index.js +192 -0
- package/dist/vendor/react-native/FillRateHelper/index.js.flow +80 -0
- package/dist/vendor/react-native/FlatList/index.js +446 -0
- package/dist/vendor/react-native/FlatList/index.js.flow +345 -0
- package/dist/vendor/react-native/JSEventLoopWatchdog/index.js +86 -0
- package/dist/vendor/react-native/JSEventLoopWatchdog/index.js.flow +75 -0
- package/dist/vendor/react-native/LayoutAnimation/index.js +108 -0
- package/dist/vendor/react-native/LayoutAnimation/index.js.flow +105 -0
- package/dist/vendor/react-native/PanResponder/index.js +416 -0
- package/dist/vendor/react-native/PanResponder/index.js.flow +496 -0
- package/dist/vendor/react-native/PooledClass/index.js +58 -0
- package/dist/vendor/react-native/ReactNative/ReactNativeFeatureFlags.js +20 -0
- package/dist/vendor/react-native/ReactNative/ReactNativeFeatureFlags.js.flow +49 -0
- package/dist/vendor/react-native/SectionList/index.js +144 -0
- package/dist/vendor/react-native/SectionList/index.js.flow +165 -0
- package/dist/vendor/react-native/StaticContainer/index.js +40 -0
- package/dist/vendor/react-native/StaticContainer/index.js.flow +45 -0
- package/dist/vendor/react-native/StaticRenderer/index.js +22 -0
- package/dist/vendor/react-native/StaticRenderer/index.js.flow +29 -0
- package/dist/vendor/react-native/TouchHistoryMath/index.js +100 -0
- package/dist/vendor/react-native/TurboModule/RCTExport.js +29 -0
- package/dist/vendor/react-native/TurboModule/RCTExport.js.flow +35 -0
- package/dist/vendor/react-native/TurboModule/TurboModuleRegistry.js +21 -0
- package/dist/vendor/react-native/TurboModule/TurboModuleRegistry.js.flow +16 -0
- package/dist/vendor/react-native/Types/CoreEventTypes.js +11 -0
- package/dist/vendor/react-native/Types/CoreEventTypes.js.flow +264 -0
- package/dist/vendor/react-native/Utilities/Platform.js +2 -0
- package/dist/vendor/react-native/Utilities/clamp.js +22 -0
- package/dist/vendor/react-native/Utilities/clamp.js.flow +14 -0
- package/dist/vendor/react-native/Utilities/setAndForwardRef.js +61 -0
- package/dist/vendor/react-native/Utilities/setAndForwardRef.js.flow +50 -0
- package/dist/vendor/react-native/Utilities/useMergeRefs.js +38 -0
- package/dist/vendor/react-native/Utilities/useMergeRefs.js.flow +28 -0
- package/dist/vendor/react-native/Utilities/useRefEffect.js +37 -0
- package/dist/vendor/react-native/Utilities/useRefEffect.js.flow +28 -0
- package/dist/vendor/react-native/ViewabilityHelper/index.js +206 -0
- package/dist/vendor/react-native/ViewabilityHelper/index.js.flow +111 -0
- package/dist/vendor/react-native/VirtualizeUtils/index.js +175 -0
- package/dist/vendor/react-native/VirtualizeUtils/index.js.flow +64 -0
- package/dist/vendor/react-native/VirtualizedList/CellRenderMask.js +106 -0
- package/dist/vendor/react-native/VirtualizedList/CellRenderMask.js.flow +29 -0
- package/dist/vendor/react-native/VirtualizedList/ChildListCollection.js +68 -0
- package/dist/vendor/react-native/VirtualizedList/ChildListCollection.js.flow +21 -0
- package/dist/vendor/react-native/VirtualizedList/StateSafePureComponent.js +70 -0
- package/dist/vendor/react-native/VirtualizedList/StateSafePureComponent.js.flow +28 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +151 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js.flow +68 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListContext.js +64 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListContext.js.flow +61 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListProps.js +16 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListProps.js.flow +308 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListRLVAdapter.js +946 -0
- package/dist/vendor/react-native/VirtualizedList/VirtualizedListRLVAdapter.js.flow +172 -0
- package/dist/vendor/react-native/VirtualizedList/index.js +1498 -0
- package/dist/vendor/react-native/VirtualizedList/index.js.flow +307 -0
- package/dist/vendor/react-native/VirtualizedSectionList/index.js +382 -0
- package/dist/vendor/react-native/VirtualizedSectionList/index.js.flow +191 -0
- package/dist/vendor/react-native/deepDiffer/index.js +70 -0
- package/dist/vendor/react-native/deepDiffer/index.js.flow +67 -0
- package/dist/vendor/react-native/infoLog/index.js +19 -0
- package/dist/vendor/react-native/infoLog/index.js.flow +17 -0
- package/dist/vendor/react-native/vendor/emitter/EventEmitter.js +98 -0
- package/dist/vendor/react-native/vendor/emitter/EventEmitter.js.flow +54 -0
- package/package.json +60 -0
- package/src/exports/AccessibilityInfo/index.js +118 -0
- package/src/exports/ActivityIndicator/index.js +119 -0
- package/src/exports/Alert/index.js +14 -0
- package/src/exports/Animated/index.js +13 -0
- package/src/exports/AppRegistry/AppContainer.js +55 -0
- package/src/exports/AppRegistry/index.js +153 -0
- package/src/exports/AppRegistry/renderApplication.js +72 -0
- package/src/exports/AppState/index.js +81 -0
- package/src/exports/Appearance/index.js +65 -0
- package/src/exports/BackHandler/index.js +108 -0
- package/src/exports/Button/index.js +90 -0
- package/src/exports/CheckBox/index.js +143 -0
- package/src/exports/Clipboard/index.js +63 -0
- package/src/exports/DeviceEventEmitter/index.js +2 -0
- package/src/exports/Dimensions/index.js +160 -0
- package/src/exports/Easing/index.js +11 -0
- package/src/exports/FlatList/index.js +14 -0
- package/src/exports/I18nManager/index.js +35 -0
- package/src/exports/Image/index.js +443 -0
- package/src/exports/Image/types.js +103 -0
- package/src/exports/ImageBackground/index.js +73 -0
- package/src/exports/InputAccessoryView/index.js +2 -0
- package/src/exports/InteractionManager/TaskQueue.js +115 -0
- package/src/exports/InteractionManager/index.js +142 -0
- package/src/exports/Keyboard/index.js +28 -0
- package/src/exports/KeyboardAvoidingView/index.js +59 -0
- package/src/exports/LayoutAnimation/index.js +12 -0
- package/src/exports/Linking/index.js +124 -0
- package/src/exports/LogBox/index.js +17 -0
- package/src/exports/Modal/ModalAnimation.js +164 -0
- package/src/exports/Modal/ModalContent.js +87 -0
- package/src/exports/Modal/ModalFocusTrap.js +173 -0
- package/src/exports/Modal/ModalPortal.js +48 -0
- package/src/exports/Modal/index.js +151 -0
- package/src/exports/NativeEventEmitter/index.js +11 -0
- package/src/exports/NativeModules/index.js +17 -0
- package/src/exports/PanResponder/Alternative.js +408 -0
- package/src/exports/PanResponder/index.js +4 -0
- package/src/exports/Picker/PickerItem.js +26 -0
- package/src/exports/Picker/index.js +95 -0
- package/src/exports/PixelRatio/index.js +49 -0
- package/src/exports/Platform/index.js +26 -0
- package/src/exports/Pressable/index.js +253 -0
- package/src/exports/ProgressBar/index.js +92 -0
- package/src/exports/RefreshControl/index.js +52 -0
- package/src/exports/SafeAreaView/index.js +49 -0
- package/src/exports/ScrollView/ScrollViewBase.js +186 -0
- package/src/exports/ScrollView/index.js +768 -0
- package/src/exports/ScrollView/types.js +26 -0
- package/src/exports/SectionList/index.js +13 -0
- package/src/exports/Share/index.js +65 -0
- package/src/exports/StatusBar/index.js +22 -0
- package/src/exports/StyleSheet/compiler/createReactDOMStyle.js +214 -0
- package/src/exports/StyleSheet/compiler/hash.js +67 -0
- package/src/exports/StyleSheet/compiler/hyphenateStyleName.js +27 -0
- package/src/exports/StyleSheet/compiler/index.js +518 -0
- package/src/exports/StyleSheet/compiler/normalizeColor.js +34 -0
- package/src/exports/StyleSheet/compiler/normalizeValueWithProperty.js +40 -0
- package/src/exports/StyleSheet/compiler/resolveShadowValue.js +32 -0
- package/src/exports/StyleSheet/compiler/unitlessNumbers.js +76 -0
- package/src/exports/StyleSheet/dom/createCSSStyleSheet.js +40 -0
- package/src/exports/StyleSheet/dom/createOrderedCSSStyleSheet.js +184 -0
- package/src/exports/StyleSheet/dom/index.js +90 -0
- package/src/exports/StyleSheet/index.js +197 -0
- package/src/exports/StyleSheet/preprocess.js +255 -0
- package/src/exports/StyleSheet/validate.js +93 -0
- package/src/exports/Switch/index.js +236 -0
- package/src/exports/TV/NativeTVNavigationEventEmitter.js +141 -0
- package/src/exports/TV/TVEventControl.js +56 -0
- package/src/exports/TV/TVEventHandler.js +58 -0
- package/src/exports/TV/TVFocusEventHandler.js +43 -0
- package/src/exports/TV/TVFocusGuideView.js +162 -0
- package/src/exports/TV/TVParallaxProperties.d.ts +42 -0
- package/src/exports/TV/TVTextScrollView.js +159 -0
- package/src/exports/TV/tagForComponentOrHandle.js +46 -0
- package/src/exports/TV/types.js +153 -0
- package/src/exports/TV/useTVEventHandler.js +24 -0
- package/src/exports/TV/utils.js +24 -0
- package/src/exports/Text/TextAncestorContext.js +17 -0
- package/src/exports/Text/index.js +241 -0
- package/src/exports/Text/types.js +121 -0
- package/src/exports/TextInput/index.js +503 -0
- package/src/exports/TextInput/types.js +97 -0
- package/src/exports/Touchable/BoundingDimensions.js +37 -0
- package/src/exports/Touchable/Position.js +26 -0
- package/src/exports/Touchable/ensurePositiveDelayProps.js +23 -0
- package/src/exports/Touchable/index.js +1026 -0
- package/src/exports/TouchableHighlight/index.js +218 -0
- package/src/exports/TouchableNativeFeedback/index.js +11 -0
- package/src/exports/TouchableOpacity/index.js +172 -0
- package/src/exports/TouchableWithoutFeedback/index.js +135 -0
- package/src/exports/UIManager/index.js +132 -0
- package/src/exports/Vibration/index.js +28 -0
- package/src/exports/View/index.js +218 -0
- package/src/exports/View/types.js +250 -0
- package/src/exports/VirtualizedList/index.js +13 -0
- package/src/exports/YellowBox/index.js +22 -0
- package/src/exports/createElement/index.js +43 -0
- package/src/exports/findNodeHandle/index.js +18 -0
- package/src/exports/processColor/index.js +29 -0
- package/src/exports/render/index.js +29 -0
- package/src/exports/unmountComponentAtNode/index.js +13 -0
- package/src/exports/useColorScheme/index.js +31 -0
- package/src/exports/useLocaleContext/index.js +13 -0
- package/src/exports/useWindowDimensions/index.js +36 -0
- package/src/index.js +79 -0
- package/src/modules/AccessibilityUtil/index.js +20 -0
- package/src/modules/AccessibilityUtil/isDisabled.js +15 -0
- package/src/modules/AccessibilityUtil/propsToAccessibilityComponent.js +58 -0
- package/src/modules/AccessibilityUtil/propsToAriaRole.js +42 -0
- package/src/modules/AssetRegistry/index.js +32 -0
- package/src/modules/ImageLoader/index.js +167 -0
- package/src/modules/SpatialManager/README.md +122 -0
- package/src/modules/SpatialManager/index.js +582 -0
- package/src/modules/SpatialManager/mutationObserver.js +119 -0
- package/src/modules/SpatialManager/scrollHandler.js +898 -0
- package/src/modules/SpatialManager/utils.js +529 -0
- package/src/modules/TextInputState/index.js +64 -0
- package/src/modules/UnimplementedView/index.js +31 -0
- package/src/modules/addEventListener/index.js +89 -0
- package/src/modules/canUseDom/index.js +16 -0
- package/src/modules/createDOMProps/index.js +979 -0
- package/src/modules/dismissKeyboard/index.js +16 -0
- package/src/modules/forwardedProps/index.js +189 -0
- package/src/modules/getBoundingClientRect/index.js +19 -0
- package/src/modules/isSelectionValid/index.js +19 -0
- package/src/modules/isWebColor/index.js +16 -0
- package/src/modules/mergeRefs/index.js +35 -0
- package/src/modules/modality/index.js +215 -0
- package/src/modules/multiplyStyleLengthValue/index.js +28 -0
- package/src/modules/normalizeColor/index.js +34 -0
- package/src/modules/pick/index.js +20 -0
- package/src/modules/prefixStyles/index.js +17 -0
- package/src/modules/prefixStyles/static.js +69 -0
- package/src/modules/requestIdleCallback/index.js +38 -0
- package/src/modules/setValueForStyles/dangerousStyleValue.js +52 -0
- package/src/modules/setValueForStyles/index.js +45 -0
- package/src/modules/unitlessNumbers/index.js +76 -0
- package/src/modules/useElementLayout/index.js +95 -0
- package/src/modules/useEvent/index.js +70 -0
- package/src/modules/useHover/index.js +197 -0
- package/src/modules/useLayoutEffect/index.js +20 -0
- package/src/modules/useLocale/index.js +60 -0
- package/src/modules/useLocale/isLocaleRTL.js +81 -0
- package/src/modules/useMergeRefs/index.js +21 -0
- package/src/modules/usePlatformMethods/index.js +39 -0
- package/src/modules/usePressEvents/PressResponder.js +625 -0
- package/src/modules/usePressEvents/index.js +44 -0
- package/src/modules/useResponderEvents/README.md +209 -0
- package/src/modules/useResponderEvents/ResponderEventTypes.js +83 -0
- package/src/modules/useResponderEvents/ResponderSystem.js +688 -0
- package/src/modules/useResponderEvents/ResponderTouchHistoryStore.js +219 -0
- package/src/modules/useResponderEvents/createResponderEvent.js +206 -0
- package/src/modules/useResponderEvents/index.js +91 -0
- package/src/modules/useResponderEvents/utils.js +179 -0
- package/src/modules/useStable/index.js +24 -0
- package/src/modules/warnOnce/index.js +29 -0
- package/src/types/index.js +76 -0
- package/src/types/styles.js +346 -0
- package/src/vendor/hash/index.js +60 -0
- package/src/vendor/react-native/Animated/Animated.js +41 -0
- package/src/vendor/react-native/Animated/AnimatedEvent.js +232 -0
- package/src/vendor/react-native/Animated/AnimatedImplementation.js +757 -0
- package/src/vendor/react-native/Animated/AnimatedMock.js +197 -0
- package/src/vendor/react-native/Animated/AnimatedPlatformConfig.js +13 -0
- package/src/vendor/react-native/Animated/Easing.js +253 -0
- package/src/vendor/react-native/Animated/NativeAnimatedHelper.js +603 -0
- package/src/vendor/react-native/Animated/NativeAnimatedModule.js +72 -0
- package/src/vendor/react-native/Animated/NativeAnimatedTurboModule.js +70 -0
- package/src/vendor/react-native/Animated/SpringConfig.js +103 -0
- package/src/vendor/react-native/Animated/animations/Animation.js +89 -0
- package/src/vendor/react-native/Animated/animations/DecayAnimation.js +120 -0
- package/src/vendor/react-native/Animated/animations/SpringAnimation.js +376 -0
- package/src/vendor/react-native/Animated/animations/TimingAnimation.js +177 -0
- package/src/vendor/react-native/Animated/bezier.js +153 -0
- package/src/vendor/react-native/Animated/components/AnimatedFlatList.js +30 -0
- package/src/vendor/react-native/Animated/components/AnimatedImage.js +23 -0
- package/src/vendor/react-native/Animated/components/AnimatedScrollView.js +30 -0
- package/src/vendor/react-native/Animated/components/AnimatedSectionList.js +30 -0
- package/src/vendor/react-native/Animated/components/AnimatedText.js +23 -0
- package/src/vendor/react-native/Animated/components/AnimatedView.js +21 -0
- package/src/vendor/react-native/Animated/createAnimatedComponent.js +65 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedAddition.js +67 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedColor.js +359 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js +75 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedDivision.js +82 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedInterpolation.js +375 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedModulo.js +66 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedMultiplication.js +66 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedNode.js +197 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedProps.js +171 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedStyle.js +143 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedSubtraction.js +66 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedTracking.js +102 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedTransform.js +121 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedValue.js +306 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedValueXY.js +226 -0
- package/src/vendor/react-native/Animated/nodes/AnimatedWithChildren.js +90 -0
- package/src/vendor/react-native/Animated/useAnimatedProps.js +188 -0
- package/src/vendor/react-native/Batchinator/index.js +76 -0
- package/src/vendor/react-native/EventEmitter/NativeEventEmitter.js +116 -0
- package/src/vendor/react-native/EventEmitter/RCTDeviceEventEmitter.js +22 -0
- package/src/vendor/react-native/FillRateHelper/index.js +253 -0
- package/src/vendor/react-native/FlatList/index.js +710 -0
- package/src/vendor/react-native/JSEventLoopWatchdog/index.js +87 -0
- package/src/vendor/react-native/LayoutAnimation/index.js +142 -0
- package/src/vendor/react-native/PanResponder/index.js +613 -0
- package/src/vendor/react-native/PooledClass/index.js +63 -0
- package/src/vendor/react-native/ReactNative/ReactNativeFeatureFlags.js +51 -0
- package/src/vendor/react-native/SHA +2 -0
- package/src/vendor/react-native/SectionList/index.js +254 -0
- package/src/vendor/react-native/StaticContainer/index.js +54 -0
- package/src/vendor/react-native/StaticRenderer/index.js +37 -0
- package/src/vendor/react-native/TouchHistoryMath/index.js +153 -0
- package/src/vendor/react-native/TurboModule/RCTExport.js +35 -0
- package/src/vendor/react-native/TurboModule/TurboModuleRegistry.js +28 -0
- package/src/vendor/react-native/Types/CoreEventTypes.js +291 -0
- package/src/vendor/react-native/Utilities/Platform.js +2 -0
- package/src/vendor/react-native/Utilities/clamp.js +23 -0
- package/src/vendor/react-native/Utilities/setAndForwardRef.js +71 -0
- package/src/vendor/react-native/Utilities/useMergeRefs.js +44 -0
- package/src/vendor/react-native/Utilities/useRefEffect.js +45 -0
- package/src/vendor/react-native/ViewabilityHelper/index.js +360 -0
- package/src/vendor/react-native/VirtualizeUtils/index.js +258 -0
- package/src/vendor/react-native/VirtualizedList/CellRenderMask.js +155 -0
- package/src/vendor/react-native/VirtualizedList/ChildListCollection.js +72 -0
- package/src/vendor/react-native/VirtualizedList/RLV_ADAPTER_STATUS.md +257 -0
- package/src/vendor/react-native/VirtualizedList/StateSafePureComponent.js +85 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.js +247 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListContext.js +118 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListProps.js +318 -0
- package/src/vendor/react-native/VirtualizedList/VirtualizedListRLVAdapter.js +1120 -0
- package/src/vendor/react-native/VirtualizedList/index.js +2099 -0
- package/src/vendor/react-native/VirtualizedSectionList/index.js +616 -0
- package/src/vendor/react-native/deepDiffer/index.js +72 -0
- package/src/vendor/react-native/infoLog/index.js +20 -0
- package/src/vendor/react-native/vendor/emitter/EventEmitter.js +146 -0
|
@@ -0,0 +1,1506 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _createForOfIteratorHelperLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelperLoose"));
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _RefreshControl = _interopRequireDefault(require("../../../exports/RefreshControl"));
|
|
11
|
+
var _ScrollView = _interopRequireDefault(require("../../../exports/ScrollView"));
|
|
12
|
+
var _TVFocusGuideView = _interopRequireDefault(require("../../../exports/TV/TVFocusGuideView"));
|
|
13
|
+
var _View = _interopRequireDefault(require("../../../exports/View"));
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("../../../exports/StyleSheet"));
|
|
15
|
+
var _Batchinator = _interopRequireDefault(require("../Batchinator"));
|
|
16
|
+
var _clamp = _interopRequireDefault(require("../Utilities/clamp"));
|
|
17
|
+
var _infoLog = _interopRequireDefault(require("../infoLog"));
|
|
18
|
+
var _CellRenderMask = require("./CellRenderMask");
|
|
19
|
+
var _ChildListCollection = _interopRequireDefault(require("./ChildListCollection"));
|
|
20
|
+
var _FillRateHelper = _interopRequireDefault(require("../FillRateHelper"));
|
|
21
|
+
var _StateSafePureComponent = _interopRequireDefault(require("./StateSafePureComponent"));
|
|
22
|
+
var _ViewabilityHelper = _interopRequireDefault(require("../ViewabilityHelper"));
|
|
23
|
+
var _VirtualizedListCellRenderer = _interopRequireDefault(require("./VirtualizedListCellRenderer"));
|
|
24
|
+
var _VirtualizedListContext = require("./VirtualizedListContext.js");
|
|
25
|
+
var _VirtualizeUtils = require("../VirtualizeUtils");
|
|
26
|
+
var _invariant = _interopRequireDefault(require("fbjs/lib/invariant"));
|
|
27
|
+
var _nullthrows = _interopRequireDefault(require("nullthrows"));
|
|
28
|
+
var React = _interopRequireWildcard(require("react"));
|
|
29
|
+
var _I18nManager = _interopRequireDefault(require("../../../exports/I18nManager"));
|
|
30
|
+
var _Platform = _interopRequireDefault(require("../../../exports/Platform"));
|
|
31
|
+
/**
|
|
32
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* @format
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
// import VirtualizedListRLVAdapter from './VirtualizedListRLVAdapter';
|
|
42
|
+
|
|
43
|
+
var __DEV__ = process.env.NODE_ENV !== 'production';
|
|
44
|
+
var ON_EDGE_REACHED_EPSILON = 0.001;
|
|
45
|
+
var _usedIndexForKey = false;
|
|
46
|
+
var _keylessItemComponentName = '';
|
|
47
|
+
/**
|
|
48
|
+
* Default Props Helper Functions
|
|
49
|
+
* Use the following helper functions for default values
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
// horizontalOrDefault(this.props.horizontal)
|
|
53
|
+
function horizontalOrDefault(horizontal) {
|
|
54
|
+
return horizontal !== null && horizontal !== void 0 ? horizontal : false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// initialNumToRenderOrDefault(this.props.initialNumToRender)
|
|
58
|
+
function initialNumToRenderOrDefault(initialNumToRender) {
|
|
59
|
+
return initialNumToRender !== null && initialNumToRender !== void 0 ? initialNumToRender : 10;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// maxToRenderPerBatchOrDefault(this.props.maxToRenderPerBatch)
|
|
63
|
+
function maxToRenderPerBatchOrDefault(maxToRenderPerBatch) {
|
|
64
|
+
return maxToRenderPerBatch !== null && maxToRenderPerBatch !== void 0 ? maxToRenderPerBatch : 10;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// onStartReachedThresholdOrDefault(this.props.onStartReachedThreshold)
|
|
68
|
+
function onStartReachedThresholdOrDefault(onStartReachedThreshold) {
|
|
69
|
+
return onStartReachedThreshold !== null && onStartReachedThreshold !== void 0 ? onStartReachedThreshold : 2;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold)
|
|
73
|
+
function onEndReachedThresholdOrDefault(onEndReachedThreshold) {
|
|
74
|
+
return onEndReachedThreshold !== null && onEndReachedThreshold !== void 0 ? onEndReachedThreshold : 2;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// getScrollingThreshold(visibleLength, onEndReachedThreshold)
|
|
78
|
+
function getScrollingThreshold(threshold, visibleLength) {
|
|
79
|
+
return threshold * visibleLength / 2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// scrollEventThrottleOrDefault(this.props.scrollEventThrottle)
|
|
83
|
+
function scrollEventThrottleOrDefault(scrollEventThrottle) {
|
|
84
|
+
return scrollEventThrottle !== null && scrollEventThrottle !== void 0 ? scrollEventThrottle : 50;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// windowSizeOrDefault(this.props.windowSize)
|
|
88
|
+
function windowSizeOrDefault(windowSize) {
|
|
89
|
+
return windowSize !== null && windowSize !== void 0 ? windowSize : 21;
|
|
90
|
+
}
|
|
91
|
+
function findLastWhere(arr, predicate) {
|
|
92
|
+
for (var i = arr.length - 1; i >= 0; i--) {
|
|
93
|
+
if (predicate(arr[i])) {
|
|
94
|
+
return arr[i];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Base implementation for the more convenient [`<FlatList>`](https://reactnative.dev/docs/flatlist)
|
|
102
|
+
* and [`<SectionList>`](https://reactnative.dev/docs/sectionlist) components, which are also better
|
|
103
|
+
* documented. In general, this should only really be used if you need more flexibility than
|
|
104
|
+
* `FlatList` provides, e.g. for use with immutable data instead of plain arrays.
|
|
105
|
+
*
|
|
106
|
+
* Virtualization massively improves memory consumption and performance of large lists by
|
|
107
|
+
* maintaining a finite render window of active items and replacing all items outside of the render
|
|
108
|
+
* window with appropriately sized blank space. The window adapts to scrolling behavior, and items
|
|
109
|
+
* are rendered incrementally with low-pri (after any running interactions) if they are far from the
|
|
110
|
+
* visible area, or with hi-pri otherwise to minimize the potential of seeing blank space.
|
|
111
|
+
*
|
|
112
|
+
* Some caveats:
|
|
113
|
+
*
|
|
114
|
+
* - Internal state is not preserved when content scrolls out of the render window. Make sure all
|
|
115
|
+
* your data is captured in the item data or external stores like Flux, Redux, or Relay.
|
|
116
|
+
* - This is a `PureComponent` which means that it will not re-render if `props` remain shallow-
|
|
117
|
+
* equal. Make sure that everything your `renderItem` function depends on is passed as a prop
|
|
118
|
+
* (e.g. `extraData`) that is not `===` after updates, otherwise your UI may not update on
|
|
119
|
+
* changes. This includes the `data` prop and parent component state.
|
|
120
|
+
* - In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
|
121
|
+
* offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
|
122
|
+
* blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
|
123
|
+
* and we are working on improving it behind the scenes.
|
|
124
|
+
* - By default, the list looks for a `key` or `id` prop on each item and uses that for the React key.
|
|
125
|
+
* Alternatively, you can provide a custom `keyExtractor` prop.
|
|
126
|
+
* - As an effort to remove defaultProps, use helper functions when referencing certain props
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
class VirtualizedList extends _StateSafePureComponent.default {
|
|
130
|
+
// scrollToEnd may be janky without getItemLayout prop
|
|
131
|
+
scrollToEnd(params) {
|
|
132
|
+
var animated = params ? params.animated : true;
|
|
133
|
+
var veryLast = this.props.getItemCount(this.props.data) - 1;
|
|
134
|
+
if (veryLast < 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var frame = this.__getFrameMetricsApprox(veryLast, this.props);
|
|
138
|
+
var offset = Math.max(0, frame.offset + frame.length + this._footerLength - this._scrollMetrics.visibleLength);
|
|
139
|
+
if (this._scrollRef == null) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (this._scrollRef.scrollTo == null) {
|
|
143
|
+
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.');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
|
|
147
|
+
x: offset,
|
|
148
|
+
animated
|
|
149
|
+
} : {
|
|
150
|
+
y: offset,
|
|
151
|
+
animated
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// scrollToIndex may be janky without getItemLayout prop
|
|
156
|
+
scrollToIndex(params) {
|
|
157
|
+
var _this$props = this.props,
|
|
158
|
+
data = _this$props.data,
|
|
159
|
+
horizontal = _this$props.horizontal,
|
|
160
|
+
getItemCount = _this$props.getItemCount,
|
|
161
|
+
getItemLayout = _this$props.getItemLayout,
|
|
162
|
+
onScrollToIndexFailed = _this$props.onScrollToIndexFailed;
|
|
163
|
+
var animated = params.animated,
|
|
164
|
+
index = params.index,
|
|
165
|
+
viewOffset = params.viewOffset,
|
|
166
|
+
viewPosition = params.viewPosition;
|
|
167
|
+
(0, _invariant.default)(index >= 0, "scrollToIndex out of range: requested index " + index + " but minimum is 0");
|
|
168
|
+
(0, _invariant.default)(getItemCount(data) >= 1, "scrollToIndex out of range: item length " + getItemCount(data) + " but minimum is 1");
|
|
169
|
+
(0, _invariant.default)(index < getItemCount(data), "scrollToIndex out of range: requested index " + index + " is out of 0 to " + (getItemCount(data) - 1));
|
|
170
|
+
if (!getItemLayout && index > this._highestMeasuredFrameIndex) {
|
|
171
|
+
(0, _invariant.default)(!!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.');
|
|
172
|
+
onScrollToIndexFailed({
|
|
173
|
+
averageItemLength: this._averageCellLength,
|
|
174
|
+
highestMeasuredFrameIndex: this._highestMeasuredFrameIndex,
|
|
175
|
+
index
|
|
176
|
+
});
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
var frame = this.__getFrameMetricsApprox(Math.floor(index), this.props);
|
|
180
|
+
var offset = Math.max(0, this._getOffsetApprox(index, this.props) - (viewPosition || 0) * (this._scrollMetrics.visibleLength - frame.length)) - (viewOffset || 0);
|
|
181
|
+
if (this._scrollRef == null) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (this._scrollRef.scrollTo == null) {
|
|
185
|
+
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.');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this._scrollRef.scrollTo(horizontal ? {
|
|
189
|
+
x: offset,
|
|
190
|
+
animated
|
|
191
|
+
} : {
|
|
192
|
+
y: offset,
|
|
193
|
+
animated
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// scrollToItem may be janky without getItemLayout prop. Required linear scan through items -
|
|
198
|
+
// use scrollToIndex instead if possible.
|
|
199
|
+
scrollToItem(params) {
|
|
200
|
+
var item = params.item;
|
|
201
|
+
var _this$props2 = this.props,
|
|
202
|
+
data = _this$props2.data,
|
|
203
|
+
getItem = _this$props2.getItem,
|
|
204
|
+
getItemCount = _this$props2.getItemCount;
|
|
205
|
+
var itemCount = getItemCount(data);
|
|
206
|
+
for (var _index = 0; _index < itemCount; _index++) {
|
|
207
|
+
if (getItem(data, _index) === item) {
|
|
208
|
+
this.scrollToIndex((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
209
|
+
index: _index
|
|
210
|
+
}));
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Scroll to a specific content pixel offset in the list.
|
|
218
|
+
*
|
|
219
|
+
* Param `offset` expects the offset to scroll to.
|
|
220
|
+
* In case of `horizontal` is true, the offset is the x-value,
|
|
221
|
+
* in any other case the offset is the y-value.
|
|
222
|
+
*
|
|
223
|
+
* Param `animated` (`true` by default) defines whether the list
|
|
224
|
+
* should do an animation while scrolling.
|
|
225
|
+
*/
|
|
226
|
+
scrollToOffset(params) {
|
|
227
|
+
var animated = params.animated,
|
|
228
|
+
offset = params.offset;
|
|
229
|
+
if (this._scrollRef == null) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (this._scrollRef.scrollTo == null) {
|
|
233
|
+
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.');
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this._scrollRef.scrollTo(horizontalOrDefault(this.props.horizontal) ? {
|
|
237
|
+
x: offset,
|
|
238
|
+
animated
|
|
239
|
+
} : {
|
|
240
|
+
y: offset,
|
|
241
|
+
animated
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
recordInteraction() {
|
|
245
|
+
this._nestedChildLists.forEach(childList => {
|
|
246
|
+
childList.recordInteraction();
|
|
247
|
+
});
|
|
248
|
+
this._viewabilityTuples.forEach(t => {
|
|
249
|
+
t.viewabilityHelper.recordInteraction();
|
|
250
|
+
});
|
|
251
|
+
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
252
|
+
}
|
|
253
|
+
flashScrollIndicators() {
|
|
254
|
+
if (this._scrollRef == null) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this._scrollRef.flashScrollIndicators();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Provides a handle to the underlying scroll responder.
|
|
262
|
+
* Note that `this._scrollRef` might not be a `ScrollView`, so we
|
|
263
|
+
* need to check that it responds to `getScrollResponder` before calling it.
|
|
264
|
+
*/
|
|
265
|
+
getScrollResponder() {
|
|
266
|
+
if (this._scrollRef && this._scrollRef.getScrollResponder) {
|
|
267
|
+
return this._scrollRef.getScrollResponder();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
getScrollableNode() {
|
|
271
|
+
if (this._scrollRef && this._scrollRef.getScrollableNode) {
|
|
272
|
+
return this._scrollRef.getScrollableNode();
|
|
273
|
+
} else {
|
|
274
|
+
return this._scrollRef;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
getScrollRef() {
|
|
278
|
+
if (this._scrollRef && this._scrollRef.getScrollRef) {
|
|
279
|
+
return this._scrollRef.getScrollRef();
|
|
280
|
+
} else {
|
|
281
|
+
return this._scrollRef;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
_getCellKey() {
|
|
285
|
+
var _this$context;
|
|
286
|
+
return ((_this$context = this.context) == null ? void 0 : _this$context.cellKey) || 'rootList';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// $FlowFixMe[missing-local-annot]
|
|
290
|
+
|
|
291
|
+
hasMore() {
|
|
292
|
+
return this._hasMore;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// $FlowFixMe[missing-local-annot]
|
|
296
|
+
|
|
297
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
298
|
+
|
|
299
|
+
constructor(_props) {
|
|
300
|
+
var _this$props$updateCel;
|
|
301
|
+
super(_props);
|
|
302
|
+
this._getScrollMetrics = () => {
|
|
303
|
+
return this._scrollMetrics;
|
|
304
|
+
};
|
|
305
|
+
this._getOutermostParentListRef = () => {
|
|
306
|
+
if (this._isNestedWithSameOrientation()) {
|
|
307
|
+
return this.context.getOutermostParentListRef();
|
|
308
|
+
} else {
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
this._registerAsNestedChild = childList => {
|
|
313
|
+
this._nestedChildLists.add(childList.ref, childList.cellKey);
|
|
314
|
+
if (this._hasInteracted) {
|
|
315
|
+
childList.ref.recordInteraction();
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
this._unregisterAsNestedChild = childList => {
|
|
319
|
+
this._nestedChildLists.remove(childList.ref);
|
|
320
|
+
};
|
|
321
|
+
this._onUpdateSeparators = (keys, newProps) => {
|
|
322
|
+
keys.forEach(key => {
|
|
323
|
+
var ref = key != null && this._cellRefs[key];
|
|
324
|
+
ref && ref.updateSeparatorProps(newProps);
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
this._getSpacerKey = isVertical => isVertical ? 'height' : 'width';
|
|
328
|
+
this._averageCellLength = 0;
|
|
329
|
+
this._cellRefs = {};
|
|
330
|
+
this._frames = {};
|
|
331
|
+
this._footerLength = 0;
|
|
332
|
+
// Used for preventing scrollToIndex from being called multiple times for initialScrollIndex
|
|
333
|
+
this._hasTriggeredInitialScrollToIndex = false;
|
|
334
|
+
this._hasInteracted = false;
|
|
335
|
+
this._hasMore = false;
|
|
336
|
+
this._hasWarned = {};
|
|
337
|
+
this._headerLength = 0;
|
|
338
|
+
this._hiPriInProgress = false;
|
|
339
|
+
// flag to prevent infinite hiPri cell limit update
|
|
340
|
+
this._highestMeasuredFrameIndex = 0;
|
|
341
|
+
this._indicesToKeys = new Map();
|
|
342
|
+
this._lastFocusedCellKey = null;
|
|
343
|
+
this._nestedChildLists = new _ChildListCollection.default();
|
|
344
|
+
this._offsetFromParentVirtualizedList = 0;
|
|
345
|
+
this._prevParentOffset = 0;
|
|
346
|
+
// $FlowFixMe[missing-local-annot]
|
|
347
|
+
this._scrollMetrics = {
|
|
348
|
+
contentLength: 0,
|
|
349
|
+
dOffset: 0,
|
|
350
|
+
dt: 10,
|
|
351
|
+
offset: 0,
|
|
352
|
+
timestamp: 0,
|
|
353
|
+
velocity: 0,
|
|
354
|
+
visibleLength: 0,
|
|
355
|
+
zoomScale: 1
|
|
356
|
+
};
|
|
357
|
+
this._scrollRef = null;
|
|
358
|
+
this._sentStartForContentLength = 0;
|
|
359
|
+
this._sentEndForContentLength = 0;
|
|
360
|
+
this._totalCellLength = 0;
|
|
361
|
+
this._totalCellsMeasured = 0;
|
|
362
|
+
this._viewabilityTuples = [];
|
|
363
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
364
|
+
* LTI update could not be added via codemod */
|
|
365
|
+
this._captureScrollRef = ref => {
|
|
366
|
+
this._scrollRef = ref;
|
|
367
|
+
};
|
|
368
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
369
|
+
* LTI update could not be added via codemod */
|
|
370
|
+
this._defaultRenderScrollComponent = props => {
|
|
371
|
+
var onRefresh = props.onRefresh;
|
|
372
|
+
if (this._isNestedWithSameOrientation()) {
|
|
373
|
+
// $FlowFixMe[prop-missing] - Typing ReactNativeComponent revealed errors
|
|
374
|
+
return /*#__PURE__*/React.createElement(_View.default, props);
|
|
375
|
+
} else if (onRefresh) {
|
|
376
|
+
var _props$refreshing;
|
|
377
|
+
(0, _invariant.default)(typeof props.refreshing === 'boolean', '`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `' + JSON.stringify((_props$refreshing = props.refreshing) !== null && _props$refreshing !== void 0 ? _props$refreshing : 'undefined') + '`');
|
|
378
|
+
return (
|
|
379
|
+
/*#__PURE__*/
|
|
380
|
+
// $FlowFixMe[prop-missing] Invalid prop usage
|
|
381
|
+
// $FlowFixMe[incompatible-use]
|
|
382
|
+
React.createElement(_ScrollView.default, (0, _extends2.default)({}, props, {
|
|
383
|
+
refreshControl: props.refreshControl == null ? /*#__PURE__*/React.createElement(_RefreshControl.default
|
|
384
|
+
// $FlowFixMe[incompatible-type]
|
|
385
|
+
, {
|
|
386
|
+
refreshing: props.refreshing,
|
|
387
|
+
onRefresh: onRefresh,
|
|
388
|
+
progressViewOffset: props.progressViewOffset
|
|
389
|
+
}) : props.refreshControl
|
|
390
|
+
}))
|
|
391
|
+
);
|
|
392
|
+
} else {
|
|
393
|
+
// $FlowFixMe[prop-missing] Invalid prop usage
|
|
394
|
+
// $FlowFixMe[incompatible-use]
|
|
395
|
+
return /*#__PURE__*/React.createElement(_ScrollView.default, props);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
this._onCellLayout = (e, cellKey, index) => {
|
|
399
|
+
var layout = e.nativeEvent.layout;
|
|
400
|
+
var next = {
|
|
401
|
+
offset: this._selectOffset(layout),
|
|
402
|
+
length: this._selectLength(layout),
|
|
403
|
+
index,
|
|
404
|
+
inLayout: true
|
|
405
|
+
};
|
|
406
|
+
var curr = this._frames[cellKey];
|
|
407
|
+
if (!curr || next.offset !== curr.offset || next.length !== curr.length || index !== curr.index) {
|
|
408
|
+
this._totalCellLength += next.length - (curr ? curr.length : 0);
|
|
409
|
+
this._totalCellsMeasured += curr ? 0 : 1;
|
|
410
|
+
this._averageCellLength = this._totalCellLength / this._totalCellsMeasured;
|
|
411
|
+
this._frames[cellKey] = next;
|
|
412
|
+
this._highestMeasuredFrameIndex = Math.max(this._highestMeasuredFrameIndex, index);
|
|
413
|
+
this._scheduleCellsToRenderUpdate();
|
|
414
|
+
} else {
|
|
415
|
+
this._frames[cellKey].inLayout = true;
|
|
416
|
+
}
|
|
417
|
+
this._triggerRemeasureForChildListsInCell(cellKey);
|
|
418
|
+
this._computeBlankness();
|
|
419
|
+
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
420
|
+
};
|
|
421
|
+
this._onCellUnmount = cellKey => {
|
|
422
|
+
delete this._cellRefs[cellKey];
|
|
423
|
+
var curr = this._frames[cellKey];
|
|
424
|
+
if (curr) {
|
|
425
|
+
this._frames[cellKey] = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, curr), {}, {
|
|
426
|
+
inLayout: false
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
this._onLayout = e => {
|
|
431
|
+
if (this._isNestedWithSameOrientation()) {
|
|
432
|
+
// Need to adjust our scroll metrics to be relative to our containing
|
|
433
|
+
// VirtualizedList before we can make claims about list item viewability
|
|
434
|
+
this.measureLayoutRelativeToContainingList();
|
|
435
|
+
} else {
|
|
436
|
+
this._scrollMetrics.visibleLength = this._selectLength(e.nativeEvent.layout);
|
|
437
|
+
}
|
|
438
|
+
this.props.onLayout && this.props.onLayout(e);
|
|
439
|
+
this._scheduleCellsToRenderUpdate();
|
|
440
|
+
this._maybeCallOnEdgeReached();
|
|
441
|
+
};
|
|
442
|
+
this._onLayoutEmpty = e => {
|
|
443
|
+
this.props.onLayout && this.props.onLayout(e);
|
|
444
|
+
};
|
|
445
|
+
this._onLayoutFooter = e => {
|
|
446
|
+
this._triggerRemeasureForChildListsInCell(this._getFooterCellKey());
|
|
447
|
+
this._footerLength = this._selectLength(e.nativeEvent.layout);
|
|
448
|
+
};
|
|
449
|
+
this._onLayoutHeader = e => {
|
|
450
|
+
this._headerLength = this._selectLength(e.nativeEvent.layout);
|
|
451
|
+
};
|
|
452
|
+
this._onContentSizeChange = (width, height) => {
|
|
453
|
+
if (width > 0 && height > 0 && this.props.initialScrollIndex != null && this.props.initialScrollIndex > 0 && !this._hasTriggeredInitialScrollToIndex) {
|
|
454
|
+
if (this.props.contentOffset == null) {
|
|
455
|
+
if (this.props.initialScrollIndex < this.props.getItemCount(this.props.data)) {
|
|
456
|
+
this.scrollToIndex({
|
|
457
|
+
animated: false,
|
|
458
|
+
index: (0, _nullthrows.default)(this.props.initialScrollIndex)
|
|
459
|
+
});
|
|
460
|
+
} else {
|
|
461
|
+
this.scrollToEnd({
|
|
462
|
+
animated: false
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
this._hasTriggeredInitialScrollToIndex = true;
|
|
467
|
+
}
|
|
468
|
+
if (this.props.onContentSizeChange) {
|
|
469
|
+
this.props.onContentSizeChange(width, height);
|
|
470
|
+
}
|
|
471
|
+
this._scrollMetrics.contentLength = this._selectLength({
|
|
472
|
+
height,
|
|
473
|
+
width
|
|
474
|
+
});
|
|
475
|
+
this._scheduleCellsToRenderUpdate();
|
|
476
|
+
this._maybeCallOnEdgeReached();
|
|
477
|
+
};
|
|
478
|
+
/* Translates metrics from a scroll event in a parent VirtualizedList into
|
|
479
|
+
* coordinates relative to the child list.
|
|
480
|
+
*/
|
|
481
|
+
this._convertParentScrollMetrics = metrics => {
|
|
482
|
+
// Offset of the top of the nested list relative to the top of its parent's viewport
|
|
483
|
+
var offset = metrics.offset - this._offsetFromParentVirtualizedList;
|
|
484
|
+
// Child's visible length is the same as its parent's
|
|
485
|
+
var visibleLength = metrics.visibleLength;
|
|
486
|
+
var dOffset = offset - this._scrollMetrics.offset;
|
|
487
|
+
var contentLength = this._scrollMetrics.contentLength;
|
|
488
|
+
return {
|
|
489
|
+
visibleLength,
|
|
490
|
+
contentLength,
|
|
491
|
+
offset,
|
|
492
|
+
dOffset
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
this._onScroll = e => {
|
|
496
|
+
this._nestedChildLists.forEach(childList => {
|
|
497
|
+
childList._onScroll(e);
|
|
498
|
+
});
|
|
499
|
+
if (this.props.onScroll) {
|
|
500
|
+
this.props.onScroll(e);
|
|
501
|
+
}
|
|
502
|
+
var timestamp = e.timeStamp;
|
|
503
|
+
var visibleLength = this._selectLength(e.nativeEvent.layoutMeasurement);
|
|
504
|
+
var contentLength = this._selectLength(e.nativeEvent.contentSize);
|
|
505
|
+
var offset = this._selectOffset(e.nativeEvent.contentOffset);
|
|
506
|
+
var dOffset = offset - this._scrollMetrics.offset;
|
|
507
|
+
if (this._isNestedWithSameOrientation()) {
|
|
508
|
+
if (this._scrollMetrics.contentLength === 0) {
|
|
509
|
+
// Ignore scroll events until onLayout has been called and we
|
|
510
|
+
// know our offset from our offset from our parent
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
var _this$_convertParentS = this._convertParentScrollMetrics({
|
|
514
|
+
visibleLength,
|
|
515
|
+
offset
|
|
516
|
+
});
|
|
517
|
+
visibleLength = _this$_convertParentS.visibleLength;
|
|
518
|
+
contentLength = _this$_convertParentS.contentLength;
|
|
519
|
+
offset = _this$_convertParentS.offset;
|
|
520
|
+
dOffset = _this$_convertParentS.dOffset;
|
|
521
|
+
}
|
|
522
|
+
var dt = this._scrollMetrics.timestamp ? Math.max(1, timestamp - this._scrollMetrics.timestamp) : 1;
|
|
523
|
+
var velocity = dOffset / dt;
|
|
524
|
+
if (dt > 500 && this._scrollMetrics.dt > 500 && contentLength > 5 * visibleLength && !this._hasWarned.perf) {
|
|
525
|
+
(0, _infoLog.default)('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.', {
|
|
526
|
+
dt,
|
|
527
|
+
prevDt: this._scrollMetrics.dt,
|
|
528
|
+
contentLength
|
|
529
|
+
});
|
|
530
|
+
this._hasWarned.perf = true;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// For invalid negative values (w/ RTL), set this to 1.
|
|
534
|
+
var zoomScale = e.nativeEvent.zoomScale < 0 ? 1 : e.nativeEvent.zoomScale;
|
|
535
|
+
this._scrollMetrics = {
|
|
536
|
+
contentLength,
|
|
537
|
+
dt,
|
|
538
|
+
dOffset,
|
|
539
|
+
offset,
|
|
540
|
+
timestamp,
|
|
541
|
+
velocity,
|
|
542
|
+
visibleLength,
|
|
543
|
+
zoomScale
|
|
544
|
+
};
|
|
545
|
+
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
546
|
+
if (!this.props) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
this._maybeCallOnEdgeReached();
|
|
550
|
+
if (velocity !== 0) {
|
|
551
|
+
this._fillRateHelper.activate();
|
|
552
|
+
}
|
|
553
|
+
this._computeBlankness();
|
|
554
|
+
this._scheduleCellsToRenderUpdate();
|
|
555
|
+
};
|
|
556
|
+
this._onScrollBeginDrag = e => {
|
|
557
|
+
this._nestedChildLists.forEach(childList => {
|
|
558
|
+
childList._onScrollBeginDrag(e);
|
|
559
|
+
});
|
|
560
|
+
this._viewabilityTuples.forEach(tuple => {
|
|
561
|
+
tuple.viewabilityHelper.recordInteraction();
|
|
562
|
+
});
|
|
563
|
+
this._hasInteracted = true;
|
|
564
|
+
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
|
|
565
|
+
};
|
|
566
|
+
this._onScrollEndDrag = e => {
|
|
567
|
+
this._nestedChildLists.forEach(childList => {
|
|
568
|
+
childList._onScrollEndDrag(e);
|
|
569
|
+
});
|
|
570
|
+
var velocity = e.nativeEvent.velocity;
|
|
571
|
+
if (velocity) {
|
|
572
|
+
this._scrollMetrics.velocity = this._selectOffset(velocity);
|
|
573
|
+
}
|
|
574
|
+
this._computeBlankness();
|
|
575
|
+
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
|
|
576
|
+
};
|
|
577
|
+
this._onMomentumScrollBegin = e => {
|
|
578
|
+
this._nestedChildLists.forEach(childList => {
|
|
579
|
+
childList._onMomentumScrollBegin(e);
|
|
580
|
+
});
|
|
581
|
+
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
|
|
582
|
+
};
|
|
583
|
+
this._onMomentumScrollEnd = e => {
|
|
584
|
+
this._nestedChildLists.forEach(childList => {
|
|
585
|
+
childList._onMomentumScrollEnd(e);
|
|
586
|
+
});
|
|
587
|
+
this._scrollMetrics.velocity = 0;
|
|
588
|
+
this._computeBlankness();
|
|
589
|
+
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
|
|
590
|
+
};
|
|
591
|
+
this._updateCellsToRender = () => {
|
|
592
|
+
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
593
|
+
this.setState((state, props) => {
|
|
594
|
+
var cellsAroundViewport = this._adjustCellsAroundViewport(props, state.cellsAroundViewport);
|
|
595
|
+
var renderMask = VirtualizedList._createRenderMask(props, cellsAroundViewport, this._getNonViewportRenderRegions(props));
|
|
596
|
+
if (cellsAroundViewport.first === state.cellsAroundViewport.first && cellsAroundViewport.last === state.cellsAroundViewport.last && renderMask.equals(state.renderMask)) {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
cellsAroundViewport,
|
|
601
|
+
renderMask
|
|
602
|
+
};
|
|
603
|
+
});
|
|
604
|
+
};
|
|
605
|
+
this._createViewToken = (index, isViewable, props
|
|
606
|
+
// $FlowFixMe[missing-local-annot]
|
|
607
|
+
) => {
|
|
608
|
+
var data = props.data,
|
|
609
|
+
getItem = props.getItem;
|
|
610
|
+
var item = getItem(data, index);
|
|
611
|
+
return {
|
|
612
|
+
index,
|
|
613
|
+
item,
|
|
614
|
+
key: this._keyExtractor(item, index, props),
|
|
615
|
+
isViewable
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* Gets an approximate offset to an item at a given index. Supports
|
|
620
|
+
* fractional indices.
|
|
621
|
+
*/
|
|
622
|
+
this._getOffsetApprox = (index, props) => {
|
|
623
|
+
if (Number.isInteger(index)) {
|
|
624
|
+
return this.__getFrameMetricsApprox(index, props).offset;
|
|
625
|
+
} else {
|
|
626
|
+
var frameMetrics = this.__getFrameMetricsApprox(Math.floor(index), props);
|
|
627
|
+
var remainder = index - Math.floor(index);
|
|
628
|
+
return frameMetrics.offset + remainder * frameMetrics.length;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
this.__getFrameMetricsApprox = (index, props) => {
|
|
632
|
+
var frame = this._getFrameMetrics(index, props);
|
|
633
|
+
if (frame && frame.index === index) {
|
|
634
|
+
// check for invalid frames due to row re-ordering
|
|
635
|
+
return frame;
|
|
636
|
+
} else {
|
|
637
|
+
var data = props.data,
|
|
638
|
+
getItemCount = props.getItemCount,
|
|
639
|
+
getItemLayout = props.getItemLayout;
|
|
640
|
+
(0, _invariant.default)(index >= 0 && index < getItemCount(data), 'Tried to get frame for out of range index ' + index);
|
|
641
|
+
(0, _invariant.default)(!getItemLayout, 'Should not have to estimate frames when a measurement metrics function is provided');
|
|
642
|
+
return {
|
|
643
|
+
length: this._averageCellLength,
|
|
644
|
+
offset: this._averageCellLength * index
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
this._getFrameMetrics = (index, props) => {
|
|
649
|
+
var data = props.data,
|
|
650
|
+
getItem = props.getItem,
|
|
651
|
+
getItemCount = props.getItemCount,
|
|
652
|
+
getItemLayout = props.getItemLayout;
|
|
653
|
+
(0, _invariant.default)(index >= 0 && index < getItemCount(data), 'Tried to get frame for out of range index ' + index);
|
|
654
|
+
var item = getItem(data, index);
|
|
655
|
+
var frame = this._frames[this._keyExtractor(item, index, props)];
|
|
656
|
+
if (!frame || frame.index !== index) {
|
|
657
|
+
if (getItemLayout) {
|
|
658
|
+
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
|
|
659
|
+
* suppresses an error found when Flow v0.63 was deployed. To see the error
|
|
660
|
+
* delete this comment and run Flow. */
|
|
661
|
+
return getItemLayout(data, index);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return frame;
|
|
665
|
+
};
|
|
666
|
+
this._getNonViewportRenderRegions = props => {
|
|
667
|
+
// Keep a viewport's worth of content around the last focused cell to allow
|
|
668
|
+
// random navigation around it without any blanking. E.g. tabbing from one
|
|
669
|
+
// focused item out of viewport to another.
|
|
670
|
+
if (!(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey])) {
|
|
671
|
+
return [];
|
|
672
|
+
}
|
|
673
|
+
var lastFocusedCellRenderer = this._cellRefs[this._lastFocusedCellKey];
|
|
674
|
+
var focusedCellIndex = lastFocusedCellRenderer.props.index;
|
|
675
|
+
var itemCount = props.getItemCount(props.data);
|
|
676
|
+
|
|
677
|
+
// The last cell we rendered may be at a new index. Bail if we don't know
|
|
678
|
+
// where it is.
|
|
679
|
+
if (focusedCellIndex >= itemCount || this._keyExtractor(props.getItem(props.data, focusedCellIndex), focusedCellIndex, props) !== this._lastFocusedCellKey) {
|
|
680
|
+
return [];
|
|
681
|
+
}
|
|
682
|
+
var first = focusedCellIndex;
|
|
683
|
+
var heightOfCellsBeforeFocused = 0;
|
|
684
|
+
for (var i = first - 1; i >= 0 && heightOfCellsBeforeFocused < this._scrollMetrics.visibleLength; i--) {
|
|
685
|
+
first--;
|
|
686
|
+
heightOfCellsBeforeFocused += this.__getFrameMetricsApprox(i, props).length;
|
|
687
|
+
}
|
|
688
|
+
var last = focusedCellIndex;
|
|
689
|
+
var heightOfCellsAfterFocused = 0;
|
|
690
|
+
for (var _i = last + 1; _i < itemCount && heightOfCellsAfterFocused < this._scrollMetrics.visibleLength; _i++) {
|
|
691
|
+
last++;
|
|
692
|
+
heightOfCellsAfterFocused += this.__getFrameMetricsApprox(_i, props).length;
|
|
693
|
+
}
|
|
694
|
+
return [{
|
|
695
|
+
first,
|
|
696
|
+
last
|
|
697
|
+
}];
|
|
698
|
+
};
|
|
699
|
+
this._checkProps(_props);
|
|
700
|
+
this._fillRateHelper = new _FillRateHelper.default(this._getFrameMetrics);
|
|
701
|
+
this._updateCellsToRenderBatcher = new _Batchinator.default(this._updateCellsToRender, (_this$props$updateCel = this.props.updateCellsBatchingPeriod) !== null && _this$props$updateCel !== void 0 ? _this$props$updateCel : 50);
|
|
702
|
+
if (this.props.viewabilityConfigCallbackPairs) {
|
|
703
|
+
this._viewabilityTuples = this.props.viewabilityConfigCallbackPairs.map(pair => ({
|
|
704
|
+
viewabilityHelper: new _ViewabilityHelper.default(pair.viewabilityConfig),
|
|
705
|
+
onViewableItemsChanged: pair.onViewableItemsChanged
|
|
706
|
+
}));
|
|
707
|
+
} else {
|
|
708
|
+
var _this$props3 = this.props,
|
|
709
|
+
onViewableItemsChanged = _this$props3.onViewableItemsChanged,
|
|
710
|
+
viewabilityConfig = _this$props3.viewabilityConfig;
|
|
711
|
+
if (onViewableItemsChanged) {
|
|
712
|
+
this._viewabilityTuples.push({
|
|
713
|
+
viewabilityHelper: new _ViewabilityHelper.default(viewabilityConfig),
|
|
714
|
+
onViewableItemsChanged: onViewableItemsChanged
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
var initialRenderRegion = VirtualizedList._initialRenderRegion(_props);
|
|
719
|
+
this.state = {
|
|
720
|
+
cellsAroundViewport: initialRenderRegion,
|
|
721
|
+
renderMask: VirtualizedList._createRenderMask(_props, initialRenderRegion)
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
725
|
+
// For issue https://github.com/necolas/react-native-web/issues/995
|
|
726
|
+
this.invertedWheelEventHandler = ev => {
|
|
727
|
+
var scrollOffset = this.props.horizontal ? ev.target.scrollLeft : ev.target.scrollTop;
|
|
728
|
+
var scrollLength = this.props.horizontal ? ev.target.scrollWidth : ev.target.scrollHeight;
|
|
729
|
+
var clientLength = this.props.horizontal ? ev.target.clientWidth : ev.target.clientHeight;
|
|
730
|
+
var isEventTargetScrollable = scrollLength > clientLength;
|
|
731
|
+
var delta = this.props.horizontal ? ev.deltaX || ev.wheelDeltaX : ev.deltaY || ev.wheelDeltaY;
|
|
732
|
+
var leftoverDelta = delta;
|
|
733
|
+
if (isEventTargetScrollable) {
|
|
734
|
+
leftoverDelta = delta < 0 ? Math.min(delta + scrollOffset, 0) : Math.max(delta - (scrollLength - clientLength - scrollOffset), 0);
|
|
735
|
+
}
|
|
736
|
+
var targetDelta = delta - leftoverDelta;
|
|
737
|
+
if (this.props.inverted && this._scrollRef && this._scrollRef.getScrollableNode) {
|
|
738
|
+
var node = this._scrollRef.getScrollableNode();
|
|
739
|
+
if (this.props.horizontal) {
|
|
740
|
+
ev.target.scrollLeft += targetDelta;
|
|
741
|
+
var nextScrollLeft = node.scrollLeft - leftoverDelta;
|
|
742
|
+
node.scrollLeft = !this.props.getItemLayout ? Math.min(nextScrollLeft, this._totalCellLength) : nextScrollLeft;
|
|
743
|
+
} else {
|
|
744
|
+
ev.target.scrollTop += targetDelta;
|
|
745
|
+
var nextScrollTop = node.scrollTop - leftoverDelta;
|
|
746
|
+
node.scrollTop = !this.props.getItemLayout ? Math.min(nextScrollTop, this._totalCellLength) : nextScrollTop;
|
|
747
|
+
}
|
|
748
|
+
ev.preventDefault();
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
_checkProps(props) {
|
|
753
|
+
var onScroll = props.onScroll,
|
|
754
|
+
windowSize = props.windowSize,
|
|
755
|
+
getItemCount = props.getItemCount,
|
|
756
|
+
data = props.data,
|
|
757
|
+
initialScrollIndex = props.initialScrollIndex;
|
|
758
|
+
(0, _invariant.default)(
|
|
759
|
+
// $FlowFixMe[prop-missing]
|
|
760
|
+
!onScroll || !onScroll.__isNative, 'Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent ' + 'to support native onScroll events with useNativeDriver');
|
|
761
|
+
(0, _invariant.default)(windowSizeOrDefault(windowSize) > 0, 'VirtualizedList: The windowSize prop must be present and set to a value greater than 0.');
|
|
762
|
+
(0, _invariant.default)(getItemCount, 'VirtualizedList: The "getItemCount" prop must be provided');
|
|
763
|
+
var itemCount = getItemCount(data);
|
|
764
|
+
if (initialScrollIndex != null && !this._hasTriggeredInitialScrollToIndex && (initialScrollIndex < 0 || itemCount > 0 && initialScrollIndex >= itemCount) && !this._hasWarned.initialScrollIndex) {
|
|
765
|
+
console.warn("initialScrollIndex \"" + initialScrollIndex + "\" is not valid (list has " + itemCount + " items)");
|
|
766
|
+
this._hasWarned.initialScrollIndex = true;
|
|
767
|
+
}
|
|
768
|
+
if (__DEV__ && !this._hasWarned.flexWrap) {
|
|
769
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
770
|
+
var flatStyles = _StyleSheet.default.flatten(this.props.contentContainerStyle);
|
|
771
|
+
if (flatStyles != null && flatStyles.flexWrap === 'wrap') {
|
|
772
|
+
console.warn('`flexWrap: `wrap`` is not supported with the `VirtualizedList` components.' + 'Consider using `numColumns` with `FlatList` instead.');
|
|
773
|
+
this._hasWarned.flexWrap = true;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
static _createRenderMask(props, cellsAroundViewport, additionalRegions) {
|
|
778
|
+
var itemCount = props.getItemCount(props.data);
|
|
779
|
+
(0, _invariant.default)(cellsAroundViewport.first >= 0 && cellsAroundViewport.last >= cellsAroundViewport.first - 1 && cellsAroundViewport.last < itemCount, "Invalid cells around viewport \"[" + cellsAroundViewport.first + ", " + cellsAroundViewport.last + "]\" was passed to VirtualizedList._createRenderMask");
|
|
780
|
+
var renderMask = new _CellRenderMask.CellRenderMask(itemCount);
|
|
781
|
+
if (itemCount > 0) {
|
|
782
|
+
var allRegions = [cellsAroundViewport, ...(additionalRegions !== null && additionalRegions !== void 0 ? additionalRegions : [])];
|
|
783
|
+
for (var _i2 = 0, _allRegions = allRegions; _i2 < _allRegions.length; _i2++) {
|
|
784
|
+
var region = _allRegions[_i2];
|
|
785
|
+
renderMask.addCells(region);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// The initially rendered cells are retained as part of the
|
|
789
|
+
// "scroll-to-top" optimization
|
|
790
|
+
if (props.initialScrollIndex == null || props.initialScrollIndex <= 0) {
|
|
791
|
+
var initialRegion = VirtualizedList._initialRenderRegion(props);
|
|
792
|
+
renderMask.addCells(initialRegion);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// The layout coordinates of sticker headers may be off-screen while the
|
|
796
|
+
// actual header is on-screen. Keep the most recent before the viewport
|
|
797
|
+
// rendered, even if its layout coordinates are not in viewport.
|
|
798
|
+
var stickyIndicesSet = new Set(props.stickyHeaderIndices);
|
|
799
|
+
VirtualizedList._ensureClosestStickyHeader(props, stickyIndicesSet, renderMask, cellsAroundViewport.first);
|
|
800
|
+
}
|
|
801
|
+
return renderMask;
|
|
802
|
+
}
|
|
803
|
+
static _initialRenderRegion(props) {
|
|
804
|
+
var _props$initialScrollI;
|
|
805
|
+
var itemCount = props.getItemCount(props.data);
|
|
806
|
+
var firstCellIndex = Math.max(0, Math.min(itemCount - 1, Math.floor((_props$initialScrollI = props.initialScrollIndex) !== null && _props$initialScrollI !== void 0 ? _props$initialScrollI : 0)));
|
|
807
|
+
var lastCellIndex = Math.min(itemCount, firstCellIndex + initialNumToRenderOrDefault(props.initialNumToRender)) - 1;
|
|
808
|
+
return {
|
|
809
|
+
first: firstCellIndex,
|
|
810
|
+
last: lastCellIndex
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
static _ensureClosestStickyHeader(props, stickyIndicesSet, renderMask, cellIdx) {
|
|
814
|
+
var stickyOffset = props.ListHeaderComponent ? 1 : 0;
|
|
815
|
+
for (var itemIdx = cellIdx - 1; itemIdx >= 0; itemIdx--) {
|
|
816
|
+
if (stickyIndicesSet.has(itemIdx + stickyOffset)) {
|
|
817
|
+
renderMask.addCells({
|
|
818
|
+
first: itemIdx,
|
|
819
|
+
last: itemIdx
|
|
820
|
+
});
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
_adjustCellsAroundViewport(props, cellsAroundViewport) {
|
|
826
|
+
var data = props.data,
|
|
827
|
+
getItemCount = props.getItemCount;
|
|
828
|
+
var onEndReachedThreshold = onEndReachedThresholdOrDefault(props.onEndReachedThreshold);
|
|
829
|
+
var _this$_scrollMetrics = this._scrollMetrics,
|
|
830
|
+
contentLength = _this$_scrollMetrics.contentLength,
|
|
831
|
+
offset = _this$_scrollMetrics.offset,
|
|
832
|
+
visibleLength = _this$_scrollMetrics.visibleLength;
|
|
833
|
+
var distanceFromEnd = contentLength - visibleLength - offset;
|
|
834
|
+
|
|
835
|
+
// Wait until the scroll view metrics have been set up. And until then,
|
|
836
|
+
// we will trust the initialNumToRender suggestion
|
|
837
|
+
if (visibleLength <= 0 || contentLength <= 0) {
|
|
838
|
+
return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
|
|
839
|
+
}
|
|
840
|
+
var newCellsAroundViewport;
|
|
841
|
+
if (props.disableVirtualization) {
|
|
842
|
+
var renderAhead = distanceFromEnd < onEndReachedThreshold * visibleLength ? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch) : 0;
|
|
843
|
+
newCellsAroundViewport = {
|
|
844
|
+
first: 0,
|
|
845
|
+
last: Math.min(cellsAroundViewport.last + renderAhead, getItemCount(data) - 1)
|
|
846
|
+
};
|
|
847
|
+
} else {
|
|
848
|
+
// If we have a non-zero initialScrollIndex and run this before we've scrolled,
|
|
849
|
+
// we'll wipe out the initialNumToRender rendered elements starting at initialScrollIndex.
|
|
850
|
+
// So let's wait until we've scrolled the view to the right place. And until then,
|
|
851
|
+
// we will trust the initialScrollIndex suggestion.
|
|
852
|
+
|
|
853
|
+
// Thus, we want to recalculate the windowed render limits if any of the following hold:
|
|
854
|
+
// - initialScrollIndex is undefined or is 0
|
|
855
|
+
// - initialScrollIndex > 0 AND scrolling is complete
|
|
856
|
+
// - initialScrollIndex > 0 AND the end of the list is visible (this handles the case
|
|
857
|
+
// where the list is shorter than the visible area)
|
|
858
|
+
if (props.initialScrollIndex && !this._scrollMetrics.offset && Math.abs(distanceFromEnd) >= Number.EPSILON) {
|
|
859
|
+
return cellsAroundViewport.last >= getItemCount(data) ? VirtualizedList._constrainToItemCount(cellsAroundViewport, props) : cellsAroundViewport;
|
|
860
|
+
}
|
|
861
|
+
newCellsAroundViewport = (0, _VirtualizeUtils.computeWindowedRenderLimits)(props, maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch), windowSizeOrDefault(props.windowSize), cellsAroundViewport, this.__getFrameMetricsApprox, this._scrollMetrics);
|
|
862
|
+
(0, _invariant.default)(newCellsAroundViewport.last < getItemCount(data), 'computeWindowedRenderLimits() should return range in-bounds');
|
|
863
|
+
}
|
|
864
|
+
if (this._nestedChildLists.size() > 0) {
|
|
865
|
+
// If some cell in the new state has a child list in it, we should only render
|
|
866
|
+
// up through that item, so that we give that list a chance to render.
|
|
867
|
+
// Otherwise there's churn from multiple child lists mounting and un-mounting
|
|
868
|
+
// their items.
|
|
869
|
+
|
|
870
|
+
// Will this prevent rendering if the nested list doesn't realize the end?
|
|
871
|
+
var childIdx = this._findFirstChildWithMore(newCellsAroundViewport.first, newCellsAroundViewport.last);
|
|
872
|
+
newCellsAroundViewport.last = childIdx !== null && childIdx !== void 0 ? childIdx : newCellsAroundViewport.last;
|
|
873
|
+
}
|
|
874
|
+
return newCellsAroundViewport;
|
|
875
|
+
}
|
|
876
|
+
_findFirstChildWithMore(first, last) {
|
|
877
|
+
for (var ii = first; ii <= last; ii++) {
|
|
878
|
+
var cellKeyForIndex = this._indicesToKeys.get(ii);
|
|
879
|
+
if (cellKeyForIndex != null && this._nestedChildLists.anyInCell(cellKeyForIndex, childList => childList.hasMore())) {
|
|
880
|
+
return ii;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
componentDidMount() {
|
|
886
|
+
if (this._isNestedWithSameOrientation()) {
|
|
887
|
+
this.context.registerAsNestedChild({
|
|
888
|
+
ref: this,
|
|
889
|
+
cellKey: this.context.cellKey
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
894
|
+
this.setupWebWheelHandler();
|
|
895
|
+
}
|
|
896
|
+
componentWillUnmount() {
|
|
897
|
+
if (this._isNestedWithSameOrientation()) {
|
|
898
|
+
this.context.unregisterAsNestedChild({
|
|
899
|
+
ref: this
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
this._updateCellsToRenderBatcher.dispose({
|
|
903
|
+
abort: true
|
|
904
|
+
});
|
|
905
|
+
this._viewabilityTuples.forEach(tuple => {
|
|
906
|
+
tuple.viewabilityHelper.dispose();
|
|
907
|
+
});
|
|
908
|
+
this._fillRateHelper.deactivateAndFlush();
|
|
909
|
+
|
|
910
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
911
|
+
this.teardownWebWheelHandler();
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
915
|
+
setupWebWheelHandler() {
|
|
916
|
+
if (this._scrollRef && this._scrollRef.getScrollableNode) {
|
|
917
|
+
this._scrollRef.getScrollableNode().addEventListener('wheel', this.invertedWheelEventHandler);
|
|
918
|
+
} else {
|
|
919
|
+
setTimeout(() => this.setupWebWheelHandler(), 50);
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// REACT-NATIVE-WEB patch to preserve during future RN merges: Support inverted wheel scroller.
|
|
925
|
+
teardownWebWheelHandler() {
|
|
926
|
+
if (this._scrollRef && this._scrollRef.getScrollableNode) {
|
|
927
|
+
this._scrollRef.getScrollableNode().removeEventListener('wheel', this.invertedWheelEventHandler);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
static getDerivedStateFromProps(newProps, prevState) {
|
|
931
|
+
// first and last could be stale (e.g. if a new, shorter items props is passed in), so we make
|
|
932
|
+
// sure we're rendering a reasonable range here.
|
|
933
|
+
var itemCount = newProps.getItemCount(newProps.data);
|
|
934
|
+
if (itemCount === prevState.renderMask.numCells()) {
|
|
935
|
+
return prevState;
|
|
936
|
+
}
|
|
937
|
+
var constrainedCells = VirtualizedList._constrainToItemCount(prevState.cellsAroundViewport, newProps);
|
|
938
|
+
return {
|
|
939
|
+
cellsAroundViewport: constrainedCells,
|
|
940
|
+
renderMask: VirtualizedList._createRenderMask(newProps, constrainedCells)
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
_pushCells(cells, stickyHeaderIndices, stickyIndicesFromProps, first, last, inversionStyle) {
|
|
944
|
+
var _this = this;
|
|
945
|
+
var _this$props4 = this.props,
|
|
946
|
+
CellRendererComponent = _this$props4.CellRendererComponent,
|
|
947
|
+
ItemSeparatorComponent = _this$props4.ItemSeparatorComponent,
|
|
948
|
+
ListHeaderComponent = _this$props4.ListHeaderComponent,
|
|
949
|
+
ListItemComponent = _this$props4.ListItemComponent,
|
|
950
|
+
data = _this$props4.data,
|
|
951
|
+
debug = _this$props4.debug,
|
|
952
|
+
getItem = _this$props4.getItem,
|
|
953
|
+
getItemCount = _this$props4.getItemCount,
|
|
954
|
+
getItemLayout = _this$props4.getItemLayout,
|
|
955
|
+
horizontal = _this$props4.horizontal,
|
|
956
|
+
renderItem = _this$props4.renderItem;
|
|
957
|
+
var stickyOffset = ListHeaderComponent ? 1 : 0;
|
|
958
|
+
var end = getItemCount(data) - 1;
|
|
959
|
+
var prevCellKey;
|
|
960
|
+
last = Math.min(end, last);
|
|
961
|
+
var _loop = function _loop() {
|
|
962
|
+
var item = getItem(data, ii);
|
|
963
|
+
var key = _this._keyExtractor(item, ii, _this.props);
|
|
964
|
+
_this._indicesToKeys.set(ii, key);
|
|
965
|
+
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
|
|
966
|
+
stickyHeaderIndices.push(cells.length);
|
|
967
|
+
}
|
|
968
|
+
var shouldListenForLayout = getItemLayout == null || debug || _this._fillRateHelper.enabled();
|
|
969
|
+
cells.push(/*#__PURE__*/React.createElement(_VirtualizedListCellRenderer.default, (0, _extends2.default)({
|
|
970
|
+
CellRendererComponent: CellRendererComponent,
|
|
971
|
+
ItemSeparatorComponent: ii < end ? ItemSeparatorComponent : undefined,
|
|
972
|
+
ListItemComponent: ListItemComponent,
|
|
973
|
+
cellKey: key,
|
|
974
|
+
horizontal: horizontal,
|
|
975
|
+
index: ii,
|
|
976
|
+
inversionStyle: inversionStyle,
|
|
977
|
+
item: item,
|
|
978
|
+
key: key,
|
|
979
|
+
prevCellKey: prevCellKey,
|
|
980
|
+
onUpdateSeparators: _this._onUpdateSeparators,
|
|
981
|
+
onCellFocusCapture: e => _this._onCellFocusCapture(key),
|
|
982
|
+
onUnmount: _this._onCellUnmount,
|
|
983
|
+
ref: _ref => {
|
|
984
|
+
_this._cellRefs[key] = _ref;
|
|
985
|
+
},
|
|
986
|
+
renderItem: renderItem
|
|
987
|
+
}, shouldListenForLayout && {
|
|
988
|
+
onCellLayout: _this._onCellLayout
|
|
989
|
+
})));
|
|
990
|
+
prevCellKey = key;
|
|
991
|
+
};
|
|
992
|
+
for (var ii = first; ii <= last; ii++) {
|
|
993
|
+
_loop();
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
static _constrainToItemCount(cells, props) {
|
|
997
|
+
var itemCount = props.getItemCount(props.data);
|
|
998
|
+
var last = Math.min(itemCount - 1, cells.last);
|
|
999
|
+
var maxToRenderPerBatch = maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch);
|
|
1000
|
+
return {
|
|
1001
|
+
first: (0, _clamp.default)(0, itemCount - 1 - maxToRenderPerBatch, cells.first),
|
|
1002
|
+
last
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
_isNestedWithSameOrientation() {
|
|
1006
|
+
var nestedContext = this.context;
|
|
1007
|
+
return !!(nestedContext && !!nestedContext.horizontal === horizontalOrDefault(this.props.horizontal));
|
|
1008
|
+
}
|
|
1009
|
+
_keyExtractor(item, index, props
|
|
1010
|
+
// $FlowFixMe[missing-local-annot]
|
|
1011
|
+
) {
|
|
1012
|
+
if (props.keyExtractor != null) {
|
|
1013
|
+
return props.keyExtractor(item, index);
|
|
1014
|
+
}
|
|
1015
|
+
var key = (0, _VirtualizeUtils.keyExtractor)(item, index);
|
|
1016
|
+
if (key === String(index)) {
|
|
1017
|
+
_usedIndexForKey = true;
|
|
1018
|
+
if (item.type && item.type.displayName) {
|
|
1019
|
+
_keylessItemComponentName = item.type.displayName;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return key;
|
|
1023
|
+
}
|
|
1024
|
+
render() {
|
|
1025
|
+
// Use RLV adapter if layoutProvider prop is provided or if env var enables it
|
|
1026
|
+
// const useRLVEngine = this.props.layoutProvider || process.env.RNW_USE_RLV_ENGINE === 'true';
|
|
1027
|
+
// if (useRLVEngine) {
|
|
1028
|
+
// return <VirtualizedListRLVAdapter {...this.props} />;
|
|
1029
|
+
// }
|
|
1030
|
+
|
|
1031
|
+
this._checkProps(this.props);
|
|
1032
|
+
var _this$props5 = this.props,
|
|
1033
|
+
ListEmptyComponent = _this$props5.ListEmptyComponent,
|
|
1034
|
+
ListFooterComponent = _this$props5.ListFooterComponent,
|
|
1035
|
+
ListHeaderComponent = _this$props5.ListHeaderComponent;
|
|
1036
|
+
var _this$props6 = this.props,
|
|
1037
|
+
data = _this$props6.data,
|
|
1038
|
+
horizontal = _this$props6.horizontal;
|
|
1039
|
+
var inversionStyle = this.props.inverted ? horizontalOrDefault(this.props.horizontal) ? styles.horizontallyInverted : styles.verticallyInverted : null;
|
|
1040
|
+
var cells = [];
|
|
1041
|
+
var stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
|
|
1042
|
+
var stickyHeaderIndices = [];
|
|
1043
|
+
|
|
1044
|
+
// 1. Add cell for ListHeaderComponent
|
|
1045
|
+
if (ListHeaderComponent) {
|
|
1046
|
+
if (stickyIndicesFromProps.has(0)) {
|
|
1047
|
+
stickyHeaderIndices.push(0);
|
|
1048
|
+
}
|
|
1049
|
+
var _element = /*#__PURE__*/React.isValidElement(ListHeaderComponent) ? ListHeaderComponent :
|
|
1050
|
+
/*#__PURE__*/
|
|
1051
|
+
// $FlowFixMe[not-a-component]
|
|
1052
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
1053
|
+
React.createElement(ListHeaderComponent, null);
|
|
1054
|
+
cells.push(/*#__PURE__*/React.createElement(_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
1055
|
+
cellKey: this._getCellKey() + '-header',
|
|
1056
|
+
key: "$header"
|
|
1057
|
+
}, /*#__PURE__*/React.createElement(_View.default, {
|
|
1058
|
+
onLayout: this._onLayoutHeader,
|
|
1059
|
+
style: [inversionStyle, this.props.ListHeaderComponentStyle]
|
|
1060
|
+
},
|
|
1061
|
+
// $FlowFixMe[incompatible-type] - Typing ReactNativeComponent revealed errors
|
|
1062
|
+
_element)));
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// 2a. Add a cell for ListEmptyComponent if applicable
|
|
1066
|
+
var itemCount = this.props.getItemCount(data);
|
|
1067
|
+
if (itemCount === 0 && ListEmptyComponent) {
|
|
1068
|
+
var _element2 = /*#__PURE__*/React.isValidElement(ListEmptyComponent) ? ListEmptyComponent :
|
|
1069
|
+
/*#__PURE__*/
|
|
1070
|
+
// $FlowFixMe[not-a-component]
|
|
1071
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
1072
|
+
React.createElement(ListEmptyComponent, null);
|
|
1073
|
+
cells.push(/*#__PURE__*/React.createElement(_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
1074
|
+
cellKey: this._getCellKey() + '-empty',
|
|
1075
|
+
key: "$empty"
|
|
1076
|
+
}, /*#__PURE__*/React.cloneElement(_element2, {
|
|
1077
|
+
onLayout: event => {
|
|
1078
|
+
this._onLayoutEmpty(event);
|
|
1079
|
+
if (_element2.props.onLayout) {
|
|
1080
|
+
_element2.props.onLayout(event);
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
style: [inversionStyle, _element2.props.style]
|
|
1084
|
+
})));
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// 2b. Add cells and spacers for each item
|
|
1088
|
+
if (itemCount > 0) {
|
|
1089
|
+
_usedIndexForKey = false;
|
|
1090
|
+
_keylessItemComponentName = '';
|
|
1091
|
+
var spacerKey = this._getSpacerKey(!horizontal);
|
|
1092
|
+
var renderRegions = this.state.renderMask.enumerateRegions();
|
|
1093
|
+
var lastSpacer = findLastWhere(renderRegions, r => r.isSpacer);
|
|
1094
|
+
for (var _iterator = (0, _createForOfIteratorHelperLoose2.default)(renderRegions), _step; !(_step = _iterator()).done;) {
|
|
1095
|
+
var section = _step.value;
|
|
1096
|
+
if (section.isSpacer) {
|
|
1097
|
+
// Legacy behavior is to avoid spacers when virtualization is
|
|
1098
|
+
// disabled (including head spacers on initial render).
|
|
1099
|
+
if (this.props.disableVirtualization) {
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// Without getItemLayout, we limit our tail spacer to the _highestMeasuredFrameIndex to
|
|
1104
|
+
// prevent the user for hyperscrolling into un-measured area because otherwise content will
|
|
1105
|
+
// likely jump around as it renders in above the viewport.
|
|
1106
|
+
var isLastSpacer = section === lastSpacer;
|
|
1107
|
+
var constrainToMeasured = isLastSpacer && !this.props.getItemLayout;
|
|
1108
|
+
var last = constrainToMeasured ? (0, _clamp.default)(section.first - 1, section.last, this._highestMeasuredFrameIndex) : section.last;
|
|
1109
|
+
var firstMetrics = this.__getFrameMetricsApprox(section.first, this.props);
|
|
1110
|
+
var lastMetrics = this.__getFrameMetricsApprox(last, this.props);
|
|
1111
|
+
var spacerSize = lastMetrics.offset + lastMetrics.length - firstMetrics.offset;
|
|
1112
|
+
cells.push(/*#__PURE__*/React.createElement(_View.default, {
|
|
1113
|
+
key: "$spacer-" + section.first,
|
|
1114
|
+
style: {
|
|
1115
|
+
[spacerKey]: spacerSize
|
|
1116
|
+
}
|
|
1117
|
+
}));
|
|
1118
|
+
} else {
|
|
1119
|
+
this._pushCells(cells, stickyHeaderIndices, stickyIndicesFromProps, section.first, section.last, inversionStyle);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
if (!this._hasWarned.keys && _usedIndexForKey) {
|
|
1123
|
+
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);
|
|
1124
|
+
this._hasWarned.keys = true;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// 3. Add cell for ListFooterComponent
|
|
1129
|
+
if (ListFooterComponent) {
|
|
1130
|
+
var _element3 = /*#__PURE__*/React.isValidElement(ListFooterComponent) ? ListFooterComponent :
|
|
1131
|
+
/*#__PURE__*/
|
|
1132
|
+
// $FlowFixMe[not-a-component]
|
|
1133
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
1134
|
+
React.createElement(ListFooterComponent, null);
|
|
1135
|
+
cells.push(/*#__PURE__*/React.createElement(_VirtualizedListContext.VirtualizedListCellContextProvider, {
|
|
1136
|
+
cellKey: this._getFooterCellKey(),
|
|
1137
|
+
key: "$footer"
|
|
1138
|
+
}, /*#__PURE__*/React.createElement(_View.default, {
|
|
1139
|
+
onLayout: this._onLayoutFooter,
|
|
1140
|
+
style: [inversionStyle, this.props.ListFooterComponentStyle]
|
|
1141
|
+
},
|
|
1142
|
+
// $FlowFixMe[incompatible-type] - Typing ReactNativeComponent revealed errors
|
|
1143
|
+
_element3)));
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
// 4. Render the ScrollView
|
|
1147
|
+
var scrollProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.props), {}, {
|
|
1148
|
+
onContentSizeChange: this._onContentSizeChange,
|
|
1149
|
+
onLayout: this._onLayout,
|
|
1150
|
+
onScroll: this._onScroll,
|
|
1151
|
+
onScrollBeginDrag: this._onScrollBeginDrag,
|
|
1152
|
+
onScrollEndDrag: this._onScrollEndDrag,
|
|
1153
|
+
onMomentumScrollBegin: this._onMomentumScrollBegin,
|
|
1154
|
+
onMomentumScrollEnd: this._onMomentumScrollEnd,
|
|
1155
|
+
scrollEventThrottle: scrollEventThrottleOrDefault(this.props.scrollEventThrottle),
|
|
1156
|
+
// TODO: Android support
|
|
1157
|
+
invertStickyHeaders: this.props.invertStickyHeaders !== undefined ? this.props.invertStickyHeaders : this.props.inverted,
|
|
1158
|
+
stickyHeaderIndices,
|
|
1159
|
+
style: inversionStyle ? [inversionStyle, this.props.style] : this.props.style
|
|
1160
|
+
});
|
|
1161
|
+
this._hasMore = this.state.cellsAroundViewport.last < itemCount - 1;
|
|
1162
|
+
var trapFocusHorizontal = _I18nManager.default.isRTL ? {
|
|
1163
|
+
trapFocusRight: horizontalOrDefault(this.props.horizontal) && this.state.cellsAroundViewport.first > 0,
|
|
1164
|
+
trapFocusLeft: horizontalOrDefault(this.props.horizontal) && this._hasMore
|
|
1165
|
+
} : {
|
|
1166
|
+
trapFocusLeft: horizontalOrDefault(this.props.horizontal) && this.state.cellsAroundViewport.first > 0,
|
|
1167
|
+
trapFocusRight: horizontalOrDefault(this.props.horizontal) && this._hasMore
|
|
1168
|
+
};
|
|
1169
|
+
var innerRet = /*#__PURE__*/React.createElement(_VirtualizedListContext.VirtualizedListContextProvider, {
|
|
1170
|
+
value: {
|
|
1171
|
+
cellKey: null,
|
|
1172
|
+
getScrollMetrics: this._getScrollMetrics,
|
|
1173
|
+
horizontal: horizontalOrDefault(this.props.horizontal),
|
|
1174
|
+
getOutermostParentListRef: this._getOutermostParentListRef,
|
|
1175
|
+
registerAsNestedChild: this._registerAsNestedChild,
|
|
1176
|
+
unregisterAsNestedChild: this._unregisterAsNestedChild
|
|
1177
|
+
}
|
|
1178
|
+
}, _Platform.default.isTV ? /*#__PURE__*/React.createElement(_TVFocusGuideView.default, (0, _extends2.default)({
|
|
1179
|
+
style: [{
|
|
1180
|
+
flexGrow: 1,
|
|
1181
|
+
flexShrink: 1
|
|
1182
|
+
}, this.props.style]
|
|
1183
|
+
// $FlowFixMe[incompatible-type] Internal sentinel used to identify VirtualizedList TVFocusGuideView
|
|
1184
|
+
,
|
|
1185
|
+
tabIndex: -999 // To uniquely identify this as coming from FlatList
|
|
1186
|
+
}, trapFocusHorizontal, {
|
|
1187
|
+
trapFocusUp: !horizontalOrDefault(this.props.horizontal) && this.state.cellsAroundViewport.first > 0,
|
|
1188
|
+
trapFocusDown: !horizontalOrDefault(this.props.horizontal) && this._hasMore
|
|
1189
|
+
}), /*#__PURE__*/React.cloneElement((this.props.renderScrollComponent || this._defaultRenderScrollComponent)(scrollProps), {
|
|
1190
|
+
ref: this._captureScrollRef
|
|
1191
|
+
}, cells)) : (/*#__PURE__*/React.cloneElement((this.props.renderScrollComponent || this._defaultRenderScrollComponent)(scrollProps), {
|
|
1192
|
+
ref: this._captureScrollRef
|
|
1193
|
+
}, cells)));
|
|
1194
|
+
var ret = innerRet;
|
|
1195
|
+
/* https://github.com/necolas/react-native-web/issues/2239: Re-enable when ScrollView.Context.Consumer is available.
|
|
1196
|
+
if (__DEV__) {
|
|
1197
|
+
ret = (
|
|
1198
|
+
<ScrollView.Context.Consumer>
|
|
1199
|
+
{scrollContext => {
|
|
1200
|
+
if (
|
|
1201
|
+
scrollContext != null &&
|
|
1202
|
+
!scrollContext.horizontal ===
|
|
1203
|
+
!horizontalOrDefault(this.props.horizontal) &&
|
|
1204
|
+
!this._hasWarned.nesting &&
|
|
1205
|
+
this.context == null &&
|
|
1206
|
+
this.props.scrollEnabled !== false
|
|
1207
|
+
) {
|
|
1208
|
+
// TODO (T46547044): use React.warn once 16.9 is sync'd: https://github.com/facebook/react/pull/15170
|
|
1209
|
+
console.error(
|
|
1210
|
+
'VirtualizedLists should never be nested inside plain ScrollViews with the same ' +
|
|
1211
|
+
'orientation because it can break windowing and other functionality - use another ' +
|
|
1212
|
+
'VirtualizedList-backed container instead.',
|
|
1213
|
+
);
|
|
1214
|
+
this._hasWarned.nesting = true;
|
|
1215
|
+
}
|
|
1216
|
+
return innerRet;
|
|
1217
|
+
}}
|
|
1218
|
+
</ScrollView.Context.Consumer>
|
|
1219
|
+
);
|
|
1220
|
+
}*/
|
|
1221
|
+
if (this.props.debug) {
|
|
1222
|
+
return /*#__PURE__*/React.createElement(_View.default, {
|
|
1223
|
+
style: styles.debug
|
|
1224
|
+
}, ret, this._renderDebugOverlay());
|
|
1225
|
+
} else {
|
|
1226
|
+
return ret;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
componentDidUpdate(prevProps) {
|
|
1230
|
+
var _this$props7 = this.props,
|
|
1231
|
+
data = _this$props7.data,
|
|
1232
|
+
extraData = _this$props7.extraData;
|
|
1233
|
+
if (data !== prevProps.data || extraData !== prevProps.extraData) {
|
|
1234
|
+
// clear the viewableIndices cache to also trigger
|
|
1235
|
+
// the onViewableItemsChanged callback with the new data
|
|
1236
|
+
this._viewabilityTuples.forEach(tuple => {
|
|
1237
|
+
tuple.viewabilityHelper.resetViewableIndices();
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
// The `this._hiPriInProgress` is guaranteeing a hiPri cell update will only happen
|
|
1241
|
+
// once per fiber update. The `_scheduleCellsToRenderUpdate` will set it to true
|
|
1242
|
+
// if a hiPri update needs to perform. If `componentDidUpdate` is triggered with
|
|
1243
|
+
// `this._hiPriInProgress=true`, means it's triggered by the hiPri update. The
|
|
1244
|
+
// `_scheduleCellsToRenderUpdate` will check this condition and not perform
|
|
1245
|
+
// another hiPri update.
|
|
1246
|
+
var hiPriInProgress = this._hiPriInProgress;
|
|
1247
|
+
this._scheduleCellsToRenderUpdate();
|
|
1248
|
+
// Make sure setting `this._hiPriInProgress` back to false after `componentDidUpdate`
|
|
1249
|
+
// is triggered with `this._hiPriInProgress = true`
|
|
1250
|
+
if (hiPriInProgress) {
|
|
1251
|
+
this._hiPriInProgress = false;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
_computeBlankness() {
|
|
1255
|
+
this._fillRateHelper.computeBlankness(this.props, this.state.cellsAroundViewport, this._scrollMetrics);
|
|
1256
|
+
}
|
|
1257
|
+
_onCellFocusCapture(cellKey) {
|
|
1258
|
+
this._lastFocusedCellKey = cellKey;
|
|
1259
|
+
this._updateCellsToRender();
|
|
1260
|
+
}
|
|
1261
|
+
_triggerRemeasureForChildListsInCell(cellKey) {
|
|
1262
|
+
this._nestedChildLists.forEachInCell(cellKey, childList => {
|
|
1263
|
+
childList.measureLayoutRelativeToContainingList();
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
measureLayoutRelativeToContainingList() {
|
|
1267
|
+
// TODO (T35574538): findNodeHandle sometimes crashes with "Unable to find
|
|
1268
|
+
// node on an unmounted component" during scrolling
|
|
1269
|
+
try {
|
|
1270
|
+
if (!this._scrollRef) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
// We are assuming that getOutermostParentListRef().getScrollRef()
|
|
1274
|
+
// is a non-null reference to a ScrollView
|
|
1275
|
+
this._scrollRef.measureLayout(this.context.getOutermostParentListRef().getScrollRef(), (x, y, width, height) => {
|
|
1276
|
+
this._offsetFromParentVirtualizedList = this._selectOffset({
|
|
1277
|
+
x,
|
|
1278
|
+
y
|
|
1279
|
+
});
|
|
1280
|
+
this._scrollMetrics.contentLength = this._selectLength({
|
|
1281
|
+
width,
|
|
1282
|
+
height
|
|
1283
|
+
});
|
|
1284
|
+
var scrollMetrics = this._convertParentScrollMetrics(this.context.getScrollMetrics());
|
|
1285
|
+
var metricsChanged = this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength || this._scrollMetrics.offset !== scrollMetrics.offset;
|
|
1286
|
+
if (metricsChanged) {
|
|
1287
|
+
this._scrollMetrics.visibleLength = scrollMetrics.visibleLength;
|
|
1288
|
+
this._scrollMetrics.offset = scrollMetrics.offset;
|
|
1289
|
+
|
|
1290
|
+
// If metrics of the scrollView changed, then we triggered remeasure for child list
|
|
1291
|
+
// to ensure VirtualizedList has the right information.
|
|
1292
|
+
this._nestedChildLists.forEach(childList => {
|
|
1293
|
+
childList.measureLayoutRelativeToContainingList();
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
}, error => {
|
|
1297
|
+
console.warn("VirtualizedList: Encountered an error while measuring a list's" + ' offset from its containing VirtualizedList.');
|
|
1298
|
+
});
|
|
1299
|
+
} catch (error) {
|
|
1300
|
+
console.warn('measureLayoutRelativeToContainingList threw an error', error.stack);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
_getFooterCellKey() {
|
|
1304
|
+
return this._getCellKey() + '-footer';
|
|
1305
|
+
}
|
|
1306
|
+
// $FlowFixMe[missing-local-annot]
|
|
1307
|
+
_renderDebugOverlay() {
|
|
1308
|
+
var normalize = this._scrollMetrics.visibleLength / (this._scrollMetrics.contentLength || 1);
|
|
1309
|
+
var framesInLayout = [];
|
|
1310
|
+
var itemCount = this.props.getItemCount(this.props.data);
|
|
1311
|
+
for (var ii = 0; ii < itemCount; ii++) {
|
|
1312
|
+
var frame = this.__getFrameMetricsApprox(ii, this.props);
|
|
1313
|
+
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
|
|
1314
|
+
* suppresses an error found when Flow v0.68 was deployed. To see the
|
|
1315
|
+
* error delete this comment and run Flow. */
|
|
1316
|
+
if (frame.inLayout) {
|
|
1317
|
+
framesInLayout.push(frame);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
var windowTop = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.first, this.props).offset;
|
|
1321
|
+
var frameLast = this.__getFrameMetricsApprox(this.state.cellsAroundViewport.last, this.props);
|
|
1322
|
+
var windowLen = frameLast.offset + frameLast.length - windowTop;
|
|
1323
|
+
var visTop = this._scrollMetrics.offset;
|
|
1324
|
+
var visLen = this._scrollMetrics.visibleLength;
|
|
1325
|
+
return /*#__PURE__*/React.createElement(_View.default, {
|
|
1326
|
+
style: [styles.debugOverlayBase, styles.debugOverlay]
|
|
1327
|
+
}, framesInLayout.map((f, ii) => /*#__PURE__*/React.createElement(_View.default, {
|
|
1328
|
+
key: 'f' + ii,
|
|
1329
|
+
style: [styles.debugOverlayBase, styles.debugOverlayFrame, {
|
|
1330
|
+
top: f.offset * normalize,
|
|
1331
|
+
height: f.length * normalize
|
|
1332
|
+
}]
|
|
1333
|
+
})), /*#__PURE__*/React.createElement(_View.default, {
|
|
1334
|
+
style: [styles.debugOverlayBase, styles.debugOverlayFrameLast, {
|
|
1335
|
+
top: windowTop * normalize,
|
|
1336
|
+
height: windowLen * normalize
|
|
1337
|
+
}]
|
|
1338
|
+
}), /*#__PURE__*/React.createElement(_View.default, {
|
|
1339
|
+
style: [styles.debugOverlayBase, styles.debugOverlayFrameVis, {
|
|
1340
|
+
top: visTop * normalize,
|
|
1341
|
+
height: visLen * normalize
|
|
1342
|
+
}]
|
|
1343
|
+
}));
|
|
1344
|
+
}
|
|
1345
|
+
_selectLength(metrics) {
|
|
1346
|
+
return !horizontalOrDefault(this.props.horizontal) ? metrics.height : metrics.width;
|
|
1347
|
+
}
|
|
1348
|
+
_selectOffset(metrics) {
|
|
1349
|
+
return !horizontalOrDefault(this.props.horizontal) ? metrics.y : metrics.x;
|
|
1350
|
+
}
|
|
1351
|
+
_maybeCallOnEdgeReached() {
|
|
1352
|
+
var _this$props8 = this.props,
|
|
1353
|
+
data = _this$props8.data,
|
|
1354
|
+
getItemCount = _this$props8.getItemCount,
|
|
1355
|
+
onStartReached = _this$props8.onStartReached,
|
|
1356
|
+
onStartReachedThreshold = _this$props8.onStartReachedThreshold,
|
|
1357
|
+
onEndReached = _this$props8.onEndReached,
|
|
1358
|
+
onEndReachedThreshold = _this$props8.onEndReachedThreshold,
|
|
1359
|
+
initialScrollIndex = _this$props8.initialScrollIndex;
|
|
1360
|
+
var _this$_scrollMetrics2 = this._scrollMetrics,
|
|
1361
|
+
contentLength = _this$_scrollMetrics2.contentLength,
|
|
1362
|
+
visibleLength = _this$_scrollMetrics2.visibleLength,
|
|
1363
|
+
offset = _this$_scrollMetrics2.offset;
|
|
1364
|
+
var distanceFromStart = offset;
|
|
1365
|
+
var distanceFromEnd = contentLength - visibleLength - offset;
|
|
1366
|
+
|
|
1367
|
+
// Especially when oERT is zero it's necessary to 'floor' very small distance values to be 0
|
|
1368
|
+
// since debouncing causes us to not fire this event for every single "pixel" we scroll and can thus
|
|
1369
|
+
// be at the edge of the list with a distance approximating 0 but not quite there.
|
|
1370
|
+
if (distanceFromStart < ON_EDGE_REACHED_EPSILON) {
|
|
1371
|
+
distanceFromStart = 0;
|
|
1372
|
+
}
|
|
1373
|
+
if (distanceFromEnd < ON_EDGE_REACHED_EPSILON) {
|
|
1374
|
+
distanceFromEnd = 0;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// TODO: T121172172 Look into why we're "defaulting" to a threshold of 2px
|
|
1378
|
+
// when oERT is not present (different from 2 viewports used elsewhere)
|
|
1379
|
+
var DEFAULT_THRESHOLD_PX = 2;
|
|
1380
|
+
var startThreshold = onStartReachedThreshold != null ? onStartReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX;
|
|
1381
|
+
var endThreshold = onEndReachedThreshold != null ? onEndReachedThreshold * visibleLength : DEFAULT_THRESHOLD_PX;
|
|
1382
|
+
var isWithinStartThreshold = distanceFromStart <= startThreshold;
|
|
1383
|
+
var isWithinEndThreshold = distanceFromEnd <= endThreshold;
|
|
1384
|
+
|
|
1385
|
+
// First check if the user just scrolled within the end threshold
|
|
1386
|
+
// and call onEndReached only once for a given content length,
|
|
1387
|
+
// and only if onStartReached is not being executed
|
|
1388
|
+
if (onEndReached && this.state.cellsAroundViewport.last === getItemCount(data) - 1 && isWithinEndThreshold && this._scrollMetrics.contentLength !== this._sentEndForContentLength) {
|
|
1389
|
+
this._sentEndForContentLength = this._scrollMetrics.contentLength;
|
|
1390
|
+
onEndReached({
|
|
1391
|
+
distanceFromEnd
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// Next check if the user just scrolled within the start threshold
|
|
1396
|
+
// and call onStartReached only once for a given content length,
|
|
1397
|
+
// and only if onEndReached is not being executed
|
|
1398
|
+
else if (onStartReached != null && this.state.cellsAroundViewport.first === 0 && isWithinStartThreshold && this._scrollMetrics.contentLength !== this._sentStartForContentLength) {
|
|
1399
|
+
// On initial mount when using initialScrollIndex the offset will be 0 initially
|
|
1400
|
+
// and will trigger an unexpected onStartReached. To avoid this we can use
|
|
1401
|
+
// timestamp to differentiate between the initial scroll metrics and when we actually
|
|
1402
|
+
// received the first scroll event.
|
|
1403
|
+
if (!initialScrollIndex || this._scrollMetrics.timestamp !== 0) {
|
|
1404
|
+
this._sentStartForContentLength = this._scrollMetrics.contentLength;
|
|
1405
|
+
onStartReached({
|
|
1406
|
+
distanceFromStart
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// If the user scrolls away from the start or end and back again,
|
|
1412
|
+
// cause onStartReached or onEndReached to be triggered again
|
|
1413
|
+
else {
|
|
1414
|
+
this._sentStartForContentLength = isWithinStartThreshold ? this._sentStartForContentLength : 0;
|
|
1415
|
+
this._sentEndForContentLength = isWithinEndThreshold ? this._sentEndForContentLength : 0;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
_scheduleCellsToRenderUpdate() {
|
|
1419
|
+
var _this$state$cellsArou = this.state.cellsAroundViewport,
|
|
1420
|
+
first = _this$state$cellsArou.first,
|
|
1421
|
+
last = _this$state$cellsArou.last;
|
|
1422
|
+
var _this$_scrollMetrics3 = this._scrollMetrics,
|
|
1423
|
+
offset = _this$_scrollMetrics3.offset,
|
|
1424
|
+
visibleLength = _this$_scrollMetrics3.visibleLength,
|
|
1425
|
+
velocity = _this$_scrollMetrics3.velocity;
|
|
1426
|
+
var itemCount = this.props.getItemCount(this.props.data);
|
|
1427
|
+
var hiPri = false;
|
|
1428
|
+
var onStartReachedThreshold = onStartReachedThresholdOrDefault(this.props.onStartReachedThreshold);
|
|
1429
|
+
var onEndReachedThreshold = onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold);
|
|
1430
|
+
// Mark as high priority if we're close to the start of the first item
|
|
1431
|
+
// But only if there are items before the first rendered item
|
|
1432
|
+
if (first > 0) {
|
|
1433
|
+
var distTop = offset - this.__getFrameMetricsApprox(first, this.props).offset;
|
|
1434
|
+
hiPri = distTop < 0 || velocity < -2 && distTop < getScrollingThreshold(onStartReachedThreshold, visibleLength);
|
|
1435
|
+
}
|
|
1436
|
+
// Mark as high priority if we're close to the end of the last item
|
|
1437
|
+
// But only if there are items after the last rendered item
|
|
1438
|
+
if (!hiPri && last >= 0 && last < itemCount - 1) {
|
|
1439
|
+
var distBottom = this.__getFrameMetricsApprox(last, this.props).offset - (offset + visibleLength);
|
|
1440
|
+
hiPri = distBottom < 0 || velocity > 2 && distBottom < getScrollingThreshold(onEndReachedThreshold, visibleLength);
|
|
1441
|
+
}
|
|
1442
|
+
// Only trigger high-priority updates if we've actually rendered cells,
|
|
1443
|
+
// and with that size estimate, accurately compute how many cells we should render.
|
|
1444
|
+
// Otherwise, it would just render as many cells as it can (of zero dimension),
|
|
1445
|
+
// each time through attempting to render more (limited by maxToRenderPerBatch),
|
|
1446
|
+
// starving the renderer from actually laying out the objects and computing _averageCellLength.
|
|
1447
|
+
// If this is triggered in an `componentDidUpdate` followed by a hiPri cellToRenderUpdate
|
|
1448
|
+
// We shouldn't do another hipri cellToRenderUpdate
|
|
1449
|
+
if (hiPri && (this._averageCellLength || this.props.getItemLayout) && !this._hiPriInProgress) {
|
|
1450
|
+
this._hiPriInProgress = true;
|
|
1451
|
+
// Don't worry about interactions when scrolling quickly; focus on filling content as fast
|
|
1452
|
+
// as possible.
|
|
1453
|
+
this._updateCellsToRenderBatcher.dispose({
|
|
1454
|
+
abort: true
|
|
1455
|
+
});
|
|
1456
|
+
this._updateCellsToRender();
|
|
1457
|
+
return;
|
|
1458
|
+
} else {
|
|
1459
|
+
this._updateCellsToRenderBatcher.schedule();
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
_updateViewableItems(props, cellsAroundViewport) {
|
|
1463
|
+
this._viewabilityTuples.forEach(tuple => {
|
|
1464
|
+
tuple.viewabilityHelper.onUpdate(props, this._scrollMetrics.offset, this._scrollMetrics.visibleLength, this._getFrameMetrics, this._createViewToken, tuple.onViewableItemsChanged, cellsAroundViewport);
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
VirtualizedList.contextType = _VirtualizedListContext.VirtualizedListContext;
|
|
1469
|
+
var styles = _StyleSheet.default.create({
|
|
1470
|
+
verticallyInverted: {
|
|
1471
|
+
transform: 'scaleY(-1)'
|
|
1472
|
+
},
|
|
1473
|
+
horizontallyInverted: {
|
|
1474
|
+
transform: 'scaleX(-1)'
|
|
1475
|
+
},
|
|
1476
|
+
debug: {
|
|
1477
|
+
flex: 1
|
|
1478
|
+
},
|
|
1479
|
+
debugOverlayBase: {
|
|
1480
|
+
position: 'absolute',
|
|
1481
|
+
top: 0,
|
|
1482
|
+
right: 0
|
|
1483
|
+
},
|
|
1484
|
+
debugOverlay: {
|
|
1485
|
+
bottom: 0,
|
|
1486
|
+
width: 20,
|
|
1487
|
+
borderColor: 'blue',
|
|
1488
|
+
borderWidth: 1
|
|
1489
|
+
},
|
|
1490
|
+
debugOverlayFrame: {
|
|
1491
|
+
left: 0,
|
|
1492
|
+
backgroundColor: 'orange'
|
|
1493
|
+
},
|
|
1494
|
+
debugOverlayFrameLast: {
|
|
1495
|
+
left: 0,
|
|
1496
|
+
borderColor: 'green',
|
|
1497
|
+
borderWidth: 2
|
|
1498
|
+
},
|
|
1499
|
+
debugOverlayFrameVis: {
|
|
1500
|
+
left: 0,
|
|
1501
|
+
borderColor: 'red',
|
|
1502
|
+
borderWidth: 2
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
var _default = exports.default = VirtualizedList;
|
|
1506
|
+
module.exports = exports.default;
|