react-native 0.71.4 → 0.72.0-rc.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/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
- package/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +1 -1
- package/Libraries/Alert/Alert.d.ts +4 -4
- package/Libraries/Animated/Animated.d.ts +17 -6
- package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
- package/Libraries/Animated/bezier.js +1 -1
- package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
- package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
- package/Libraries/Animated/createAnimatedComponent.js +26 -239
- package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
- package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
- package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +7 -10
- package/Libraries/AppDelegate/RCTAppDelegate.h +1 -8
- package/Libraries/AppDelegate/RCTAppDelegate.mm +49 -25
- package/{React/AppSetup → Libraries/AppDelegate}/RCTAppSetupUtils.h +7 -1
- package/{React/AppSetup → Libraries/AppDelegate}/RCTAppSetupUtils.mm +16 -9
- package/{React/Base/RCTWeakProxy.h → Libraries/AppDelegate/RCTLegacyInteropComponents.h} +5 -3
- package/{React/Views/RCTSliderManager.h → Libraries/AppDelegate/RCTLegacyInteropComponents.mm} +7 -2
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +26 -5
- package/Libraries/BatchedBridge/MessageQueue.js +2 -1
- package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
- package/Libraries/BatchedBridge/NativeModules.js +1 -0
- package/Libraries/Blob/Blob.js +10 -0
- package/Libraries/Blob/FileReader.js +30 -2
- package/Libraries/Blob/React-RCTBlob.podspec +15 -2
- package/Libraries/Blob/URL.js +3 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
- package/Libraries/Components/Button.js +3 -2
- package/Libraries/Components/Clipboard/Clipboard.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
- package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
- package/Libraries/Components/Pressable/Pressable.js +1 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
- package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +149 -91
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -0
- package/Libraries/Components/Switch/Switch.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
- package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
- package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
- package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
- package/Libraries/Components/TextInput/TextInput.js +142 -108
- package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
- package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
- package/Libraries/Components/Touchable/Touchable.js +6 -3
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +179 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
- package/Libraries/Components/View/View.js +35 -16
- package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
- package/Libraries/Components/View/ViewAccessibility.js +10 -1
- package/Libraries/Components/View/ViewNativeComponent.js +32 -8
- package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
- package/Libraries/Components/View/ViewPropTypes.js +1 -1
- package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
- package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
- package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/InitializeCore.js +2 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +1 -9
- package/Libraries/Core/Timers/JSTimers.js +1 -1
- package/Libraries/Core/Timers/immediateShim.js +1 -0
- package/Libraries/Core/Timers/queueMicrotask.js +1 -1
- package/Libraries/Core/setUpAlert.js +1 -1
- package/Libraries/Core/setUpDOM.js +18 -0
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpGlobals.js +5 -2
- package/Libraries/Core/setUpNavigator.js +6 -5
- package/Libraries/Core/setUpPerformance.js +23 -13
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Core/setUpSegmentFetcher.js +0 -41
- package/Libraries/Core/setUpTimers.js +2 -2
- package/Libraries/DOM/Geometry/DOMRect.js +82 -0
- package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
- package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
- package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
- package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
- package/Libraries/DOM/OldStyleCollections/DOMRectList.js.flow +27 -0
- package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
- package/Libraries/DOM/OldStyleCollections/HTMLCollection.js.flow +27 -0
- package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
- package/Libraries/DOM/OldStyleCollections/NodeList.js.flow +31 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +24 -0
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
- package/Libraries/Events/EventPolyfill.js +1 -1
- package/Libraries/FBLazyVector/BUCK +2 -2
- package/Libraries/FBLazyVector/FBLazyVector.podspec +1 -1
- package/Libraries/Image/AssetRegistry.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +3 -3
- package/Libraries/Image/Image.android.js +4 -1
- package/Libraries/Image/Image.d.ts +63 -2
- package/Libraries/Image/Image.ios.js +3 -0
- package/Libraries/Image/ImageBackground.js +1 -0
- package/Libraries/Image/ImageProps.js +1 -1
- package/Libraries/Image/ImageViewNativeComponent.js +4 -4
- package/Libraries/Image/ImageViewNativeComponent.js.flow +1 -4
- package/Libraries/Image/RCTImageCache.h +1 -1
- package/Libraries/Image/RCTImageCache.m +4 -4
- package/Libraries/Image/RCTImageView.mm +1 -1
- package/Libraries/Image/React-RCTImage.podspec +15 -2
- package/Libraries/Image/RelativeImageStub.js +1 -1
- package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Inspector/DevtoolsOverlay.js +26 -19
- package/Libraries/Inspector/ElementBox.js +4 -1
- package/Libraries/Inspector/Inspector.js +5 -6
- package/Libraries/Inspector/InspectorOverlay.js +3 -3
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
- package/Libraries/Interaction/PanResponder.js +5 -6
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
- package/Libraries/Linking/Linking.js +1 -4
- package/Libraries/LinkingIOS/React-RCTLinking.podspec +15 -2
- package/Libraries/Lists/FillRateHelper.js +4 -238
- package/Libraries/Lists/FlatList.d.ts +15 -22
- package/Libraries/Lists/FlatList.js +9 -6
- package/Libraries/Lists/FlatList.js.flow +4 -3
- package/Libraries/Lists/SectionList.d.ts +10 -6
- package/Libraries/Lists/SectionList.js +5 -3
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/Lists/ViewabilityHelper.js +8 -344
- package/Libraries/Lists/VirtualizeUtils.js +4 -244
- package/Libraries/Lists/VirtualizedList.js +10 -1867
- package/Libraries/Lists/VirtualizedListContext.js +6 -104
- package/Libraries/Lists/VirtualizedSectionList.js +9 -602
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
- package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
- package/Libraries/Modal/Modal.js +2 -2
- package/Libraries/NativeAnimation/Nodes/RCTColorAnimatedNode.m +3 -2
- package/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h +14 -0
- package/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m +108 -102
- package/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +1 -1
- package/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m +6 -1
- package/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h +1 -1
- package/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m +5 -0
- package/Libraries/NativeAnimation/RCTAnimationUtils.h +16 -11
- package/Libraries/NativeAnimation/RCTAnimationUtils.m +24 -6
- package/Libraries/NativeAnimation/React-RCTAnimation.podspec +15 -2
- package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
- package/Libraries/NativeComponent/ViewConfig.js +1 -0
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
- package/Libraries/Network/RCTNetworking.android.js +2 -2
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.mm +3 -2
- package/Libraries/Network/React-RCTNetwork.podspec +15 -2
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/Pressability/Pressability.js +10 -4
- package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +15 -2
- package/Libraries/RCTRequired/BUCK +3 -2
- package/Libraries/RCTRequired/RCTRequired.podspec +1 -1
- package/Libraries/ReactNative/AppContainer.js +7 -1
- package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
- package/Libraries/ReactNative/AppRegistry.js +10 -13
- package/Libraries/ReactNative/FabricUIManager.js +24 -8
- package/Libraries/ReactNative/NativeUIManager.js +5 -5
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
- package/Libraries/ReactNative/UIManager.js +142 -1
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
- package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
- package/Libraries/Renderer/REVISION +1 -1
- package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +6 -6
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Settings/React-RCTSettings.podspec +15 -2
- package/Libraries/Share/Share.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
- package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
- package/Libraries/StyleSheet/flattenStyle.js +2 -0
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processColor.js +1 -1
- package/Libraries/Text/React-RCTText.podspec +1 -1
- package/Libraries/Text/Text/NSTextStorage+FontScaling.m +3 -3
- package/Libraries/Text/Text/RCTTextView.m +4 -4
- package/Libraries/Text/Text.d.ts +12 -2
- package/Libraries/Text/Text.js +50 -41
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +1 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +12 -6
- package/Libraries/Text/TextProps.js +3 -4
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/TypeSafety/RCTConvertHelpers.h +1 -1
- package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
- package/Libraries/Types/CodegenTypes.js +1 -0
- package/Libraries/UTFSequence.js +3 -1
- package/Libraries/Utilities/Appearance.d.ts +10 -0
- package/Libraries/Utilities/Appearance.js +13 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
- package/Libraries/Utilities/HMRClient.js +16 -10
- package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
- package/Libraries/Utilities/IPerformanceLogger.js +49 -0
- package/Libraries/Utilities/LoadingView.android.js +28 -11
- package/Libraries/Utilities/NativeAppearance.js +1 -0
- package/Libraries/Utilities/PixelRatio.js +2 -2
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +2 -0
- package/Libraries/Utilities/createPerformanceLogger.js +55 -43
- package/Libraries/Utilities/stringifySafe.js +2 -7
- package/Libraries/Utilities/useWindowDimensions.js +3 -3
- package/Libraries/Vibration/React-RCTVibration.podspec +15 -2
- package/Libraries/WebPerformance/EventCounts.js +78 -0
- package/Libraries/WebPerformance/MemoryInfo.js +54 -0
- package/Libraries/WebPerformance/NativePerformance.cpp +74 -0
- package/Libraries/WebPerformance/NativePerformance.h +76 -0
- package/Libraries/WebPerformance/NativePerformance.js +38 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.cpp +69 -11
- package/Libraries/WebPerformance/NativePerformanceObserver.h +38 -7
- package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
- package/Libraries/WebPerformance/Performance.js +312 -0
- package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
- package/Libraries/WebPerformance/PerformanceEntryReporter.cpp +408 -0
- package/Libraries/WebPerformance/PerformanceEntryReporter.h +219 -0
- package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
- package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
- package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
- package/Libraries/WebSocket/RCTReconnectingWebSocket.m +10 -10
- package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
- package/Libraries/vendor/core/ErrorUtils.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
- package/Libraries/vendor/emitter/EventEmitter.js +9 -1
- package/README.md +1 -1
- package/React/Base/RCTBridge+Private.h +1 -1
- package/React/Base/RCTBridge.h +2 -11
- package/React/Base/RCTBridge.m +0 -34
- package/React/Base/RCTBridgeModuleDecorator.h +1 -1
- package/React/Base/RCTBundleURLProvider.mm +5 -1
- package/React/Base/RCTConvert.h +2 -1
- package/React/Base/RCTConvert.m +28 -15
- package/React/Base/RCTDefines.h +37 -8
- package/React/Base/RCTDisplayLink.m +7 -0
- package/React/Base/RCTJSScriptLoaderModule.h +5 -1
- package/React/Base/RCTRootContentView.h +1 -1
- package/React/Base/RCTRootContentView.m +1 -1
- package/React/Base/RCTRootView.m +1 -1
- package/React/Base/RCTVersion.m +3 -3
- package/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +3 -3
- package/React/CoreModules/BUCK +3 -6
- package/React/CoreModules/RCTAccessibilityManager+Internal.h +1 -1
- package/React/CoreModules/RCTAlertManager.mm +0 -14
- package/React/CoreModules/RCTAppearance.h +1 -0
- package/React/CoreModules/RCTAppearance.mm +12 -0
- package/React/CoreModules/RCTDevLoadingView.h +0 -1
- package/React/CoreModules/RCTDevMenu.mm +2 -2
- package/React/CoreModules/RCTDevSettings.mm +16 -2
- package/React/CoreModules/RCTDevSplitBundleLoader.mm +6 -4
- package/React/CoreModules/RCTExceptionsManager.mm +13 -6
- package/React/CoreModules/RCTFPSGraph.m +8 -3
- package/React/CoreModules/RCTPlatform.mm +2 -2
- package/React/CoreModules/RCTTiming.h +8 -4
- package/React/CoreModules/RCTWebSocketExecutor.mm +10 -10
- package/React/CoreModules/RCTWebSocketModule.mm +13 -13
- package/React/CoreModules/React-CoreModules.podspec +16 -2
- package/React/CxxBridge/RCTCxxBridge.mm +3 -2
- package/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +1 -10
- package/React/CxxModule/RCTNativeModule.mm +3 -2
- package/React/CxxUtils/RCTFollyConvert.mm +1 -0
- package/React/DevSupport/RCTInspectorDevServerHelper.h +1 -1
- package/React/DevSupport/RCTInspectorDevServerHelper.mm +1 -1
- package/React/DevSupport/RCTPackagerConnection.mm +1 -1
- package/React/FBReactNativeSpec/FBReactNativeSpec.podspec +1 -1
- package/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +1 -2
- package/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +0 -1
- package/React/{Views/RCTDatePicker.h → Fabric/Mounting/ComponentViews/ScrollView/RCTCustomPullToRefreshViewProtocol.h} +4 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h +2 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +2 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +91 -1
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +14 -24
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +9 -5
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +0 -2
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +0 -2
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +0 -6
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +1 -2
- package/React/Fabric/Mounting/RCTComponentViewFactory.mm +16 -16
- package/React/Fabric/Mounting/RCTComponentViewRegistry.mm +4 -3
- package/React/Fabric/Mounting/RCTMountingManager.h +2 -1
- package/React/Fabric/Mounting/RCTMountingManager.mm +12 -14
- package/React/Fabric/RCTConversions.h +0 -1
- package/React/Fabric/RCTScheduler.h +1 -1
- package/React/Fabric/RCTScheduler.mm +2 -11
- package/React/Fabric/RCTSurfacePointerHandler.h +28 -0
- package/React/Fabric/RCTSurfacePointerHandler.mm +882 -0
- package/React/Fabric/RCTSurfacePresenter.h +1 -1
- package/React/Fabric/RCTSurfacePresenter.mm +16 -6
- package/React/Fabric/RCTSurfaceRegistry.mm +5 -6
- package/React/Fabric/RCTSurfaceTouchHandler.mm +27 -600
- package/React/Fabric/Utils/RCTIdentifierPool.h +44 -0
- package/React/Fabric/Utils/RCTReactTaggedView.h +1 -1
- package/React/Inspector/RCTInspector.h +1 -1
- package/React/Inspector/RCTInspector.mm +1 -2
- package/React/Inspector/RCTInspectorPackagerConnection.h +1 -1
- package/React/Inspector/RCTInspectorPackagerConnection.m +11 -11
- package/React/Modules/RCTEventEmitter.m +14 -11
- package/React/Profiler/RCTProfileTrampoline-x86_64.S +1 -1
- package/React/React-RCTFabric.podspec +31 -4
- package/React/Views/RCTComponentData.m +3 -15
- package/React/Views/RCTConvert+Transform.m +1 -1
- package/React/Views/RCTFont.mm +2 -2
- package/React/Views/RCTView.h +11 -0
- package/React/Views/RCTView.m +40 -18
- package/React/Views/RCTViewManager.m +17 -1
- package/React/Views/RefreshControl/RCTRefreshControl.h +1 -1
- package/React/Views/RefreshControl/RCTRefreshControl.m +7 -0
- package/React/Views/SafeAreaView/RCTSafeAreaShadowView.m +1 -1
- package/React/Views/ScrollView/RCTScrollView.m +17 -7
- package/React/Views/ScrollView/RCTScrollableProtocol.h +5 -1
- package/React-Core.podspec +15 -4
- package/React.podspec +1 -1
- package/ReactAndroid/build.gradle +82 -12
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +2 -0
- package/ReactAndroid/gradle.properties +6 -6
- package/ReactAndroid/hermes-engine/build.gradle +14 -5
- package/ReactAndroid/libs/BUCK +1 -1
- package/ReactAndroid/proguard-rules.pro +7 -0
- package/ReactAndroid/publish.gradle +1 -1
- package/ReactAndroid/src/main/java/com/facebook/BUCK +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/BUCK +15 -14
- package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +54 -2
- package/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java +7 -35
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +12 -11
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +10 -8
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +9 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +111 -14
- package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +63 -55
- package/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/animated/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java +143 -88
- package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +9 -22
- package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java +7 -16
- package/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java +8 -1
- package/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/BUCK +14 -19
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.java +11 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/DimensionPropConverter.java +33 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSONArguments.java +110 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +30 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java +13 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java +49 -63
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java +0 -12
- package/ReactAndroid/src/main/java/com/facebook/react/common/BUCK +4 -7
- package/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/BUCK +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/MapBuffer.kt +18 -2
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/WritableMapBuffer.kt +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +29 -25
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +29 -7
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +16 -16
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK +6 -9
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java +18 -2
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/{DevLoadingViewController.java → DefaultDevLoadingViewImplementation.java} +10 -33
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java +15 -7
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +38 -12
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxModule.java +1 -6
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerftestDevSupportManager.java +56 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevLoadingViewManager.java +21 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/.clang-tidy +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK +10 -13
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java +3 -24
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/DevToolsReactPerfLogger.java +22 -3
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +1 -14
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +6 -37
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java +2 -5
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +0 -4
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +9 -7
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +0 -11
- package/ReactAndroid/src/main/java/com/facebook/react/modules/.clang-tidy +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java +12 -23
- package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java +11 -9
- package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/BUCK +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java +3 -14
- package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/FileReaderModule.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/BUCK +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java +1 -9
- package/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageStoreManager.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java +3 -12
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/HeadlessJsTaskSupportModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java +2 -12
- package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java +5 -15
- package/ReactAndroid/src/main/java/com/facebook/react/modules/devloading/BUCK +25 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/devloading/DevLoadingModule.java +67 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolssettings/BUCK +25 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolssettings/DevToolsSettingsManagerModule.java +53 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/BUCK +2 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java +2 -13
- package/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/BUCK +0 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/BUCK +6 -9
- package/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java +29 -11
- package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java +1 -9
- package/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.java +1 -9
- package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java +48 -14
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java +66 -63
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ResponseUtil.java +26 -25
- package/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/sound/BUCK +0 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/BUCK +4 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java +1 -6
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java +2 -14
- package/ReactAndroid/src/main/java/com/facebook/react/processing/BUCK +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java +47 -26
- package/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK +8 -10
- package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +188 -4
- package/ReactAndroid/src/main/java/com/facebook/react/surface/BUCK +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/.clang-tidy +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java +57 -63
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK +7 -14
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +12 -14
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewGroupManager.java +26 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewManagerWithChildren.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java +95 -53
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +36 -20
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +10 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +355 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/Spacing.java +21 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java +9 -11
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +16 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +1 -55
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java +5 -11
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +15 -6
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java +16 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/BUCK +4 -7
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.java +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.java +23 -11
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEventHelper.java +12 -38
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java +0 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/common/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/BUCK +7 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.java +30 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java +11 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/BUCK +10 -15
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java +10 -11
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java +4 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK +2 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +15 -12
- package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/BUCK +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java +6 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/BUCK +4 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +181 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +77 -9
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java +12 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +72 -13
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java +9 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java +10 -6
- package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/BUCK +5 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/BUCK +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +8 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +7 -6
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +7 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +9 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java +13 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +23 -20
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java +5 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +22 -16
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +17 -17
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/BUCK +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java +6 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +34 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +28 -15
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +4 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/{slider → traceupdateoverlay}/BUCK +7 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/traceupdateoverlay/TraceUpdateOverlay.java +70 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/traceupdateoverlay/TraceUpdateOverlayManager.java +83 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/BUCK +5 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK +6 -9
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java +2 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt +17 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +147 -32
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java +18 -6
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt +5 -5
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java +0 -8
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java +0 -11
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +5 -1
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java +1 -2
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +1 -8
- package/ReactAndroid/src/main/java/com/facebook/yoga/annotations/DoNotStrip.java +18 -0
- package/ReactAndroid/src/main/jni/CMakeLists.txt +112 -3
- package/ReactAndroid/src/main/jni/CircularDepsValidator.cmake +32 -0
- package/ReactAndroid/src/main/jni/first-party/.clang-tidy +1 -0
- package/ReactAndroid/src/main/jni/first-party/fb/CMakeLists.txt +3 -0
- package/ReactAndroid/src/main/jni/first-party/yogajni/BUCK +1 -1
- package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h +0 -1
- package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +0 -15
- package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h +4 -4
- package/ReactAndroid/src/main/jni/react/fabric/BUCK +0 -2
- package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +20 -49
- package/ReactAndroid/src/main/jni/react/fabric/Binding.h +5 -10
- package/ReactAndroid/src/main/jni/react/fabric/CMakeLists.txt +0 -2
- package/ReactAndroid/src/main/jni/react/fabric/ComponentFactory.h +1 -7
- package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +2 -3
- package/ReactAndroid/src/main/jni/react/fabric/EventEmitterWrapper.cpp +3 -2
- package/ReactAndroid/src/main/jni/react/fabric/FabricMountItem.h +1 -2
- package/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +32 -66
- package/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h +2 -6
- package/ReactAndroid/src/main/jni/react/fabric/JBackgroundExecutor.h +1 -3
- package/ReactAndroid/src/main/jni/react/fabric/JFabricUIManager.h +2 -3
- package/ReactAndroid/src/main/jni/react/fabric/OnLoad.cpp +0 -2
- package/ReactAndroid/src/main/jni/react/fabric/StateWrapperImpl.cpp +3 -7
- package/ReactAndroid/src/main/jni/react/fabric/SurfaceHandlerBinding.cpp +2 -2
- package/ReactAndroid/src/main/jni/react/fabric/SurfaceHandlerBinding.h +3 -1
- package/ReactAndroid/src/main/jni/react/fabric/viewPropConversions.h +10 -2
- package/ReactAndroid/src/main/jni/react/hermes/instrumentation/BUCK +1 -1
- package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +1 -0
- package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp +1 -5
- package/ReactAndroid/src/main/jni/react/jni/.clang-tidy +1 -0
- package/ReactAndroid/src/main/jni/react/jni/BUCK +5 -4
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +2 -0
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h +4 -8
- package/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +9 -2
- package/ReactAndroid/src/main/jni/react/jni/JReactMarker.h +1 -0
- package/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp +2 -2
- package/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h +2 -2
- package/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp +2 -2
- package/ReactAndroid/src/main/jni/react/jni/NativeArray.cpp +1 -3
- package/ReactAndroid/src/main/jni/react/jni/NativeArray.h +13 -3
- package/ReactAndroid/src/main/jni/react/jni/NativeMap.cpp +2 -2
- package/ReactAndroid/src/main/jni/react/jni/NativeMap.h +10 -4
- package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +6 -0
- package/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp +0 -6
- package/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.h +4 -1
- package/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.cpp +11 -7
- package/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.h +2 -2
- package/ReactAndroid/src/main/jni/react/jscexecutor/OnLoad.cpp +1 -5
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp +9 -43
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h +2 -9
- package/ReactAndroid/src/main/libraries/fbcore/src/main/java/com/facebook/common/logging/BUCK +1 -1
- package/ReactAndroid/src/main/libraries/fresco/fresco-react-native/BUCK +15 -15
- package/ReactAndroid/src/main/res/devsupport/values-af/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ar/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-as/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-az/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-be/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-bg/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-bn/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-bs/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ca/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-cb/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-cs/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-da/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-de/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-el/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-en-rGB/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-es/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-es-rES/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-et/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fa/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fb/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fb-rLS/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fi/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fr/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-fr-rCA/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-gu/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ha/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-hi/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-hr/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-hu/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-hy/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-in/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-is/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-it/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-iw/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ja/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-jv/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-ka/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-kk/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-km/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-kn/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ko/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ku/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-ky/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-lo/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-lt/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-lv/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-mk/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ml/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-mn/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-mr/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ms/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-my/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-nb/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ne/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-nl/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-pa/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-pl/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ps/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-pt/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-pt-rPT/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-qz/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ro/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ru/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-si/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sk/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sl/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sn/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-so/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-sq/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sr/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sv/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-sw/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ta/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-te/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-tg/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-th/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-tk/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-tl/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-tr/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-uk/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-ur/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-uz/strings.xml +6 -0
- package/ReactAndroid/src/main/res/devsupport/values-vi/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-wo/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-zh-rCN/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-zh-rHK/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-zh-rTW/strings.xml +0 -1
- package/ReactAndroid/src/main/res/devsupport/values-zu/strings.xml +0 -1
- package/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +4 -1
- package/ReactCommon/React-Fabric.podspec +43 -49
- package/ReactCommon/React-rncore.podspec +2 -1
- package/ReactCommon/ReactCommon.podspec +8 -17
- package/ReactCommon/butter/BUCK +1 -9
- package/ReactCommon/butter/function.h +51 -0
- package/ReactCommon/butter/map.h +3 -3
- package/ReactCommon/callinvoker/.clang-tidy +1 -0
- package/ReactCommon/callinvoker/BUCK +0 -1
- package/ReactCommon/callinvoker/React-callinvoker.podspec +1 -1
- package/ReactCommon/callinvoker/ReactCommon/CallInvoker.h +11 -2
- package/ReactCommon/{butter/mutex.h → callinvoker/ReactCommon/SchedulerPriority.h} +10 -6
- package/ReactCommon/cxxreact/.clang-tidy +1 -0
- package/ReactCommon/cxxreact/BUCK +3 -1
- package/ReactCommon/cxxreact/CMakeLists.txt +1 -0
- package/ReactCommon/cxxreact/Instance.h +2 -2
- package/ReactCommon/cxxreact/JSBigString.h +5 -5
- package/ReactCommon/cxxreact/JSExecutor.cpp +12 -0
- package/ReactCommon/cxxreact/JSExecutor.h +2 -0
- package/ReactCommon/cxxreact/MethodCall.cpp +3 -3
- package/ReactCommon/cxxreact/ModuleRegistry.cpp +5 -6
- package/ReactCommon/cxxreact/ModuleRegistry.h +3 -3
- package/ReactCommon/cxxreact/NativeModule.h +2 -2
- package/ReactCommon/cxxreact/React-cxxreact.podspec +3 -2
- package/ReactCommon/cxxreact/ReactMarker.cpp +55 -2
- package/ReactCommon/cxxreact/ReactMarker.h +36 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
- package/ReactCommon/hermes/.clang-tidy +1 -0
- package/ReactCommon/hermes/React-hermes.podspec +3 -2
- package/ReactCommon/hermes/executor/CMakeLists.txt +8 -1
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +6 -20
- package/ReactCommon/hermes/inspector/BUCK +12 -6
- package/ReactCommon/hermes/inspector/CMakeLists.txt +1 -1
- package/ReactCommon/hermes/inspector/DEFS.bzl +2 -2
- package/ReactCommon/hermes/inspector/Inspector.cpp +2 -2
- package/ReactCommon/hermes/inspector/Inspector.h +7 -7
- package/ReactCommon/hermes/inspector/InspectorState.h +5 -5
- package/ReactCommon/hermes/inspector/README.md +7 -7
- package/ReactCommon/hermes/inspector/RuntimeAdapter.h +1 -1
- package/ReactCommon/hermes/inspector/chrome/Connection.cpp +12 -12
- package/ReactCommon/hermes/inspector/chrome/MessageConverters.h +3 -3
- package/ReactCommon/hermes/inspector/chrome/MessageTypes.h +96 -97
- package/ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h +4 -3
- package/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp +39 -38
- package/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp +67 -64
- package/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp +3 -3
- package/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h +3 -3
- package/ReactCommon/hermes/inspector/detail/SerialExecutor.h +1 -1
- package/ReactCommon/hermes/inspector/tools/format +1 -1
- package/ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh +4 -4
- package/ReactCommon/jsc/CMakeLists.txt +4 -0
- package/ReactCommon/jsc/JSCRuntime.cpp +11 -9
- package/ReactCommon/jsc/React-jsc.podspec +1 -1
- package/ReactCommon/jsengineinstance/.clang-tidy +1 -0
- package/ReactCommon/jserrorhandler/BUCK +1 -1
- package/ReactCommon/jsi/.clang-tidy +1 -0
- package/ReactCommon/jsi/React-jsi.podspec +1 -1
- package/ReactCommon/jsi/jsi/decorator.h +16 -10
- package/ReactCommon/jsi/jsi/jsi-inl.h +7 -5
- package/ReactCommon/jsi/jsi/jsi.cpp +51 -61
- package/ReactCommon/jsi/jsi/jsi.h +22 -16
- package/ReactCommon/jsiexecutor/.clang-tidy +1 -0
- package/ReactCommon/jsiexecutor/CMakeLists.txt +5 -1
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +3 -2
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +16 -16
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +7 -7
- package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +7 -7
- package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h +3 -3
- package/ReactCommon/jsinspector/.clang-tidy +1 -0
- package/ReactCommon/jsinspector/CMakeLists.txt +3 -1
- package/ReactCommon/jsinspector/React-jsinspector.podspec +2 -1
- package/ReactCommon/libraries/fbcore/src/test/java/com/facebook/powermock/BUCK +3 -3
- package/ReactCommon/logger/React-logger.podspec +1 -1
- package/ReactCommon/react/bridging/BUCK +1 -2
- package/ReactCommon/react/bridging/Base.h +3 -3
- package/ReactCommon/react/bridging/CallbackWrapper.h +3 -39
- package/ReactCommon/react/bridging/Function.h +36 -17
- package/ReactCommon/react/bridging/LongLivedObject.cpp +6 -13
- package/ReactCommon/react/bridging/LongLivedObject.h +9 -8
- package/ReactCommon/react/bridging/Number.h +11 -0
- package/ReactCommon/react/bridging/tests/BridgingTest.cpp +16 -1
- package/ReactCommon/react/config/.clang-tidy +1 -0
- package/ReactCommon/react/config/ReactNativeConfig.cpp +3 -0
- package/ReactCommon/react/config/ReactNativeConfig.h +1 -1
- package/ReactCommon/react/debug/CMakeLists.txt +4 -0
- package/ReactCommon/react/debug/flags.h +3 -1
- package/ReactCommon/react/debug/react_native_assert.h +6 -0
- package/ReactCommon/react/debug/react_native_expect.h +41 -0
- package/ReactCommon/react/nativemodule/.clang-tidy +1 -0
- package/ReactCommon/react/nativemodule/core/BUCK +3 -1
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp +6 -1
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.cpp +26 -8
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h +31 -3
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +39 -44
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h +5 -14
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp +2 -2
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +28 -48
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h +3 -9
- package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +56 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/{RCTBlockGuard.h → ReactCommon/RCTBlockGuard.h} +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/{RCTTurboModule.h → ReactCommon/RCTTurboModule.h} +0 -6
- package/ReactCommon/react/nativemodule/core/platform/ios/{RCTTurboModule.mm → ReactCommon/RCTTurboModule.mm} +24 -51
- package/ReactCommon/react/nativemodule/core/platform/ios/{RCTTurboModuleManager.h → ReactCommon/RCTTurboModuleManager.h} +5 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/{RCTTurboModuleManager.mm → ReactCommon/RCTTurboModuleManager.mm} +14 -69
- package/ReactCommon/react/nativemodule/samples/BUCK +3 -1
- package/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp +12 -0
- package/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h +1 -0
- package/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp +4 -0
- package/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h +1 -0
- package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +59 -0
- package/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +3 -0
- package/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp +15 -0
- package/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java +8 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTNativeSampleTurboModuleSpec.h → ReactCommon/RCTNativeSampleTurboModuleSpec.h} +1 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTNativeSampleTurboModuleSpec.mm → ReactCommon/RCTNativeSampleTurboModuleSpec.mm} +11 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTSampleTurboModule.mm → ReactCommon/RCTSampleTurboModule.mm} +5 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/{SampleTurboCxxModuleLegacyImpl.cpp → ReactCommon/SampleTurboCxxModuleLegacyImpl.cpp} +10 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/{SampleTurboCxxModuleLegacyImpl.h → ReactCommon/SampleTurboCxxModuleLegacyImpl.h} +1 -0
- package/ReactCommon/react/renderer/.clang-tidy +7 -0
- package/ReactCommon/react/renderer/animations/BUCK +2 -0
- package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +41 -65
- package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +3 -20
- package/ReactCommon/react/renderer/attributedstring/AttributedString.h +1 -1
- package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +1 -1
- package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +1 -1
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +1 -1
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -1
- package/ReactCommon/react/renderer/attributedstring/conversions.h +48 -49
- package/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp +1 -1
- package/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp +1 -1
- package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp +4 -4
- package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h +4 -5
- package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +5 -5
- package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +2 -2
- package/ReactCommon/react/renderer/components/image/ImageProps.cpp +9 -7
- package/ReactCommon/react/renderer/components/image/conversions.h +4 -4
- package/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h +1 -2
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/CMakeLists.txt +31 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerInteropComponentDescriptor.h +38 -0
- package/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +1 -2
- package/ReactCommon/react/renderer/components/root/RootProps.cpp +4 -4
- package/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp +3 -3
- package/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h +1 -1
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h +0 -1
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +50 -36
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h +4 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h +4 -1
- package/ReactCommon/react/renderer/components/scrollview/conversions.h +35 -0
- package/ReactCommon/react/renderer/components/scrollview/primitives.h +17 -0
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +1 -1
- package/ReactCommon/react/renderer/components/text/BaseTextProps.h +0 -1
- package/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp +1 -0
- package/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp +59 -0
- package/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.h +59 -0
- package/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +4 -2
- package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +13 -15
- package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h +2 -6
- package/ReactCommon/react/renderer/components/text/ParagraphState.h +8 -11
- package/ReactCommon/react/renderer/components/text/RawTextShadowNode.h +4 -25
- package/ReactCommon/react/renderer/components/text/TextProps.h +0 -1
- package/ReactCommon/react/renderer/components/text/TextShadowNode.h +5 -23
- package/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp +7 -10
- package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +56 -50
- package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h +0 -1
- package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp +2 -1
- package/ReactCommon/react/renderer/components/textinput/iostextinput/BUCK +3 -0
- package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputEventEmitter.cpp → react/renderer/components/iostextinput/TextInputEventEmitter.cpp} +31 -1
- package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputEventEmitter.h → react/renderer/components/iostextinput/TextInputEventEmitter.h} +5 -0
- package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputProps.cpp → react/renderer/components/iostextinput/TextInputProps.cpp} +1 -1
- package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputShadowNode.cpp → react/renderer/components/iostextinput/TextInputShadowNode.cpp} +2 -1
- package/ReactCommon/react/renderer/components/textinput/iostextinput/{propsConversions.h → react/renderer/components/iostextinput/propsConversions.h} +4 -3
- package/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h +1 -1
- package/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +3 -3
- package/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +21 -20
- package/ReactCommon/react/renderer/components/view/AccessibilityPropsMapBuffer.cpp +0 -2
- package/ReactCommon/react/renderer/components/view/AccessibilityPropsMapBuffer.h +4 -2
- package/ReactCommon/react/renderer/components/view/BUCK +1 -0
- package/ReactCommon/react/renderer/components/view/PointerEvent.h +1 -1
- package/ReactCommon/react/renderer/components/view/Touch.h +1 -1
- package/ReactCommon/react/renderer/components/view/ViewProps.cpp +63 -74
- package/ReactCommon/react/renderer/components/view/ViewProps.h +0 -1
- package/ReactCommon/react/renderer/components/view/ViewPropsMapBuffer.cpp +1 -1
- package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +207 -91
- package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +28 -31
- package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +155 -7
- package/ReactCommon/react/renderer/components/view/YogaStylableProps.h +38 -1
- package/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +10 -7
- package/ReactCommon/react/renderer/components/view/conversions.h +133 -59
- package/ReactCommon/react/renderer/components/view/primitives.h +49 -18
- package/ReactCommon/react/renderer/components/view/propsConversions.h +65 -8
- package/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +88 -2
- package/ReactCommon/react/renderer/components/view/viewPropConversions.h +21 -3
- package/ReactCommon/react/renderer/core/BUCK +7 -3
- package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +1 -1
- package/ReactCommon/react/renderer/core/CoreFeatures.cpp +3 -0
- package/ReactCommon/react/renderer/core/CoreFeatures.h +15 -1
- package/ReactCommon/react/renderer/core/DynamicPropsUtilities.cpp +1 -0
- package/ReactCommon/react/renderer/core/DynamicPropsUtilities.h +8 -4
- package/ReactCommon/react/renderer/core/EventBeat.h +1 -1
- package/ReactCommon/react/renderer/core/EventDispatcher.cpp +10 -4
- package/ReactCommon/react/renderer/core/EventDispatcher.h +1 -1
- package/ReactCommon/react/renderer/core/EventListener.cpp +3 -3
- package/ReactCommon/react/renderer/core/EventListener.h +2 -3
- package/ReactCommon/react/renderer/core/EventLogger.cpp +22 -0
- package/ReactCommon/react/renderer/core/EventLogger.h +44 -0
- package/ReactCommon/react/renderer/core/EventQueueProcessor.cpp +12 -2
- package/ReactCommon/react/renderer/core/LayoutConstraints.h +1 -1
- package/ReactCommon/react/renderer/core/LayoutContext.h +0 -1
- package/ReactCommon/react/renderer/core/LayoutMetrics.h +2 -1
- package/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +16 -2
- package/ReactCommon/react/renderer/core/LayoutableShadowNode.h +2 -26
- package/ReactCommon/react/renderer/core/PropsMacros.h +21 -7
- package/ReactCommon/react/renderer/core/PropsMapBuffer.cpp +2 -3
- package/ReactCommon/react/renderer/core/PropsMapBuffer.h +1 -0
- package/ReactCommon/react/renderer/core/RawEvent.h +2 -0
- package/ReactCommon/react/renderer/core/RawProps.h +1 -1
- package/ReactCommon/react/renderer/core/RawPropsKeyMap.h +1 -1
- package/ReactCommon/react/renderer/core/RawPropsPrimitives.h +1 -1
- package/ReactCommon/react/renderer/core/Sealable.h +2 -2
- package/ReactCommon/react/renderer/core/ShadowNode.cpp +27 -3
- package/ReactCommon/react/renderer/core/ShadowNode.h +6 -20
- package/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +3 -3
- package/ReactCommon/react/renderer/core/ShadowNodeFamily.h +9 -2
- package/ReactCommon/react/renderer/core/ShadowNodeTraits.h +6 -11
- package/ReactCommon/react/renderer/core/TraitCast.h +90 -0
- package/ReactCommon/react/renderer/core/graphicsConversions.h +260 -0
- package/ReactCommon/react/renderer/core/propsConversions.h +1 -2
- package/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp +2 -2
- package/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp +147 -1
- package/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +1 -1
- package/ReactCommon/react/renderer/core/tests/traitCastTest.cpp +12 -2
- package/ReactCommon/react/renderer/debug/DebugStringConvertible.h +9 -0
- package/ReactCommon/react/renderer/debug/SystraceSection.h +13 -3
- package/ReactCommon/react/renderer/element/BUCK +2 -0
- package/ReactCommon/react/renderer/element/CMakeLists.txt +29 -0
- package/ReactCommon/react/renderer/graphics/BUCK +9 -12
- package/ReactCommon/react/renderer/graphics/CMakeLists.txt +4 -8
- package/ReactCommon/react/renderer/graphics/{platform/cxx/react/renderer/graphics/Color.cpp → Color.cpp} +1 -1
- package/ReactCommon/react/renderer/graphics/{platform/ios/Color.h → Color.h} +12 -16
- package/ReactCommon/react/renderer/graphics/Geometry.h +3 -12
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +18 -3
- package/ReactCommon/react/renderer/graphics/RectangleEdges.h +11 -1
- package/ReactCommon/react/renderer/graphics/Transform.h +5 -2
- package/{ReactAndroid/src/main/jni/react/jni/NativeTime.h → ReactCommon/react/renderer/graphics/Vector.h} +8 -1
- package/ReactCommon/react/renderer/graphics/conversions.h +18 -252
- package/ReactCommon/{yoga/yoga/internal/experiments.h → react/renderer/graphics/platform/android/react/renderer/graphics/Float.h} +8 -12
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +0 -1
- package/ReactCommon/react/renderer/graphics/platform/ios/{RCTPlatformColorUtils.mm → react/renderer/graphics/RCTPlatformColorUtils.mm} +1 -2
- package/ReactCommon/react/renderer/imagemanager/BUCK +4 -2
- package/ReactCommon/react/renderer/imagemanager/ImageRequest.h +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +64 -0
- package/ReactCommon/react/renderer/imagemanager/platform/ios/{ImageManager.mm → react/renderer/imagemanager/ImageManager.mm} +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/{ImageRequest.cpp → react/renderer/imagemanager/ImageRequest.cpp} +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTImageManager.h → react/renderer/imagemanager/RCTImageManager.h} +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTSyncImageManager.h → react/renderer/imagemanager/RCTSyncImageManager.h} +1 -1
- package/ReactCommon/react/renderer/imagemanager/primitives.h +2 -1
- package/ReactCommon/react/renderer/mapbuffer/MapBuffer.h +4 -2
- package/ReactCommon/react/renderer/mounting/Differentiator.cpp +1 -1
- package/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +2 -2
- package/ReactCommon/react/renderer/mounting/MountingCoordinator.h +1 -1
- package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +21 -17
- package/ReactCommon/react/renderer/mounting/ShadowTree.h +11 -5
- package/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h +2 -2
- package/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp +11 -6
- package/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h +6 -3
- package/ReactCommon/react/renderer/mounting/ShadowView.cpp +1 -0
- package/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp +8 -8
- package/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp +8 -8
- package/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +2 -2
- package/ReactCommon/react/renderer/runtimescheduler/BUCK +1 -0
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +17 -5
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +6 -3
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp +3 -3
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp +11 -2
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h +4 -3
- package/ReactCommon/react/renderer/runtimescheduler/{SchedulerPriority.h → SchedulerPriorityUtils.h} +3 -28
- package/ReactCommon/react/renderer/runtimescheduler/Task.cpp +23 -6
- package/ReactCommon/react/renderer/runtimescheduler/Task.h +13 -7
- package/ReactCommon/react/renderer/runtimescheduler/primitives.h +15 -4
- package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +1 -1
- package/ReactCommon/react/renderer/runtimescheduler/tests/SchedulerPriorityTest.cpp +1 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +42 -10
- package/ReactCommon/react/renderer/scheduler/Scheduler.h +3 -1
- package/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +3 -5
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +32 -34
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +4 -3
- package/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +3 -3
- package/ReactCommon/react/renderer/scheduler/SurfaceManager.h +2 -1
- package/ReactCommon/react/renderer/telemetry/tests/TransactionTelemetryTest.cpp +1 -1
- package/ReactCommon/react/renderer/templateprocessor/BUCK +2 -0
- package/ReactCommon/react/renderer/textlayoutmanager/BUCK +4 -2
- package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +1 -0
- package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h +7 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp +9 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h +7 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{NSTextStorage+FontScaling.m → react/renderer/textlayoutmanager/NSTextStorage+FontScaling.m} +3 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTTextLayoutManager.h → react/renderer/textlayoutmanager/RCTTextLayoutManager.h} +10 -4
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTTextLayoutManager.mm → react/renderer/textlayoutmanager/RCTTextLayoutManager.mm} +38 -23
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{TextLayoutManager.h → react/renderer/textlayoutmanager/TextLayoutManager.h} +7 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{TextLayoutManager.mm → react/renderer/textlayoutmanager/TextLayoutManager.mm} +24 -3
- package/ReactCommon/react/renderer/timeline/TimelineController.h +1 -1
- package/ReactCommon/react/renderer/uimanager/BUCK +2 -0
- package/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp +4 -4
- package/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.h +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManager.cpp +158 -41
- package/ReactCommon/react/renderer/uimanager/UIManager.h +16 -3
- package/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h +8 -0
- package/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +86 -4
- package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +2 -1
- package/ReactCommon/react/renderer/uimanager/primitives.h +48 -24
- package/ReactCommon/react/utils/.clang-tidy +1 -0
- package/ReactCommon/react/utils/BUCK +6 -2
- package/ReactCommon/react/utils/ContextContainer.h +8 -8
- package/ReactCommon/react/utils/SharedFunction.h +4 -6
- package/ReactCommon/reactperflogger/.clang-tidy +1 -0
- package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -1
- package/ReactCommon/runtimeexecutor/.clang-tidy +1 -0
- package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +1 -1
- package/ReactCommon/yoga/yoga/CMakeLists.txt +41 -0
- package/ReactCommon/yoga/yoga/CompactValue.h +8 -0
- package/ReactCommon/yoga/yoga/Utils.cpp +1 -1
- package/ReactCommon/yoga/yoga/Utils.h +2 -4
- package/ReactCommon/yoga/yoga/YGEnums.cpp +4 -0
- package/ReactCommon/yoga/yoga/YGEnums.h +3 -1
- package/ReactCommon/yoga/yoga/YGLayout.h +1 -26
- package/ReactCommon/yoga/yoga/YGNode.cpp +0 -47
- package/ReactCommon/yoga/yoga/YGNode.h +0 -4
- package/ReactCommon/yoga/yoga/YGNodePrint.cpp +3 -1
- package/ReactCommon/yoga/yoga/Yoga-internal.h +6 -3
- package/ReactCommon/yoga/yoga/Yoga.cpp +55 -127
- package/ReactCommon/yoga/yoga/Yoga.h +0 -5
- package/ReactCommon/yoga/yoga/event/event.h +0 -5
- package/build.gradle.kts +0 -130
- package/flow/global.js +29 -4
- package/flow/jest.js +258 -164
- package/flow/use-sync-external-store.js +1 -0
- package/gradle.properties +0 -12
- package/index.js +56 -42
- package/interface.js +1 -1
- package/jest/local-setup.js +33 -0
- package/jest/mockComponent.js +4 -2
- package/jest/mockNativeComponent.js +1 -1
- package/jest/mockScrollView.js +2 -1
- package/jest/react-native-env.js +1 -3
- package/jest/setup.js +11 -8
- package/local-cli/cli.js +0 -0
- package/package.json +23 -101
- package/react-native.config.js +2 -2
- package/rn-get-polyfills.js +1 -1
- package/scripts/cocoapods/__tests__/codegen-test.rb +242 -0
- package/scripts/cocoapods/__tests__/codegen_utils-test.rb +589 -0
- package/scripts/cocoapods/__tests__/fabric-test.rb +68 -0
- package/scripts/cocoapods/__tests__/flipper-test.rb +153 -0
- package/scripts/cocoapods/__tests__/jsengine-test.rb +126 -0
- package/scripts/cocoapods/__tests__/local_podspec_patch-test.rb +167 -0
- package/scripts/cocoapods/__tests__/new_architecture-test.rb +297 -0
- package/scripts/cocoapods/__tests__/test_utils/CodegenScriptPhaseExtractorMock.rb +21 -0
- package/scripts/cocoapods/__tests__/test_utils/CodegenUtilsMock.rb +108 -0
- package/scripts/cocoapods/__tests__/test_utils/DirMock.rb +72 -0
- package/scripts/cocoapods/__tests__/test_utils/EnvironmentMock.rb +21 -0
- package/scripts/cocoapods/__tests__/test_utils/FileMock.rb +113 -0
- package/scripts/cocoapods/__tests__/test_utils/FileUtilsMock.rb +40 -0
- package/scripts/cocoapods/__tests__/test_utils/FinderMock.rb +28 -0
- package/scripts/cocoapods/__tests__/test_utils/InstallerMock.rb +222 -0
- package/scripts/cocoapods/__tests__/test_utils/LocalPodspecPatchMock.rb +14 -0
- package/scripts/cocoapods/__tests__/test_utils/Open3Mock.rb +43 -0
- package/scripts/cocoapods/__tests__/test_utils/PathnameMock.rb +42 -0
- package/scripts/cocoapods/__tests__/test_utils/PodMock.rb +144 -0
- package/scripts/cocoapods/__tests__/test_utils/SpecMock.rb +30 -0
- package/scripts/cocoapods/__tests__/test_utils/SysctlCheckerMock.rb +21 -0
- package/scripts/cocoapods/__tests__/test_utils/TargetDefinitionMock.rb +12 -0
- package/scripts/cocoapods/__tests__/test_utils/podSpy.rb +38 -0
- package/scripts/cocoapods/__tests__/test_utils/systemUtils.rb +14 -0
- package/scripts/cocoapods/__tests__/utils-test.rb +780 -0
- package/scripts/cocoapods/codegen.rb +23 -19
- package/scripts/cocoapods/codegen_utils.rb +73 -37
- package/scripts/cocoapods/fabric.rb +2 -2
- package/scripts/cocoapods/flipper.rb +1 -4
- package/scripts/cocoapods/jsengine.rb +1 -46
- package/scripts/cocoapods/local_podspec_patch.rb +6 -6
- package/scripts/cocoapods/new_architecture.rb +32 -4
- package/scripts/cocoapods/utils.rb +253 -19
- package/scripts/codegen/__test_fixtures__/fixtures.js +132 -0
- package/scripts/codegen/__tests__/generate-artifacts-executor-test.js +500 -0
- package/scripts/codegen/__tests__/generate-specs-cli-executor-test.js +88 -0
- package/scripts/codegen/codegen-utils.js +2 -2
- package/scripts/codegen/generate-artifacts-executor.js +45 -18
- package/scripts/codegen/generate-legacy-interop-components.js +123 -0
- package/scripts/find-node-for-xcode.sh +4 -1
- package/scripts/generate-provider-cli.js +1 -1
- package/scripts/hermes/prepare-hermes-for-build.js +1 -1
- package/scripts/packager.sh +3 -3
- package/scripts/react-native-xcode.sh +2 -3
- package/scripts/react_native_pods.rb +42 -21
- package/scripts/react_native_pods_utils/script_phases.rb +1 -1
- package/scripts/react_native_pods_utils/script_phases.sh +4 -4
- package/scripts/xcode/with-environment.sh +6 -6
- package/sdks/.hermesversion +1 -1
- package/sdks/hermes-engine/hermes-engine.podspec +21 -50
- package/sdks/hermes-engine/hermes-utils.rb +122 -4
- package/sdks/hermes-engine/utils/build-apple-framework.sh +12 -2
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +7 -0
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +9 -2
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +1 -16
- package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +30 -0
- package/sdks/hermesc/linux64-bin/hermesc +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/settings.gradle.kts +0 -33
- package/template/Gemfile +2 -2
- package/template/__tests__/{App-test.tsx → App.test.tsx} +3 -0
- package/template/_eslintrc.js +1 -1
- package/template/_gitignore +3 -0
- package/template/_watchmanconfig +1 -1
- package/template/android/app/build.gradle +2 -47
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +1 -4
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +1 -1
- package/template/android/build.gradle +1 -1
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/template/android/gradle.properties +1 -1
- package/template/android/gradlew +14 -4
- package/template/android/gradlew.bat +9 -6
- package/template/android/settings.gradle +1 -1
- package/template/app.json +1 -1
- package/template/ios/HelloWorld/AppDelegate.mm +0 -10
- package/template/ios/Podfile +8 -6
- package/template/jest.config.js +3 -0
- package/template/package.json +6 -7
- package/types/index.d.ts +2 -6
- package/types/modules/Codegen.d.ts +4 -4
- package/types/modules/globals.d.ts +27 -25
- package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
- package/types/public/ReactNativeRenderer.d.ts +2 -7
- package/types/tslint.json +2 -1
- package/CHANGELOG.md +0 -4860
- package/Libraries/.npmignore +0 -1
- package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
- package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
- package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
- package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
- package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
- package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
- package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
- package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
- package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
- package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
- package/Libraries/Components/Slider/Slider.d.ts +0 -132
- package/Libraries/Components/Slider/Slider.js +0 -282
- package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
- package/Libraries/Interaction/Batchinator.js +0 -76
- package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
- package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
- package/Libraries/Interaction/PanResponder.flow.js +0 -257
- package/Libraries/Lists/CellRenderMask.js +0 -155
- package/Libraries/Lists/ChildListCollection.js +0 -72
- package/Libraries/Lists/StateSafePureComponent.js +0 -85
- package/Libraries/Lists/VirtualizedList.d.ts +0 -347
- package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
- package/Libraries/Lists/VirtualizedListProps.js +0 -279
- package/Libraries/Performance/PureComponentDebug.js +0 -74
- package/Libraries/Reliability/UserFlow.js +0 -158
- package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
- package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
- package/Libraries/Utilities/MatrixMath.js +0 -748
- package/Libraries/Utilities/PixelRatio.js.flow +0 -21
- package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
- package/Libraries/Utilities/clamp.js +0 -23
- package/Libraries/Utilities/deprecatedPropType.js +0 -36
- package/Libraries/Utilities/groupByEveryN.js +0 -51
- package/Libraries/Utilities/mergeIntoFast.js +0 -26
- package/Libraries/Utilities/setAndForwardRef.js +0 -71
- package/Libraries/Utilities/truncate.js +0 -51
- package/Libraries/WebSocket/RCTSRWebSocket.h +0 -136
- package/Libraries/WebSocket/RCTSRWebSocket.m +0 -1746
- package/React/Base/RCTWeakProxy.m +0 -30
- package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +0 -21
- package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +0 -352
- package/React/Views/RCTDatePicker.m +0 -70
- package/React/Views/RCTDatePickerManager.h +0 -19
- package/React/Views/RCTDatePickerManager.m +0 -105
- package/React/Views/RCTProgressViewManager.h +0 -12
- package/React/Views/RCTProgressViewManager.m +0 -45
- package/React/Views/RCTSlider.h +0 -26
- package/React/Views/RCTSlider.m +0 -104
- package/React/Views/RCTSliderManager.m +0 -91
- package/ReactAndroid/.npmignore +0 -10
- package/ReactAndroid/Android-prebuilt.mk +0 -211
- package/ReactAndroid/external-artifacts/.npmignore +0 -3
- package/ReactAndroid/hermes-engine/.npmignore +0 -3
- package/ReactAndroid/src/main/AndroidManifest.xml +0 -5
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/CppViewMutationsWrapper.java +0 -47
- package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlider.java +0 -116
- package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java +0 -54
- package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java +0 -336
- package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java +0 -54
- package/ReactAndroid/src/main/jni/react/cxxcomponents/BUCK +0 -44
- package/ReactAndroid/src/main/jni/react/cxxcomponents/CMakeLists.txt +0 -22
- package/ReactAndroid/src/main/jni/react/cxxcomponents/Component.h +0 -66
- package/ReactAndroid/src/main/jni/react/cxxcomponents/ComponentManager.h +0 -26
- package/ReactAndroid/src/main/jni/react/fabric/ComponentRegistryResolver.cpp +0 -51
- package/ReactAndroid/src/main/jni/react/fabric/ComponentRegistryResolver.h +0 -47
- package/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.cpp +0 -73
- package/ReactAndroid/src/main/jni/react/fabric/CppComponentRegistry.h +0 -64
- package/ReactAndroid/src/main/jni/react/fabric/CppViewMutationsWrapper.cpp +0 -100
- package/ReactAndroid/src/main/jni/react/fabric/CppViewMutationsWrapper.h +0 -39
- package/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp +0 -26
- package/ReactCommon/react/renderer/components/slider/BUCK +0 -117
- package/ReactCommon/react/renderer/components/slider/CMakeLists.txt +0 -45
- package/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h +0 -58
- package/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp +0 -100
- package/ReactCommon/react/renderer/components/slider/SliderShadowNode.h +0 -77
- package/ReactCommon/react/renderer/components/slider/SliderState.cpp +0 -44
- package/ReactCommon/react/renderer/components/slider/SliderState.h +0 -89
- package/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.cpp +0 -72
- package/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.h +0 -40
- package/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp +0 -23
- package/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h +0 -33
- package/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp +0 -14
- package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h +0 -80
- package/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp +0 -63
- package/ReactCommon/yoga/yoga/internal/experiments-inl.h +0 -32
- package/ReactCommon/yoga/yoga/internal/experiments.cpp +0 -38
- package/flow/JSITimerInternalType.js +0 -30
- package/react.gradle +0 -486
- package/template/_node-version +0 -1
- package/template/_ruby-version +0 -1
- package/types/.npmignore +0 -1
- /package/ReactCommon/react/nativemodule/core/platform/ios/{RCTBlockGuard.mm → ReactCommon/RCTBlockGuard.mm} +0 -0
- /package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTSampleTurboCxxModule.h → ReactCommon/RCTSampleTurboCxxModule.h} +0 -0
- /package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTSampleTurboCxxModule.mm → ReactCommon/RCTSampleTurboCxxModule.mm} +0 -0
- /package/ReactCommon/react/nativemodule/samples/platform/ios/{RCTSampleTurboModule.h → ReactCommon/RCTSampleTurboModule.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputComponentDescriptor.h → react/renderer/components/iostextinput/TextInputComponentDescriptor.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputProps.h → react/renderer/components/iostextinput/TextInputProps.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputShadowNode.h → react/renderer/components/iostextinput/TextInputShadowNode.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputState.cpp → react/renderer/components/iostextinput/TextInputState.cpp} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{TextInputState.h → react/renderer/components/iostextinput/TextInputState.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{conversions.h → react/renderer/components/iostextinput/conversions.h} +0 -0
- /package/ReactCommon/react/renderer/components/textinput/iostextinput/{primitives.h → react/renderer/components/iostextinput/primitives.h} +0 -0
- /package/ReactCommon/react/renderer/graphics/platform/ios/{Float.h → react/renderer/graphics/Float.h} +0 -0
- /package/ReactCommon/react/renderer/graphics/platform/ios/{PlatformColorParser.h → react/renderer/graphics/PlatformColorParser.h} +0 -0
- /package/ReactCommon/react/renderer/graphics/platform/ios/{RCTPlatformColorUtils.h → react/renderer/graphics/RCTPlatformColorUtils.h} +0 -0
- /package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTImageManager.mm → react/renderer/imagemanager/RCTImageManager.mm} +0 -0
- /package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTImageManagerProtocol.h → react/renderer/imagemanager/RCTImageManagerProtocol.h} +0 -0
- /package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTImagePrimitivesConversions.h → react/renderer/imagemanager/RCTImagePrimitivesConversions.h} +0 -0
- /package/ReactCommon/react/renderer/imagemanager/platform/ios/{RCTSyncImageManager.mm → react/renderer/imagemanager/RCTSyncImageManager.mm} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{NSTextStorage+FontScaling.h → react/renderer/textlayoutmanager/NSTextStorage+FontScaling.h} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTAttributedTextUtils.h → react/renderer/textlayoutmanager/RCTAttributedTextUtils.h} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTAttributedTextUtils.mm → react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTFontProperties.h → react/renderer/textlayoutmanager/RCTFontProperties.h} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTFontUtils.h → react/renderer/textlayoutmanager/RCTFontUtils.h} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTFontUtils.mm → react/renderer/textlayoutmanager/RCTFontUtils.mm} +0 -0
- /package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/{RCTTextPrimitivesConversions.h → react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h} +0 -0
|
@@ -8,1873 +8,16 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
|
|
13
|
-
import type {LayoutEvent, ScrollEvent} from '../Types/CoreEventTypes';
|
|
14
|
-
import type {ViewToken} from './ViewabilityHelper';
|
|
15
|
-
import type {
|
|
16
|
-
FrameMetricProps,
|
|
17
|
-
Item,
|
|
18
|
-
Props,
|
|
19
|
-
RenderItemProps,
|
|
20
|
-
RenderItemType,
|
|
21
|
-
Separators,
|
|
22
|
-
} from './VirtualizedListProps';
|
|
23
|
-
|
|
24
|
-
import RefreshControl from '../Components/RefreshControl/RefreshControl';
|
|
25
|
-
import ScrollView from '../Components/ScrollView/ScrollView';
|
|
26
|
-
import View from '../Components/View/View';
|
|
27
|
-
import Batchinator from '../Interaction/Batchinator';
|
|
28
|
-
import {findNodeHandle} from '../ReactNative/RendererProxy';
|
|
29
|
-
import flattenStyle from '../StyleSheet/flattenStyle';
|
|
30
|
-
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
31
|
-
import clamp from '../Utilities/clamp';
|
|
32
|
-
import infoLog from '../Utilities/infoLog';
|
|
33
|
-
import {CellRenderMask} from './CellRenderMask';
|
|
34
|
-
import ChildListCollection from './ChildListCollection';
|
|
35
|
-
import FillRateHelper from './FillRateHelper';
|
|
36
|
-
import StateSafePureComponent from './StateSafePureComponent';
|
|
37
|
-
import ViewabilityHelper from './ViewabilityHelper';
|
|
38
|
-
import CellRenderer from './VirtualizedListCellRenderer';
|
|
39
|
-
import {
|
|
40
|
-
VirtualizedListCellContextProvider,
|
|
41
|
-
VirtualizedListContext,
|
|
42
|
-
VirtualizedListContextProvider,
|
|
43
|
-
} from './VirtualizedListContext.js';
|
|
44
|
-
import {
|
|
45
|
-
computeWindowedRenderLimits,
|
|
46
|
-
keyExtractor as defaultKeyExtractor,
|
|
47
|
-
} from './VirtualizeUtils';
|
|
48
|
-
import invariant from 'invariant';
|
|
49
|
-
import * as React from 'react';
|
|
50
|
-
|
|
51
|
-
export type {RenderItemProps, RenderItemType, Separators};
|
|
52
|
-
|
|
53
|
-
const ON_END_REACHED_EPSILON = 0.001;
|
|
54
|
-
|
|
55
|
-
let _usedIndexForKey = false;
|
|
56
|
-
let _keylessItemComponentName: string = '';
|
|
57
|
-
|
|
58
|
-
type ViewabilityHelperCallbackTuple = {
|
|
59
|
-
viewabilityHelper: ViewabilityHelper,
|
|
60
|
-
onViewableItemsChanged: (info: {
|
|
61
|
-
viewableItems: Array<ViewToken>,
|
|
62
|
-
changed: Array<ViewToken>,
|
|
63
|
-
...
|
|
64
|
-
}) => void,
|
|
65
|
-
...
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type State = {
|
|
69
|
-
renderMask: CellRenderMask,
|
|
70
|
-
cellsAroundViewport: {first: number, last: number},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Default Props Helper Functions
|
|
75
|
-
* Use the following helper functions for default values
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
// horizontalOrDefault(this.props.horizontal)
|
|
79
|
-
function horizontalOrDefault(horizontal: ?boolean) {
|
|
80
|
-
return horizontal ?? false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// initialNumToRenderOrDefault(this.props.initialNumToRenderOrDefault)
|
|
84
|
-
function initialNumToRenderOrDefault(initialNumToRender: ?number) {
|
|
85
|
-
return initialNumToRender ?? 10;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// maxToRenderPerBatchOrDefault(this.props.maxToRenderPerBatch)
|
|
89
|
-
function maxToRenderPerBatchOrDefault(maxToRenderPerBatch: ?number) {
|
|
90
|
-
return maxToRenderPerBatch ?? 10;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// onEndReachedThresholdOrDefault(this.props.onEndReachedThreshold)
|
|
94
|
-
function onEndReachedThresholdOrDefault(onEndReachedThreshold: ?number) {
|
|
95
|
-
return onEndReachedThreshold ?? 2;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// scrollEventThrottleOrDefault(this.props.scrollEventThrottle)
|
|
99
|
-
function scrollEventThrottleOrDefault(scrollEventThrottle: ?number) {
|
|
100
|
-
return scrollEventThrottle ?? 50;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// windowSizeOrDefault(this.props.windowSize)
|
|
104
|
-
function windowSizeOrDefault(windowSize: ?number) {
|
|
105
|
-
return windowSize ?? 21;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function findLastWhere<T>(
|
|
109
|
-
arr: $ReadOnlyArray<T>,
|
|
110
|
-
predicate: (element: T) => boolean,
|
|
111
|
-
): T | null {
|
|
112
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
113
|
-
if (predicate(arr[i])) {
|
|
114
|
-
return arr[i];
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Base implementation for the more convenient [`<FlatList>`](https://reactnative.dev/docs/flatlist)
|
|
123
|
-
* and [`<SectionList>`](https://reactnative.dev/docs/sectionlist) components, which are also better
|
|
124
|
-
* documented. In general, this should only really be used if you need more flexibility than
|
|
125
|
-
* `FlatList` provides, e.g. for use with immutable data instead of plain arrays.
|
|
126
|
-
*
|
|
127
|
-
* Virtualization massively improves memory consumption and performance of large lists by
|
|
128
|
-
* maintaining a finite render window of active items and replacing all items outside of the render
|
|
129
|
-
* window with appropriately sized blank space. The window adapts to scrolling behavior, and items
|
|
130
|
-
* are rendered incrementally with low-pri (after any running interactions) if they are far from the
|
|
131
|
-
* visible area, or with hi-pri otherwise to minimize the potential of seeing blank space.
|
|
132
|
-
*
|
|
133
|
-
* Some caveats:
|
|
134
|
-
*
|
|
135
|
-
* - Internal state is not preserved when content scrolls out of the render window. Make sure all
|
|
136
|
-
* your data is captured in the item data or external stores like Flux, Redux, or Relay.
|
|
137
|
-
* - This is a `PureComponent` which means that it will not re-render if `props` remain shallow-
|
|
138
|
-
* equal. Make sure that everything your `renderItem` function depends on is passed as a prop
|
|
139
|
-
* (e.g. `extraData`) that is not `===` after updates, otherwise your UI may not update on
|
|
140
|
-
* changes. This includes the `data` prop and parent component state.
|
|
141
|
-
* - In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
|
142
|
-
* offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
|
143
|
-
* blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
|
144
|
-
* and we are working on improving it behind the scenes.
|
|
145
|
-
* - By default, the list looks for a `key` or `id` prop on each item and uses that for the React key.
|
|
146
|
-
* Alternatively, you can provide a custom `keyExtractor` prop.
|
|
147
|
-
* - As an effort to remove defaultProps, use helper functions when referencing certain props
|
|
148
|
-
*
|
|
149
|
-
*/
|
|
150
|
-
export default class VirtualizedList extends StateSafePureComponent<
|
|
151
|
-
Props,
|
|
152
|
-
State,
|
|
153
|
-
> {
|
|
154
|
-
static contextType: typeof VirtualizedListContext = VirtualizedListContext;
|
|
155
|
-
|
|
156
|
-
// scrollToEnd may be janky without getItemLayout prop
|
|
157
|
-
scrollToEnd(params?: ?{animated?: ?boolean, ...}) {
|
|
158
|
-
const animated = params ? params.animated : true;
|
|
159
|
-
const veryLast = this.props.getItemCount(this.props.data) - 1;
|
|
160
|
-
const frame = this.__getFrameMetricsApprox(veryLast, this.props);
|
|
161
|
-
const offset = Math.max(
|
|
162
|
-
0,
|
|
163
|
-
frame.offset +
|
|
164
|
-
frame.length +
|
|
165
|
-
this._footerLength -
|
|
166
|
-
this._scrollMetrics.visibleLength,
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
if (this._scrollRef == null) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (this._scrollRef.scrollTo == null) {
|
|
174
|
-
console.warn(
|
|
175
|
-
'No scrollTo method provided. This may be because you have two nested ' +
|
|
176
|
-
'VirtualizedLists with the same orientation, or because you are ' +
|
|
177
|
-
'using a custom component that does not implement scrollTo.',
|
|
178
|
-
);
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
this._scrollRef.scrollTo(
|
|
183
|
-
horizontalOrDefault(this.props.horizontal)
|
|
184
|
-
? {x: offset, animated}
|
|
185
|
-
: {y: offset, animated},
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// scrollToIndex may be janky without getItemLayout prop
|
|
190
|
-
scrollToIndex(params: {
|
|
191
|
-
animated?: ?boolean,
|
|
192
|
-
index: number,
|
|
193
|
-
viewOffset?: number,
|
|
194
|
-
viewPosition?: number,
|
|
195
|
-
...
|
|
196
|
-
}): $FlowFixMe {
|
|
197
|
-
const {
|
|
198
|
-
data,
|
|
199
|
-
horizontal,
|
|
200
|
-
getItemCount,
|
|
201
|
-
getItemLayout,
|
|
202
|
-
onScrollToIndexFailed,
|
|
203
|
-
} = this.props;
|
|
204
|
-
const {animated, index, viewOffset, viewPosition} = params;
|
|
205
|
-
invariant(
|
|
206
|
-
index >= 0,
|
|
207
|
-
`scrollToIndex out of range: requested index ${index} but minimum is 0`,
|
|
208
|
-
);
|
|
209
|
-
invariant(
|
|
210
|
-
getItemCount(data) >= 1,
|
|
211
|
-
`scrollToIndex out of range: item length ${getItemCount(
|
|
212
|
-
data,
|
|
213
|
-
)} but minimum is 1`,
|
|
214
|
-
);
|
|
215
|
-
invariant(
|
|
216
|
-
index < getItemCount(data),
|
|
217
|
-
`scrollToIndex out of range: requested index ${index} is out of 0 to ${
|
|
218
|
-
getItemCount(data) - 1
|
|
219
|
-
}`,
|
|
220
|
-
);
|
|
221
|
-
if (!getItemLayout && index > this._highestMeasuredFrameIndex) {
|
|
222
|
-
invariant(
|
|
223
|
-
!!onScrollToIndexFailed,
|
|
224
|
-
'scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, ' +
|
|
225
|
-
'otherwise there is no way to know the location of offscreen indices or handle failures.',
|
|
226
|
-
);
|
|
227
|
-
onScrollToIndexFailed({
|
|
228
|
-
averageItemLength: this._averageCellLength,
|
|
229
|
-
highestMeasuredFrameIndex: this._highestMeasuredFrameIndex,
|
|
230
|
-
index,
|
|
231
|
-
});
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const frame = this.__getFrameMetricsApprox(Math.floor(index), this.props);
|
|
235
|
-
const offset =
|
|
236
|
-
Math.max(
|
|
237
|
-
0,
|
|
238
|
-
this._getOffsetApprox(index, this.props) -
|
|
239
|
-
(viewPosition || 0) *
|
|
240
|
-
(this._scrollMetrics.visibleLength - frame.length),
|
|
241
|
-
) - (viewOffset || 0);
|
|
242
|
-
|
|
243
|
-
if (this._scrollRef == null) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (this._scrollRef.scrollTo == null) {
|
|
248
|
-
console.warn(
|
|
249
|
-
'No scrollTo method provided. This may be because you have two nested ' +
|
|
250
|
-
'VirtualizedLists with the same orientation, or because you are ' +
|
|
251
|
-
'using a custom component that does not implement scrollTo.',
|
|
252
|
-
);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
this._scrollRef.scrollTo(
|
|
257
|
-
horizontal ? {x: offset, animated} : {y: offset, animated},
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// scrollToItem may be janky without getItemLayout prop. Required linear scan through items -
|
|
262
|
-
// use scrollToIndex instead if possible.
|
|
263
|
-
scrollToItem(params: {
|
|
264
|
-
animated?: ?boolean,
|
|
265
|
-
item: Item,
|
|
266
|
-
viewOffset?: number,
|
|
267
|
-
viewPosition?: number,
|
|
268
|
-
...
|
|
269
|
-
}) {
|
|
270
|
-
const {item} = params;
|
|
271
|
-
const {data, getItem, getItemCount} = this.props;
|
|
272
|
-
const itemCount = getItemCount(data);
|
|
273
|
-
for (let index = 0; index < itemCount; index++) {
|
|
274
|
-
if (getItem(data, index) === item) {
|
|
275
|
-
this.scrollToIndex({...params, index});
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Scroll to a specific content pixel offset in the list.
|
|
283
|
-
*
|
|
284
|
-
* Param `offset` expects the offset to scroll to.
|
|
285
|
-
* In case of `horizontal` is true, the offset is the x-value,
|
|
286
|
-
* in any other case the offset is the y-value.
|
|
287
|
-
*
|
|
288
|
-
* Param `animated` (`true` by default) defines whether the list
|
|
289
|
-
* should do an animation while scrolling.
|
|
290
|
-
*/
|
|
291
|
-
scrollToOffset(params: {animated?: ?boolean, offset: number, ...}) {
|
|
292
|
-
const {animated, offset} = params;
|
|
293
|
-
|
|
294
|
-
if (this._scrollRef == null) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (this._scrollRef.scrollTo == null) {
|
|
299
|
-
console.warn(
|
|
300
|
-
'No scrollTo method provided. This may be because you have two nested ' +
|
|
301
|
-
'VirtualizedLists with the same orientation, or because you are ' +
|
|
302
|
-
'using a custom component that does not implement scrollTo.',
|
|
303
|
-
);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
this._scrollRef.scrollTo(
|
|
308
|
-
horizontalOrDefault(this.props.horizontal)
|
|
309
|
-
? {x: offset, animated}
|
|
310
|
-
: {y: offset, animated},
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
recordInteraction() {
|
|
315
|
-
this._nestedChildLists.forEach(childList => {
|
|
316
|
-
childList.recordInteraction();
|
|
317
|
-
});
|
|
318
|
-
this._viewabilityTuples.forEach(t => {
|
|
319
|
-
t.viewabilityHelper.recordInteraction();
|
|
320
|
-
});
|
|
321
|
-
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
flashScrollIndicators() {
|
|
325
|
-
if (this._scrollRef == null) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
this._scrollRef.flashScrollIndicators();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Provides a handle to the underlying scroll responder.
|
|
334
|
-
* Note that `this._scrollRef` might not be a `ScrollView`, so we
|
|
335
|
-
* need to check that it responds to `getScrollResponder` before calling it.
|
|
336
|
-
*/
|
|
337
|
-
getScrollResponder(): ?ScrollResponderType {
|
|
338
|
-
if (this._scrollRef && this._scrollRef.getScrollResponder) {
|
|
339
|
-
return this._scrollRef.getScrollResponder();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
getScrollableNode(): ?number {
|
|
344
|
-
if (this._scrollRef && this._scrollRef.getScrollableNode) {
|
|
345
|
-
return this._scrollRef.getScrollableNode();
|
|
346
|
-
} else {
|
|
347
|
-
return findNodeHandle(this._scrollRef);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
getScrollRef():
|
|
352
|
-
| ?React.ElementRef<typeof ScrollView>
|
|
353
|
-
| ?React.ElementRef<typeof View> {
|
|
354
|
-
if (this._scrollRef && this._scrollRef.getScrollRef) {
|
|
355
|
-
return this._scrollRef.getScrollRef();
|
|
356
|
-
} else {
|
|
357
|
-
return this._scrollRef;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
setNativeProps(props: Object) {
|
|
362
|
-
if (this._scrollRef) {
|
|
363
|
-
this._scrollRef.setNativeProps(props);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
_getCellKey(): string {
|
|
368
|
-
return this.context?.cellKey || 'rootList';
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// $FlowFixMe[missing-local-annot]
|
|
372
|
-
_getScrollMetrics = () => {
|
|
373
|
-
return this._scrollMetrics;
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
hasMore(): boolean {
|
|
377
|
-
return this._hasMore;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// $FlowFixMe[missing-local-annot]
|
|
381
|
-
_getOutermostParentListRef = () => {
|
|
382
|
-
if (this._isNestedWithSameOrientation()) {
|
|
383
|
-
return this.context.getOutermostParentListRef();
|
|
384
|
-
} else {
|
|
385
|
-
return this;
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
_registerAsNestedChild = (childList: {
|
|
390
|
-
cellKey: string,
|
|
391
|
-
ref: React.ElementRef<typeof VirtualizedList>,
|
|
392
|
-
}): void => {
|
|
393
|
-
this._nestedChildLists.add(childList.ref, childList.cellKey);
|
|
394
|
-
if (this._hasInteracted) {
|
|
395
|
-
childList.ref.recordInteraction();
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
_unregisterAsNestedChild = (childList: {
|
|
400
|
-
ref: React.ElementRef<typeof VirtualizedList>,
|
|
401
|
-
}): void => {
|
|
402
|
-
this._nestedChildLists.remove(childList.ref);
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
state: State;
|
|
406
|
-
|
|
407
|
-
constructor(props: Props) {
|
|
408
|
-
super(props);
|
|
409
|
-
invariant(
|
|
410
|
-
// $FlowFixMe[prop-missing]
|
|
411
|
-
!props.onScroll || !props.onScroll.__isNative,
|
|
412
|
-
'Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent ' +
|
|
413
|
-
'to support native onScroll events with useNativeDriver',
|
|
414
|
-
);
|
|
415
|
-
invariant(
|
|
416
|
-
windowSizeOrDefault(props.windowSize) > 0,
|
|
417
|
-
'VirtualizedList: The windowSize prop must be present and set to a value greater than 0.',
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
invariant(
|
|
421
|
-
props.getItemCount,
|
|
422
|
-
'VirtualizedList: The "getItemCount" prop must be provided',
|
|
423
|
-
);
|
|
424
|
-
|
|
425
|
-
this._fillRateHelper = new FillRateHelper(this._getFrameMetrics);
|
|
426
|
-
this._updateCellsToRenderBatcher = new Batchinator(
|
|
427
|
-
this._updateCellsToRender,
|
|
428
|
-
this.props.updateCellsBatchingPeriod ?? 50,
|
|
429
|
-
);
|
|
430
|
-
|
|
431
|
-
if (this.props.viewabilityConfigCallbackPairs) {
|
|
432
|
-
this._viewabilityTuples = this.props.viewabilityConfigCallbackPairs.map(
|
|
433
|
-
pair => ({
|
|
434
|
-
viewabilityHelper: new ViewabilityHelper(pair.viewabilityConfig),
|
|
435
|
-
onViewableItemsChanged: pair.onViewableItemsChanged,
|
|
436
|
-
}),
|
|
437
|
-
);
|
|
438
|
-
} else {
|
|
439
|
-
const {onViewableItemsChanged, viewabilityConfig} = this.props;
|
|
440
|
-
if (onViewableItemsChanged) {
|
|
441
|
-
this._viewabilityTuples.push({
|
|
442
|
-
viewabilityHelper: new ViewabilityHelper(viewabilityConfig),
|
|
443
|
-
onViewableItemsChanged: onViewableItemsChanged,
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
invariant(
|
|
449
|
-
!this.context,
|
|
450
|
-
'Unexpectedly saw VirtualizedListContext available in ctor',
|
|
451
|
-
);
|
|
452
|
-
|
|
453
|
-
const initialRenderRegion = VirtualizedList._initialRenderRegion(props);
|
|
454
|
-
|
|
455
|
-
this.state = {
|
|
456
|
-
cellsAroundViewport: initialRenderRegion,
|
|
457
|
-
renderMask: VirtualizedList._createRenderMask(props, initialRenderRegion),
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
static _createRenderMask(
|
|
462
|
-
props: Props,
|
|
463
|
-
cellsAroundViewport: {first: number, last: number},
|
|
464
|
-
additionalRegions?: ?$ReadOnlyArray<{first: number, last: number}>,
|
|
465
|
-
): CellRenderMask {
|
|
466
|
-
const itemCount = props.getItemCount(props.data);
|
|
467
|
-
|
|
468
|
-
invariant(
|
|
469
|
-
cellsAroundViewport.first >= 0 &&
|
|
470
|
-
cellsAroundViewport.last >= cellsAroundViewport.first - 1 &&
|
|
471
|
-
cellsAroundViewport.last < itemCount,
|
|
472
|
-
`Invalid cells around viewport "[${cellsAroundViewport.first}, ${cellsAroundViewport.last}]" was passed to VirtualizedList._createRenderMask`,
|
|
473
|
-
);
|
|
474
|
-
|
|
475
|
-
const renderMask = new CellRenderMask(itemCount);
|
|
476
|
-
|
|
477
|
-
if (itemCount > 0) {
|
|
478
|
-
const allRegions = [cellsAroundViewport, ...(additionalRegions ?? [])];
|
|
479
|
-
for (const region of allRegions) {
|
|
480
|
-
renderMask.addCells(region);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// The initially rendered cells are retained as part of the
|
|
484
|
-
// "scroll-to-top" optimization
|
|
485
|
-
if (props.initialScrollIndex == null || props.initialScrollIndex <= 0) {
|
|
486
|
-
const initialRegion = VirtualizedList._initialRenderRegion(props);
|
|
487
|
-
renderMask.addCells(initialRegion);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// The layout coordinates of sticker headers may be off-screen while the
|
|
491
|
-
// actual header is on-screen. Keep the most recent before the viewport
|
|
492
|
-
// rendered, even if its layout coordinates are not in viewport.
|
|
493
|
-
const stickyIndicesSet = new Set(props.stickyHeaderIndices);
|
|
494
|
-
VirtualizedList._ensureClosestStickyHeader(
|
|
495
|
-
props,
|
|
496
|
-
stickyIndicesSet,
|
|
497
|
-
renderMask,
|
|
498
|
-
cellsAroundViewport.first,
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
return renderMask;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
static _initialRenderRegion(props: Props): {first: number, last: number} {
|
|
506
|
-
const itemCount = props.getItemCount(props.data);
|
|
507
|
-
const scrollIndex = Math.floor(Math.max(0, props.initialScrollIndex ?? 0));
|
|
508
|
-
|
|
509
|
-
return {
|
|
510
|
-
first: scrollIndex,
|
|
511
|
-
last:
|
|
512
|
-
Math.min(
|
|
513
|
-
itemCount,
|
|
514
|
-
scrollIndex + initialNumToRenderOrDefault(props.initialNumToRender),
|
|
515
|
-
) - 1,
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
static _ensureClosestStickyHeader(
|
|
520
|
-
props: Props,
|
|
521
|
-
stickyIndicesSet: Set<number>,
|
|
522
|
-
renderMask: CellRenderMask,
|
|
523
|
-
cellIdx: number,
|
|
524
|
-
) {
|
|
525
|
-
const stickyOffset = props.ListHeaderComponent ? 1 : 0;
|
|
526
|
-
|
|
527
|
-
for (let itemIdx = cellIdx - 1; itemIdx >= 0; itemIdx--) {
|
|
528
|
-
if (stickyIndicesSet.has(itemIdx + stickyOffset)) {
|
|
529
|
-
renderMask.addCells({first: itemIdx, last: itemIdx});
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
_adjustCellsAroundViewport(
|
|
536
|
-
props: Props,
|
|
537
|
-
cellsAroundViewport: {first: number, last: number},
|
|
538
|
-
): {first: number, last: number} {
|
|
539
|
-
const {data, getItemCount} = props;
|
|
540
|
-
const onEndReachedThreshold = onEndReachedThresholdOrDefault(
|
|
541
|
-
props.onEndReachedThreshold,
|
|
542
|
-
);
|
|
543
|
-
this._updateViewableItems(props, cellsAroundViewport);
|
|
544
|
-
|
|
545
|
-
const {contentLength, offset, visibleLength} = this._scrollMetrics;
|
|
546
|
-
const distanceFromEnd = contentLength - visibleLength - offset;
|
|
547
|
-
|
|
548
|
-
// Wait until the scroll view metrics have been set up. And until then,
|
|
549
|
-
// we will trust the initialNumToRender suggestion
|
|
550
|
-
if (visibleLength <= 0 || contentLength <= 0) {
|
|
551
|
-
return cellsAroundViewport.last >= getItemCount(data)
|
|
552
|
-
? VirtualizedList._constrainToItemCount(cellsAroundViewport, props)
|
|
553
|
-
: cellsAroundViewport;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
let newCellsAroundViewport: {first: number, last: number};
|
|
557
|
-
if (props.disableVirtualization) {
|
|
558
|
-
const renderAhead =
|
|
559
|
-
distanceFromEnd < onEndReachedThreshold * visibleLength
|
|
560
|
-
? maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch)
|
|
561
|
-
: 0;
|
|
562
|
-
|
|
563
|
-
newCellsAroundViewport = {
|
|
564
|
-
first: 0,
|
|
565
|
-
last: Math.min(
|
|
566
|
-
cellsAroundViewport.last + renderAhead,
|
|
567
|
-
getItemCount(data) - 1,
|
|
568
|
-
),
|
|
569
|
-
};
|
|
570
|
-
} else {
|
|
571
|
-
// If we have a non-zero initialScrollIndex and run this before we've scrolled,
|
|
572
|
-
// we'll wipe out the initialNumToRender rendered elements starting at initialScrollIndex.
|
|
573
|
-
// So let's wait until we've scrolled the view to the right place. And until then,
|
|
574
|
-
// we will trust the initialScrollIndex suggestion.
|
|
575
|
-
|
|
576
|
-
// Thus, we want to recalculate the windowed render limits if any of the following hold:
|
|
577
|
-
// - initialScrollIndex is undefined or is 0
|
|
578
|
-
// - initialScrollIndex > 0 AND scrolling is complete
|
|
579
|
-
// - initialScrollIndex > 0 AND the end of the list is visible (this handles the case
|
|
580
|
-
// where the list is shorter than the visible area)
|
|
581
|
-
if (
|
|
582
|
-
props.initialScrollIndex &&
|
|
583
|
-
!this._scrollMetrics.offset &&
|
|
584
|
-
Math.abs(distanceFromEnd) >= Number.EPSILON
|
|
585
|
-
) {
|
|
586
|
-
return cellsAroundViewport.last >= getItemCount(data)
|
|
587
|
-
? VirtualizedList._constrainToItemCount(cellsAroundViewport, props)
|
|
588
|
-
: cellsAroundViewport;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
newCellsAroundViewport = computeWindowedRenderLimits(
|
|
592
|
-
props,
|
|
593
|
-
maxToRenderPerBatchOrDefault(props.maxToRenderPerBatch),
|
|
594
|
-
windowSizeOrDefault(props.windowSize),
|
|
595
|
-
cellsAroundViewport,
|
|
596
|
-
this.__getFrameMetricsApprox,
|
|
597
|
-
this._scrollMetrics,
|
|
598
|
-
);
|
|
599
|
-
invariant(
|
|
600
|
-
newCellsAroundViewport.last < getItemCount(data),
|
|
601
|
-
'computeWindowedRenderLimits() should return range in-bounds',
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
if (this._nestedChildLists.size() > 0) {
|
|
606
|
-
// If some cell in the new state has a child list in it, we should only render
|
|
607
|
-
// up through that item, so that we give that list a chance to render.
|
|
608
|
-
// Otherwise there's churn from multiple child lists mounting and un-mounting
|
|
609
|
-
// their items.
|
|
610
|
-
|
|
611
|
-
// Will this prevent rendering if the nested list doesn't realize the end?
|
|
612
|
-
const childIdx = this._findFirstChildWithMore(
|
|
613
|
-
newCellsAroundViewport.first,
|
|
614
|
-
newCellsAroundViewport.last,
|
|
615
|
-
);
|
|
616
|
-
|
|
617
|
-
newCellsAroundViewport.last = childIdx ?? newCellsAroundViewport.last;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return newCellsAroundViewport;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
_findFirstChildWithMore(first: number, last: number): number | null {
|
|
624
|
-
for (let ii = first; ii <= last; ii++) {
|
|
625
|
-
const cellKeyForIndex = this._indicesToKeys.get(ii);
|
|
626
|
-
if (
|
|
627
|
-
cellKeyForIndex != null &&
|
|
628
|
-
this._nestedChildLists.anyInCell(cellKeyForIndex, childList =>
|
|
629
|
-
childList.hasMore(),
|
|
630
|
-
)
|
|
631
|
-
) {
|
|
632
|
-
return ii;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
11
|
+
'use strict';
|
|
635
12
|
|
|
636
|
-
|
|
637
|
-
}
|
|
13
|
+
import {typeof VirtualizedList as VirtualizedListType} from '@react-native/virtualized-lists';
|
|
638
14
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
this.context.registerAsNestedChild({
|
|
642
|
-
ref: this,
|
|
643
|
-
cellKey: this.context.cellKey,
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
}
|
|
15
|
+
const VirtualizedList: VirtualizedListType =
|
|
16
|
+
require('@react-native/virtualized-lists').VirtualizedList;
|
|
647
17
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
tuple.viewabilityHelper.dispose();
|
|
655
|
-
});
|
|
656
|
-
this._fillRateHelper.deactivateAndFlush();
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
static getDerivedStateFromProps(newProps: Props, prevState: State): State {
|
|
660
|
-
// first and last could be stale (e.g. if a new, shorter items props is passed in), so we make
|
|
661
|
-
// sure we're rendering a reasonable range here.
|
|
662
|
-
const itemCount = newProps.getItemCount(newProps.data);
|
|
663
|
-
if (itemCount === prevState.renderMask.numCells()) {
|
|
664
|
-
return prevState;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
const constrainedCells = VirtualizedList._constrainToItemCount(
|
|
668
|
-
prevState.cellsAroundViewport,
|
|
669
|
-
newProps,
|
|
670
|
-
);
|
|
671
|
-
|
|
672
|
-
return {
|
|
673
|
-
cellsAroundViewport: constrainedCells,
|
|
674
|
-
renderMask: VirtualizedList._createRenderMask(newProps, constrainedCells),
|
|
675
|
-
};
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
_pushCells(
|
|
679
|
-
cells: Array<Object>,
|
|
680
|
-
stickyHeaderIndices: Array<number>,
|
|
681
|
-
stickyIndicesFromProps: Set<number>,
|
|
682
|
-
first: number,
|
|
683
|
-
last: number,
|
|
684
|
-
inversionStyle: ViewStyleProp,
|
|
685
|
-
) {
|
|
686
|
-
const {
|
|
687
|
-
CellRendererComponent,
|
|
688
|
-
ItemSeparatorComponent,
|
|
689
|
-
ListHeaderComponent,
|
|
690
|
-
ListItemComponent,
|
|
691
|
-
data,
|
|
692
|
-
debug,
|
|
693
|
-
getItem,
|
|
694
|
-
getItemCount,
|
|
695
|
-
getItemLayout,
|
|
696
|
-
horizontal,
|
|
697
|
-
renderItem,
|
|
698
|
-
} = this.props;
|
|
699
|
-
const stickyOffset = ListHeaderComponent ? 1 : 0;
|
|
700
|
-
const end = getItemCount(data) - 1;
|
|
701
|
-
let prevCellKey;
|
|
702
|
-
last = Math.min(end, last);
|
|
703
|
-
for (let ii = first; ii <= last; ii++) {
|
|
704
|
-
const item = getItem(data, ii);
|
|
705
|
-
const key = this._keyExtractor(item, ii, this.props);
|
|
706
|
-
this._indicesToKeys.set(ii, key);
|
|
707
|
-
if (stickyIndicesFromProps.has(ii + stickyOffset)) {
|
|
708
|
-
stickyHeaderIndices.push(cells.length);
|
|
709
|
-
}
|
|
710
|
-
cells.push(
|
|
711
|
-
<CellRenderer
|
|
712
|
-
CellRendererComponent={CellRendererComponent}
|
|
713
|
-
ItemSeparatorComponent={ii < end ? ItemSeparatorComponent : undefined}
|
|
714
|
-
ListItemComponent={ListItemComponent}
|
|
715
|
-
cellKey={key}
|
|
716
|
-
debug={debug}
|
|
717
|
-
fillRateHelper={this._fillRateHelper}
|
|
718
|
-
getItemLayout={getItemLayout}
|
|
719
|
-
horizontal={horizontal}
|
|
720
|
-
index={ii}
|
|
721
|
-
inversionStyle={inversionStyle}
|
|
722
|
-
item={item}
|
|
723
|
-
key={key}
|
|
724
|
-
prevCellKey={prevCellKey}
|
|
725
|
-
onCellLayout={this._onCellLayout}
|
|
726
|
-
onUpdateSeparators={this._onUpdateSeparators}
|
|
727
|
-
onCellFocusCapture={e => this._onCellFocusCapture(key)}
|
|
728
|
-
onUnmount={this._onCellUnmount}
|
|
729
|
-
ref={ref => {
|
|
730
|
-
this._cellRefs[key] = ref;
|
|
731
|
-
}}
|
|
732
|
-
renderItem={renderItem}
|
|
733
|
-
/>,
|
|
734
|
-
);
|
|
735
|
-
prevCellKey = key;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
static _constrainToItemCount(
|
|
740
|
-
cells: {first: number, last: number},
|
|
741
|
-
props: Props,
|
|
742
|
-
): {first: number, last: number} {
|
|
743
|
-
const itemCount = props.getItemCount(props.data);
|
|
744
|
-
const last = Math.min(itemCount - 1, cells.last);
|
|
745
|
-
|
|
746
|
-
const maxToRenderPerBatch = maxToRenderPerBatchOrDefault(
|
|
747
|
-
props.maxToRenderPerBatch,
|
|
748
|
-
);
|
|
749
|
-
|
|
750
|
-
return {
|
|
751
|
-
first: clamp(0, itemCount - 1 - maxToRenderPerBatch, cells.first),
|
|
752
|
-
last,
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
_onUpdateSeparators = (keys: Array<?string>, newProps: Object) => {
|
|
757
|
-
keys.forEach(key => {
|
|
758
|
-
const ref = key != null && this._cellRefs[key];
|
|
759
|
-
ref && ref.updateSeparatorProps(newProps);
|
|
760
|
-
});
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
_isNestedWithSameOrientation(): boolean {
|
|
764
|
-
const nestedContext = this.context;
|
|
765
|
-
return !!(
|
|
766
|
-
nestedContext &&
|
|
767
|
-
!!nestedContext.horizontal === horizontalOrDefault(this.props.horizontal)
|
|
768
|
-
);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
_getSpacerKey = (isVertical: boolean): string =>
|
|
772
|
-
isVertical ? 'height' : 'width';
|
|
773
|
-
|
|
774
|
-
_keyExtractor(
|
|
775
|
-
item: Item,
|
|
776
|
-
index: number,
|
|
777
|
-
props: {
|
|
778
|
-
keyExtractor?: ?(item: Item, index: number) => string,
|
|
779
|
-
...
|
|
780
|
-
},
|
|
781
|
-
// $FlowFixMe[missing-local-annot]
|
|
782
|
-
) {
|
|
783
|
-
if (props.keyExtractor != null) {
|
|
784
|
-
return props.keyExtractor(item, index);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
const key = defaultKeyExtractor(item, index);
|
|
788
|
-
if (key === String(index)) {
|
|
789
|
-
_usedIndexForKey = true;
|
|
790
|
-
if (item.type && item.type.displayName) {
|
|
791
|
-
_keylessItemComponentName = item.type.displayName;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
return key;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
render(): React.Node {
|
|
798
|
-
if (__DEV__) {
|
|
799
|
-
const flatStyles = flattenStyle(this.props.contentContainerStyle);
|
|
800
|
-
if (flatStyles != null && flatStyles.flexWrap === 'wrap') {
|
|
801
|
-
console.warn(
|
|
802
|
-
'`flexWrap: `wrap`` is not supported with the `VirtualizedList` components.' +
|
|
803
|
-
'Consider using `numColumns` with `FlatList` instead.',
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
const {ListEmptyComponent, ListFooterComponent, ListHeaderComponent} =
|
|
808
|
-
this.props;
|
|
809
|
-
const {data, horizontal} = this.props;
|
|
810
|
-
const inversionStyle = this.props.inverted
|
|
811
|
-
? horizontalOrDefault(this.props.horizontal)
|
|
812
|
-
? styles.horizontallyInverted
|
|
813
|
-
: styles.verticallyInverted
|
|
814
|
-
: null;
|
|
815
|
-
const cells: Array<any | React.Node> = [];
|
|
816
|
-
const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
|
|
817
|
-
const stickyHeaderIndices = [];
|
|
818
|
-
|
|
819
|
-
// 1. Add cell for ListHeaderComponent
|
|
820
|
-
if (ListHeaderComponent) {
|
|
821
|
-
if (stickyIndicesFromProps.has(0)) {
|
|
822
|
-
stickyHeaderIndices.push(0);
|
|
823
|
-
}
|
|
824
|
-
const element = React.isValidElement(ListHeaderComponent) ? (
|
|
825
|
-
ListHeaderComponent
|
|
826
|
-
) : (
|
|
827
|
-
// $FlowFixMe[not-a-component]
|
|
828
|
-
// $FlowFixMe[incompatible-type-arg]
|
|
829
|
-
<ListHeaderComponent />
|
|
830
|
-
);
|
|
831
|
-
cells.push(
|
|
832
|
-
<VirtualizedListCellContextProvider
|
|
833
|
-
cellKey={this._getCellKey() + '-header'}
|
|
834
|
-
key="$header">
|
|
835
|
-
<View
|
|
836
|
-
onLayout={this._onLayoutHeader}
|
|
837
|
-
style={StyleSheet.compose(
|
|
838
|
-
inversionStyle,
|
|
839
|
-
this.props.ListHeaderComponentStyle,
|
|
840
|
-
)}>
|
|
841
|
-
{
|
|
842
|
-
// $FlowFixMe[incompatible-type] - Typing ReactNativeComponent revealed errors
|
|
843
|
-
element
|
|
844
|
-
}
|
|
845
|
-
</View>
|
|
846
|
-
</VirtualizedListCellContextProvider>,
|
|
847
|
-
);
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
// 2a. Add a cell for ListEmptyComponent if applicable
|
|
851
|
-
const itemCount = this.props.getItemCount(data);
|
|
852
|
-
if (itemCount === 0 && ListEmptyComponent) {
|
|
853
|
-
const element: React.Element<any> = ((React.isValidElement(
|
|
854
|
-
ListEmptyComponent,
|
|
855
|
-
) ? (
|
|
856
|
-
ListEmptyComponent
|
|
857
|
-
) : (
|
|
858
|
-
// $FlowFixMe[not-a-component]
|
|
859
|
-
// $FlowFixMe[incompatible-type-arg]
|
|
860
|
-
<ListEmptyComponent />
|
|
861
|
-
)): any);
|
|
862
|
-
cells.push(
|
|
863
|
-
<VirtualizedListCellContextProvider
|
|
864
|
-
cellKey={this._getCellKey() + '-empty'}
|
|
865
|
-
key="$empty">
|
|
866
|
-
{React.cloneElement(element, {
|
|
867
|
-
onLayout: (event: LayoutEvent) => {
|
|
868
|
-
this._onLayoutEmpty(event);
|
|
869
|
-
if (element.props.onLayout) {
|
|
870
|
-
element.props.onLayout(event);
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
style: StyleSheet.compose(inversionStyle, element.props.style),
|
|
874
|
-
})}
|
|
875
|
-
</VirtualizedListCellContextProvider>,
|
|
876
|
-
);
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
// 2b. Add cells and spacers for each item
|
|
880
|
-
if (itemCount > 0) {
|
|
881
|
-
_usedIndexForKey = false;
|
|
882
|
-
_keylessItemComponentName = '';
|
|
883
|
-
const spacerKey = this._getSpacerKey(!horizontal);
|
|
884
|
-
|
|
885
|
-
const renderRegions = this.state.renderMask.enumerateRegions();
|
|
886
|
-
const lastSpacer = findLastWhere(renderRegions, r => r.isSpacer);
|
|
887
|
-
|
|
888
|
-
for (const section of renderRegions) {
|
|
889
|
-
if (section.isSpacer) {
|
|
890
|
-
// Legacy behavior is to avoid spacers when virtualization is
|
|
891
|
-
// disabled (including head spacers on initial render).
|
|
892
|
-
if (this.props.disableVirtualization) {
|
|
893
|
-
continue;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// Without getItemLayout, we limit our tail spacer to the _highestMeasuredFrameIndex to
|
|
897
|
-
// prevent the user for hyperscrolling into un-measured area because otherwise content will
|
|
898
|
-
// likely jump around as it renders in above the viewport.
|
|
899
|
-
const isLastSpacer = section === lastSpacer;
|
|
900
|
-
const constrainToMeasured = isLastSpacer && !this.props.getItemLayout;
|
|
901
|
-
const last = constrainToMeasured
|
|
902
|
-
? clamp(
|
|
903
|
-
section.first - 1,
|
|
904
|
-
section.last,
|
|
905
|
-
this._highestMeasuredFrameIndex,
|
|
906
|
-
)
|
|
907
|
-
: section.last;
|
|
908
|
-
|
|
909
|
-
const firstMetrics = this.__getFrameMetricsApprox(
|
|
910
|
-
section.first,
|
|
911
|
-
this.props,
|
|
912
|
-
);
|
|
913
|
-
const lastMetrics = this.__getFrameMetricsApprox(last, this.props);
|
|
914
|
-
const spacerSize =
|
|
915
|
-
lastMetrics.offset + lastMetrics.length - firstMetrics.offset;
|
|
916
|
-
cells.push(
|
|
917
|
-
<View
|
|
918
|
-
key={`$spacer-${section.first}`}
|
|
919
|
-
style={{[spacerKey]: spacerSize}}
|
|
920
|
-
/>,
|
|
921
|
-
);
|
|
922
|
-
} else {
|
|
923
|
-
this._pushCells(
|
|
924
|
-
cells,
|
|
925
|
-
stickyHeaderIndices,
|
|
926
|
-
stickyIndicesFromProps,
|
|
927
|
-
section.first,
|
|
928
|
-
section.last,
|
|
929
|
-
inversionStyle,
|
|
930
|
-
);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
if (!this._hasWarned.keys && _usedIndexForKey) {
|
|
935
|
-
console.warn(
|
|
936
|
-
'VirtualizedList: missing keys for items, make sure to specify a key or id property on each ' +
|
|
937
|
-
'item or provide a custom keyExtractor.',
|
|
938
|
-
_keylessItemComponentName,
|
|
939
|
-
);
|
|
940
|
-
this._hasWarned.keys = true;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
// 3. Add cell for ListFooterComponent
|
|
945
|
-
if (ListFooterComponent) {
|
|
946
|
-
const element = React.isValidElement(ListFooterComponent) ? (
|
|
947
|
-
ListFooterComponent
|
|
948
|
-
) : (
|
|
949
|
-
// $FlowFixMe[not-a-component]
|
|
950
|
-
// $FlowFixMe[incompatible-type-arg]
|
|
951
|
-
<ListFooterComponent />
|
|
952
|
-
);
|
|
953
|
-
cells.push(
|
|
954
|
-
<VirtualizedListCellContextProvider
|
|
955
|
-
cellKey={this._getFooterCellKey()}
|
|
956
|
-
key="$footer">
|
|
957
|
-
<View
|
|
958
|
-
onLayout={this._onLayoutFooter}
|
|
959
|
-
style={StyleSheet.compose(
|
|
960
|
-
inversionStyle,
|
|
961
|
-
this.props.ListFooterComponentStyle,
|
|
962
|
-
)}>
|
|
963
|
-
{
|
|
964
|
-
// $FlowFixMe[incompatible-type] - Typing ReactNativeComponent revealed errors
|
|
965
|
-
element
|
|
966
|
-
}
|
|
967
|
-
</View>
|
|
968
|
-
</VirtualizedListCellContextProvider>,
|
|
969
|
-
);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// 4. Render the ScrollView
|
|
973
|
-
const scrollProps = {
|
|
974
|
-
...this.props,
|
|
975
|
-
onContentSizeChange: this._onContentSizeChange,
|
|
976
|
-
onLayout: this._onLayout,
|
|
977
|
-
onScroll: this._onScroll,
|
|
978
|
-
onScrollBeginDrag: this._onScrollBeginDrag,
|
|
979
|
-
onScrollEndDrag: this._onScrollEndDrag,
|
|
980
|
-
onMomentumScrollBegin: this._onMomentumScrollBegin,
|
|
981
|
-
onMomentumScrollEnd: this._onMomentumScrollEnd,
|
|
982
|
-
scrollEventThrottle: scrollEventThrottleOrDefault(
|
|
983
|
-
this.props.scrollEventThrottle,
|
|
984
|
-
), // TODO: Android support
|
|
985
|
-
invertStickyHeaders:
|
|
986
|
-
this.props.invertStickyHeaders !== undefined
|
|
987
|
-
? this.props.invertStickyHeaders
|
|
988
|
-
: this.props.inverted,
|
|
989
|
-
stickyHeaderIndices,
|
|
990
|
-
style: inversionStyle
|
|
991
|
-
? [inversionStyle, this.props.style]
|
|
992
|
-
: this.props.style,
|
|
993
|
-
};
|
|
994
|
-
|
|
995
|
-
this._hasMore = this.state.cellsAroundViewport.last < itemCount - 1;
|
|
996
|
-
|
|
997
|
-
const innerRet = (
|
|
998
|
-
<VirtualizedListContextProvider
|
|
999
|
-
value={{
|
|
1000
|
-
cellKey: null,
|
|
1001
|
-
getScrollMetrics: this._getScrollMetrics,
|
|
1002
|
-
horizontal: horizontalOrDefault(this.props.horizontal),
|
|
1003
|
-
getOutermostParentListRef: this._getOutermostParentListRef,
|
|
1004
|
-
registerAsNestedChild: this._registerAsNestedChild,
|
|
1005
|
-
unregisterAsNestedChild: this._unregisterAsNestedChild,
|
|
1006
|
-
}}>
|
|
1007
|
-
{React.cloneElement(
|
|
1008
|
-
(
|
|
1009
|
-
this.props.renderScrollComponent ||
|
|
1010
|
-
this._defaultRenderScrollComponent
|
|
1011
|
-
)(scrollProps),
|
|
1012
|
-
{
|
|
1013
|
-
ref: this._captureScrollRef,
|
|
1014
|
-
},
|
|
1015
|
-
cells,
|
|
1016
|
-
)}
|
|
1017
|
-
</VirtualizedListContextProvider>
|
|
1018
|
-
);
|
|
1019
|
-
let ret: React.Node = innerRet;
|
|
1020
|
-
if (__DEV__) {
|
|
1021
|
-
ret = (
|
|
1022
|
-
<ScrollView.Context.Consumer>
|
|
1023
|
-
{scrollContext => {
|
|
1024
|
-
if (
|
|
1025
|
-
scrollContext != null &&
|
|
1026
|
-
!scrollContext.horizontal ===
|
|
1027
|
-
!horizontalOrDefault(this.props.horizontal) &&
|
|
1028
|
-
!this._hasWarned.nesting &&
|
|
1029
|
-
this.context == null &&
|
|
1030
|
-
this.props.scrollEnabled !== false
|
|
1031
|
-
) {
|
|
1032
|
-
// TODO (T46547044): use React.warn once 16.9 is sync'd: https://github.com/facebook/react/pull/15170
|
|
1033
|
-
console.error(
|
|
1034
|
-
'VirtualizedLists should never be nested inside plain ScrollViews with the same ' +
|
|
1035
|
-
'orientation because it can break windowing and other functionality - use another ' +
|
|
1036
|
-
'VirtualizedList-backed container instead.',
|
|
1037
|
-
);
|
|
1038
|
-
this._hasWarned.nesting = true;
|
|
1039
|
-
}
|
|
1040
|
-
return innerRet;
|
|
1041
|
-
}}
|
|
1042
|
-
</ScrollView.Context.Consumer>
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
if (this.props.debug) {
|
|
1046
|
-
return (
|
|
1047
|
-
<View style={styles.debug}>
|
|
1048
|
-
{ret}
|
|
1049
|
-
{this._renderDebugOverlay()}
|
|
1050
|
-
</View>
|
|
1051
|
-
);
|
|
1052
|
-
} else {
|
|
1053
|
-
return ret;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
componentDidUpdate(prevProps: Props) {
|
|
1058
|
-
const {data, extraData} = this.props;
|
|
1059
|
-
if (data !== prevProps.data || extraData !== prevProps.extraData) {
|
|
1060
|
-
// clear the viewableIndices cache to also trigger
|
|
1061
|
-
// the onViewableItemsChanged callback with the new data
|
|
1062
|
-
this._viewabilityTuples.forEach(tuple => {
|
|
1063
|
-
tuple.viewabilityHelper.resetViewableIndices();
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
// The `this._hiPriInProgress` is guaranteeing a hiPri cell update will only happen
|
|
1067
|
-
// once per fiber update. The `_scheduleCellsToRenderUpdate` will set it to true
|
|
1068
|
-
// if a hiPri update needs to perform. If `componentDidUpdate` is triggered with
|
|
1069
|
-
// `this._hiPriInProgress=true`, means it's triggered by the hiPri update. The
|
|
1070
|
-
// `_scheduleCellsToRenderUpdate` will check this condition and not perform
|
|
1071
|
-
// another hiPri update.
|
|
1072
|
-
const hiPriInProgress = this._hiPriInProgress;
|
|
1073
|
-
this._scheduleCellsToRenderUpdate();
|
|
1074
|
-
// Make sure setting `this._hiPriInProgress` back to false after `componentDidUpdate`
|
|
1075
|
-
// is triggered with `this._hiPriInProgress = true`
|
|
1076
|
-
if (hiPriInProgress) {
|
|
1077
|
-
this._hiPriInProgress = false;
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
_averageCellLength = 0;
|
|
1082
|
-
_cellRefs: {[string]: null | CellRenderer<any>} = {};
|
|
1083
|
-
_fillRateHelper: FillRateHelper;
|
|
1084
|
-
_frames: {
|
|
1085
|
-
[string]: {
|
|
1086
|
-
inLayout?: boolean,
|
|
1087
|
-
index: number,
|
|
1088
|
-
length: number,
|
|
1089
|
-
offset: number,
|
|
1090
|
-
},
|
|
1091
|
-
} = {};
|
|
1092
|
-
_footerLength = 0;
|
|
1093
|
-
// Used for preventing scrollToIndex from being called multiple times for initialScrollIndex
|
|
1094
|
-
_hasTriggeredInitialScrollToIndex = false;
|
|
1095
|
-
_hasInteracted = false;
|
|
1096
|
-
_hasMore = false;
|
|
1097
|
-
_hasWarned: {[string]: boolean} = {};
|
|
1098
|
-
_headerLength = 0;
|
|
1099
|
-
_hiPriInProgress: boolean = false; // flag to prevent infinite hiPri cell limit update
|
|
1100
|
-
_highestMeasuredFrameIndex = 0;
|
|
1101
|
-
_indicesToKeys: Map<number, string> = new Map();
|
|
1102
|
-
_lastFocusedCellKey: ?string = null;
|
|
1103
|
-
_nestedChildLists: ChildListCollection<VirtualizedList> =
|
|
1104
|
-
new ChildListCollection();
|
|
1105
|
-
_offsetFromParentVirtualizedList: number = 0;
|
|
1106
|
-
_prevParentOffset: number = 0;
|
|
1107
|
-
// $FlowFixMe[missing-local-annot]
|
|
1108
|
-
_scrollMetrics = {
|
|
1109
|
-
contentLength: 0,
|
|
1110
|
-
dOffset: 0,
|
|
1111
|
-
dt: 10,
|
|
1112
|
-
offset: 0,
|
|
1113
|
-
timestamp: 0,
|
|
1114
|
-
velocity: 0,
|
|
1115
|
-
visibleLength: 0,
|
|
1116
|
-
zoomScale: 1,
|
|
1117
|
-
};
|
|
1118
|
-
_scrollRef: ?React.ElementRef<any> = null;
|
|
1119
|
-
_sentEndForContentLength = 0;
|
|
1120
|
-
_totalCellLength = 0;
|
|
1121
|
-
_totalCellsMeasured = 0;
|
|
1122
|
-
_updateCellsToRenderBatcher: Batchinator;
|
|
1123
|
-
_viewabilityTuples: Array<ViewabilityHelperCallbackTuple> = [];
|
|
1124
|
-
|
|
1125
|
-
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
1126
|
-
* LTI update could not be added via codemod */
|
|
1127
|
-
_captureScrollRef = ref => {
|
|
1128
|
-
this._scrollRef = ref;
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
_computeBlankness() {
|
|
1132
|
-
this._fillRateHelper.computeBlankness(
|
|
1133
|
-
this.props,
|
|
1134
|
-
this.state.cellsAroundViewport,
|
|
1135
|
-
this._scrollMetrics,
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
1140
|
-
* LTI update could not be added via codemod */
|
|
1141
|
-
_defaultRenderScrollComponent = props => {
|
|
1142
|
-
const onRefresh = props.onRefresh;
|
|
1143
|
-
if (this._isNestedWithSameOrientation()) {
|
|
1144
|
-
// $FlowFixMe[prop-missing] - Typing ReactNativeComponent revealed errors
|
|
1145
|
-
return <View {...props} />;
|
|
1146
|
-
} else if (onRefresh) {
|
|
1147
|
-
invariant(
|
|
1148
|
-
typeof props.refreshing === 'boolean',
|
|
1149
|
-
'`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `' +
|
|
1150
|
-
JSON.stringify(props.refreshing ?? 'undefined') +
|
|
1151
|
-
'`',
|
|
1152
|
-
);
|
|
1153
|
-
return (
|
|
1154
|
-
// $FlowFixMe[prop-missing] Invalid prop usage
|
|
1155
|
-
// $FlowFixMe[incompatible-use]
|
|
1156
|
-
<ScrollView
|
|
1157
|
-
{...props}
|
|
1158
|
-
refreshControl={
|
|
1159
|
-
props.refreshControl == null ? (
|
|
1160
|
-
<RefreshControl
|
|
1161
|
-
// $FlowFixMe[incompatible-type]
|
|
1162
|
-
refreshing={props.refreshing}
|
|
1163
|
-
onRefresh={onRefresh}
|
|
1164
|
-
progressViewOffset={props.progressViewOffset}
|
|
1165
|
-
/>
|
|
1166
|
-
) : (
|
|
1167
|
-
props.refreshControl
|
|
1168
|
-
)
|
|
1169
|
-
}
|
|
1170
|
-
/>
|
|
1171
|
-
);
|
|
1172
|
-
} else {
|
|
1173
|
-
// $FlowFixMe[prop-missing] Invalid prop usage
|
|
1174
|
-
// $FlowFixMe[incompatible-use]
|
|
1175
|
-
return <ScrollView {...props} />;
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
|
|
1179
|
-
_onCellLayout = (e: LayoutEvent, cellKey: string, index: number): void => {
|
|
1180
|
-
const layout = e.nativeEvent.layout;
|
|
1181
|
-
const next = {
|
|
1182
|
-
offset: this._selectOffset(layout),
|
|
1183
|
-
length: this._selectLength(layout),
|
|
1184
|
-
index,
|
|
1185
|
-
inLayout: true,
|
|
1186
|
-
};
|
|
1187
|
-
const curr = this._frames[cellKey];
|
|
1188
|
-
if (
|
|
1189
|
-
!curr ||
|
|
1190
|
-
next.offset !== curr.offset ||
|
|
1191
|
-
next.length !== curr.length ||
|
|
1192
|
-
index !== curr.index
|
|
1193
|
-
) {
|
|
1194
|
-
this._totalCellLength += next.length - (curr ? curr.length : 0);
|
|
1195
|
-
this._totalCellsMeasured += curr ? 0 : 1;
|
|
1196
|
-
this._averageCellLength =
|
|
1197
|
-
this._totalCellLength / this._totalCellsMeasured;
|
|
1198
|
-
this._frames[cellKey] = next;
|
|
1199
|
-
this._highestMeasuredFrameIndex = Math.max(
|
|
1200
|
-
this._highestMeasuredFrameIndex,
|
|
1201
|
-
index,
|
|
1202
|
-
);
|
|
1203
|
-
this._scheduleCellsToRenderUpdate();
|
|
1204
|
-
} else {
|
|
1205
|
-
this._frames[cellKey].inLayout = true;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
this._triggerRemeasureForChildListsInCell(cellKey);
|
|
1209
|
-
|
|
1210
|
-
this._computeBlankness();
|
|
1211
|
-
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
1212
|
-
};
|
|
1213
|
-
|
|
1214
|
-
_onCellFocusCapture(cellKey: string) {
|
|
1215
|
-
this._lastFocusedCellKey = cellKey;
|
|
1216
|
-
const renderMask = VirtualizedList._createRenderMask(
|
|
1217
|
-
this.props,
|
|
1218
|
-
this.state.cellsAroundViewport,
|
|
1219
|
-
this._getNonViewportRenderRegions(this.props),
|
|
1220
|
-
);
|
|
1221
|
-
|
|
1222
|
-
this.setState(state => {
|
|
1223
|
-
if (!renderMask.equals(state.renderMask)) {
|
|
1224
|
-
return {renderMask};
|
|
1225
|
-
}
|
|
1226
|
-
return null;
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
_onCellUnmount = (cellKey: string) => {
|
|
1231
|
-
const curr = this._frames[cellKey];
|
|
1232
|
-
if (curr) {
|
|
1233
|
-
this._frames[cellKey] = {...curr, inLayout: false};
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
_triggerRemeasureForChildListsInCell(cellKey: string): void {
|
|
1238
|
-
this._nestedChildLists.forEachInCell(cellKey, childList => {
|
|
1239
|
-
childList.measureLayoutRelativeToContainingList();
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
measureLayoutRelativeToContainingList(): void {
|
|
1244
|
-
// TODO (T35574538): findNodeHandle sometimes crashes with "Unable to find
|
|
1245
|
-
// node on an unmounted component" during scrolling
|
|
1246
|
-
try {
|
|
1247
|
-
if (!this._scrollRef) {
|
|
1248
|
-
return;
|
|
1249
|
-
}
|
|
1250
|
-
// We are assuming that getOutermostParentListRef().getScrollRef()
|
|
1251
|
-
// is a non-null reference to a ScrollView
|
|
1252
|
-
this._scrollRef.measureLayout(
|
|
1253
|
-
this.context.getOutermostParentListRef().getScrollRef(),
|
|
1254
|
-
(x, y, width, height) => {
|
|
1255
|
-
this._offsetFromParentVirtualizedList = this._selectOffset({x, y});
|
|
1256
|
-
this._scrollMetrics.contentLength = this._selectLength({
|
|
1257
|
-
width,
|
|
1258
|
-
height,
|
|
1259
|
-
});
|
|
1260
|
-
const scrollMetrics = this._convertParentScrollMetrics(
|
|
1261
|
-
this.context.getScrollMetrics(),
|
|
1262
|
-
);
|
|
1263
|
-
|
|
1264
|
-
const metricsChanged =
|
|
1265
|
-
this._scrollMetrics.visibleLength !== scrollMetrics.visibleLength ||
|
|
1266
|
-
this._scrollMetrics.offset !== scrollMetrics.offset;
|
|
1267
|
-
|
|
1268
|
-
if (metricsChanged) {
|
|
1269
|
-
this._scrollMetrics.visibleLength = scrollMetrics.visibleLength;
|
|
1270
|
-
this._scrollMetrics.offset = scrollMetrics.offset;
|
|
1271
|
-
|
|
1272
|
-
// If metrics of the scrollView changed, then we triggered remeasure for child list
|
|
1273
|
-
// to ensure VirtualizedList has the right information.
|
|
1274
|
-
this._nestedChildLists.forEach(childList => {
|
|
1275
|
-
childList.measureLayoutRelativeToContainingList();
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
},
|
|
1279
|
-
error => {
|
|
1280
|
-
console.warn(
|
|
1281
|
-
"VirtualizedList: Encountered an error while measuring a list's" +
|
|
1282
|
-
' offset from its containing VirtualizedList.',
|
|
1283
|
-
);
|
|
1284
|
-
},
|
|
1285
|
-
);
|
|
1286
|
-
} catch (error) {
|
|
1287
|
-
console.warn(
|
|
1288
|
-
'measureLayoutRelativeToContainingList threw an error',
|
|
1289
|
-
error.stack,
|
|
1290
|
-
);
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
_onLayout = (e: LayoutEvent) => {
|
|
1295
|
-
if (this._isNestedWithSameOrientation()) {
|
|
1296
|
-
// Need to adjust our scroll metrics to be relative to our containing
|
|
1297
|
-
// VirtualizedList before we can make claims about list item viewability
|
|
1298
|
-
this.measureLayoutRelativeToContainingList();
|
|
1299
|
-
} else {
|
|
1300
|
-
this._scrollMetrics.visibleLength = this._selectLength(
|
|
1301
|
-
e.nativeEvent.layout,
|
|
1302
|
-
);
|
|
1303
|
-
}
|
|
1304
|
-
this.props.onLayout && this.props.onLayout(e);
|
|
1305
|
-
this._scheduleCellsToRenderUpdate();
|
|
1306
|
-
this._maybeCallOnEndReached();
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
_onLayoutEmpty = (e: LayoutEvent) => {
|
|
1310
|
-
this.props.onLayout && this.props.onLayout(e);
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
_getFooterCellKey(): string {
|
|
1314
|
-
return this._getCellKey() + '-footer';
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
_onLayoutFooter = (e: LayoutEvent) => {
|
|
1318
|
-
this._triggerRemeasureForChildListsInCell(this._getFooterCellKey());
|
|
1319
|
-
this._footerLength = this._selectLength(e.nativeEvent.layout);
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
|
-
_onLayoutHeader = (e: LayoutEvent) => {
|
|
1323
|
-
this._headerLength = this._selectLength(e.nativeEvent.layout);
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
// $FlowFixMe[missing-local-annot]
|
|
1327
|
-
_renderDebugOverlay() {
|
|
1328
|
-
const normalize =
|
|
1329
|
-
this._scrollMetrics.visibleLength /
|
|
1330
|
-
(this._scrollMetrics.contentLength || 1);
|
|
1331
|
-
const framesInLayout = [];
|
|
1332
|
-
const itemCount = this.props.getItemCount(this.props.data);
|
|
1333
|
-
for (let ii = 0; ii < itemCount; ii++) {
|
|
1334
|
-
const frame = this.__getFrameMetricsApprox(ii, this.props);
|
|
1335
|
-
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
|
|
1336
|
-
* suppresses an error found when Flow v0.68 was deployed. To see the
|
|
1337
|
-
* error delete this comment and run Flow. */
|
|
1338
|
-
if (frame.inLayout) {
|
|
1339
|
-
framesInLayout.push(frame);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
const windowTop = this.__getFrameMetricsApprox(
|
|
1343
|
-
this.state.cellsAroundViewport.first,
|
|
1344
|
-
this.props,
|
|
1345
|
-
).offset;
|
|
1346
|
-
const frameLast = this.__getFrameMetricsApprox(
|
|
1347
|
-
this.state.cellsAroundViewport.last,
|
|
1348
|
-
this.props,
|
|
1349
|
-
);
|
|
1350
|
-
const windowLen = frameLast.offset + frameLast.length - windowTop;
|
|
1351
|
-
const visTop = this._scrollMetrics.offset;
|
|
1352
|
-
const visLen = this._scrollMetrics.visibleLength;
|
|
1353
|
-
|
|
1354
|
-
return (
|
|
1355
|
-
<View style={[styles.debugOverlayBase, styles.debugOverlay]}>
|
|
1356
|
-
{framesInLayout.map((f, ii) => (
|
|
1357
|
-
<View
|
|
1358
|
-
key={'f' + ii}
|
|
1359
|
-
style={[
|
|
1360
|
-
styles.debugOverlayBase,
|
|
1361
|
-
styles.debugOverlayFrame,
|
|
1362
|
-
{
|
|
1363
|
-
top: f.offset * normalize,
|
|
1364
|
-
height: f.length * normalize,
|
|
1365
|
-
},
|
|
1366
|
-
]}
|
|
1367
|
-
/>
|
|
1368
|
-
))}
|
|
1369
|
-
<View
|
|
1370
|
-
style={[
|
|
1371
|
-
styles.debugOverlayBase,
|
|
1372
|
-
styles.debugOverlayFrameLast,
|
|
1373
|
-
{
|
|
1374
|
-
top: windowTop * normalize,
|
|
1375
|
-
height: windowLen * normalize,
|
|
1376
|
-
},
|
|
1377
|
-
]}
|
|
1378
|
-
/>
|
|
1379
|
-
<View
|
|
1380
|
-
style={[
|
|
1381
|
-
styles.debugOverlayBase,
|
|
1382
|
-
styles.debugOverlayFrameVis,
|
|
1383
|
-
{
|
|
1384
|
-
top: visTop * normalize,
|
|
1385
|
-
height: visLen * normalize,
|
|
1386
|
-
},
|
|
1387
|
-
]}
|
|
1388
|
-
/>
|
|
1389
|
-
</View>
|
|
1390
|
-
);
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
_selectLength(
|
|
1394
|
-
metrics: $ReadOnly<{
|
|
1395
|
-
height: number,
|
|
1396
|
-
width: number,
|
|
1397
|
-
...
|
|
1398
|
-
}>,
|
|
1399
|
-
): number {
|
|
1400
|
-
return !horizontalOrDefault(this.props.horizontal)
|
|
1401
|
-
? metrics.height
|
|
1402
|
-
: metrics.width;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
_selectOffset(
|
|
1406
|
-
metrics: $ReadOnly<{
|
|
1407
|
-
x: number,
|
|
1408
|
-
y: number,
|
|
1409
|
-
...
|
|
1410
|
-
}>,
|
|
1411
|
-
): number {
|
|
1412
|
-
return !horizontalOrDefault(this.props.horizontal) ? metrics.y : metrics.x;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
_maybeCallOnEndReached() {
|
|
1416
|
-
const {data, getItemCount, onEndReached, onEndReachedThreshold} =
|
|
1417
|
-
this.props;
|
|
1418
|
-
const {contentLength, visibleLength, offset} = this._scrollMetrics;
|
|
1419
|
-
let distanceFromEnd = contentLength - visibleLength - offset;
|
|
1420
|
-
|
|
1421
|
-
// Especially when oERT is zero it's necessary to 'floor' very small distanceFromEnd values to be 0
|
|
1422
|
-
// since debouncing causes us to not fire this event for every single "pixel" we scroll and can thus
|
|
1423
|
-
// be at the "end" of the list with a distanceFromEnd approximating 0 but not quite there.
|
|
1424
|
-
if (distanceFromEnd < ON_END_REACHED_EPSILON) {
|
|
1425
|
-
distanceFromEnd = 0;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
// TODO: T121172172 Look into why we're "defaulting" to a threshold of 2 when oERT is not present
|
|
1429
|
-
const threshold =
|
|
1430
|
-
onEndReachedThreshold != null ? onEndReachedThreshold * visibleLength : 2;
|
|
1431
|
-
if (
|
|
1432
|
-
onEndReached &&
|
|
1433
|
-
this.state.cellsAroundViewport.last === getItemCount(data) - 1 &&
|
|
1434
|
-
distanceFromEnd <= threshold &&
|
|
1435
|
-
this._scrollMetrics.contentLength !== this._sentEndForContentLength
|
|
1436
|
-
) {
|
|
1437
|
-
// Only call onEndReached once for a given content length
|
|
1438
|
-
this._sentEndForContentLength = this._scrollMetrics.contentLength;
|
|
1439
|
-
onEndReached({distanceFromEnd});
|
|
1440
|
-
} else if (distanceFromEnd > threshold) {
|
|
1441
|
-
// If the user scrolls away from the end and back again cause
|
|
1442
|
-
// an onEndReached to be triggered again
|
|
1443
|
-
this._sentEndForContentLength = 0;
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
_onContentSizeChange = (width: number, height: number) => {
|
|
1448
|
-
if (
|
|
1449
|
-
width > 0 &&
|
|
1450
|
-
height > 0 &&
|
|
1451
|
-
this.props.initialScrollIndex != null &&
|
|
1452
|
-
this.props.initialScrollIndex > 0 &&
|
|
1453
|
-
!this._hasTriggeredInitialScrollToIndex
|
|
1454
|
-
) {
|
|
1455
|
-
if (this.props.contentOffset == null) {
|
|
1456
|
-
this.scrollToIndex({
|
|
1457
|
-
animated: false,
|
|
1458
|
-
index: this.props.initialScrollIndex,
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
this._hasTriggeredInitialScrollToIndex = true;
|
|
1462
|
-
}
|
|
1463
|
-
if (this.props.onContentSizeChange) {
|
|
1464
|
-
this.props.onContentSizeChange(width, height);
|
|
1465
|
-
}
|
|
1466
|
-
this._scrollMetrics.contentLength = this._selectLength({height, width});
|
|
1467
|
-
this._scheduleCellsToRenderUpdate();
|
|
1468
|
-
this._maybeCallOnEndReached();
|
|
1469
|
-
};
|
|
1470
|
-
|
|
1471
|
-
/* Translates metrics from a scroll event in a parent VirtualizedList into
|
|
1472
|
-
* coordinates relative to the child list.
|
|
1473
|
-
*/
|
|
1474
|
-
_convertParentScrollMetrics = (metrics: {
|
|
1475
|
-
visibleLength: number,
|
|
1476
|
-
offset: number,
|
|
1477
|
-
...
|
|
1478
|
-
}): $FlowFixMe => {
|
|
1479
|
-
// Offset of the top of the nested list relative to the top of its parent's viewport
|
|
1480
|
-
const offset = metrics.offset - this._offsetFromParentVirtualizedList;
|
|
1481
|
-
// Child's visible length is the same as its parent's
|
|
1482
|
-
const visibleLength = metrics.visibleLength;
|
|
1483
|
-
const dOffset = offset - this._scrollMetrics.offset;
|
|
1484
|
-
const contentLength = this._scrollMetrics.contentLength;
|
|
1485
|
-
|
|
1486
|
-
return {
|
|
1487
|
-
visibleLength,
|
|
1488
|
-
contentLength,
|
|
1489
|
-
offset,
|
|
1490
|
-
dOffset,
|
|
1491
|
-
};
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
_onScroll = (e: Object) => {
|
|
1495
|
-
this._nestedChildLists.forEach(childList => {
|
|
1496
|
-
childList._onScroll(e);
|
|
1497
|
-
});
|
|
1498
|
-
if (this.props.onScroll) {
|
|
1499
|
-
this.props.onScroll(e);
|
|
1500
|
-
}
|
|
1501
|
-
const timestamp = e.timeStamp;
|
|
1502
|
-
let visibleLength = this._selectLength(e.nativeEvent.layoutMeasurement);
|
|
1503
|
-
let contentLength = this._selectLength(e.nativeEvent.contentSize);
|
|
1504
|
-
let offset = this._selectOffset(e.nativeEvent.contentOffset);
|
|
1505
|
-
let dOffset = offset - this._scrollMetrics.offset;
|
|
1506
|
-
|
|
1507
|
-
if (this._isNestedWithSameOrientation()) {
|
|
1508
|
-
if (this._scrollMetrics.contentLength === 0) {
|
|
1509
|
-
// Ignore scroll events until onLayout has been called and we
|
|
1510
|
-
// know our offset from our offset from our parent
|
|
1511
|
-
return;
|
|
1512
|
-
}
|
|
1513
|
-
({visibleLength, contentLength, offset, dOffset} =
|
|
1514
|
-
this._convertParentScrollMetrics({
|
|
1515
|
-
visibleLength,
|
|
1516
|
-
offset,
|
|
1517
|
-
}));
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
const dt = this._scrollMetrics.timestamp
|
|
1521
|
-
? Math.max(1, timestamp - this._scrollMetrics.timestamp)
|
|
1522
|
-
: 1;
|
|
1523
|
-
const velocity = dOffset / dt;
|
|
1524
|
-
|
|
1525
|
-
if (
|
|
1526
|
-
dt > 500 &&
|
|
1527
|
-
this._scrollMetrics.dt > 500 &&
|
|
1528
|
-
contentLength > 5 * visibleLength &&
|
|
1529
|
-
!this._hasWarned.perf
|
|
1530
|
-
) {
|
|
1531
|
-
infoLog(
|
|
1532
|
-
'VirtualizedList: You have a large list that is slow to update - make sure your ' +
|
|
1533
|
-
'renderItem function renders components that follow React performance best practices ' +
|
|
1534
|
-
'like PureComponent, shouldComponentUpdate, etc.',
|
|
1535
|
-
{dt, prevDt: this._scrollMetrics.dt, contentLength},
|
|
1536
|
-
);
|
|
1537
|
-
this._hasWarned.perf = true;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
// For invalid negative values (w/ RTL), set this to 1.
|
|
1541
|
-
const zoomScale = e.nativeEvent.zoomScale < 0 ? 1 : e.nativeEvent.zoomScale;
|
|
1542
|
-
this._scrollMetrics = {
|
|
1543
|
-
contentLength,
|
|
1544
|
-
dt,
|
|
1545
|
-
dOffset,
|
|
1546
|
-
offset,
|
|
1547
|
-
timestamp,
|
|
1548
|
-
velocity,
|
|
1549
|
-
visibleLength,
|
|
1550
|
-
zoomScale,
|
|
1551
|
-
};
|
|
1552
|
-
this._updateViewableItems(this.props, this.state.cellsAroundViewport);
|
|
1553
|
-
if (!this.props) {
|
|
1554
|
-
return;
|
|
1555
|
-
}
|
|
1556
|
-
this._maybeCallOnEndReached();
|
|
1557
|
-
if (velocity !== 0) {
|
|
1558
|
-
this._fillRateHelper.activate();
|
|
1559
|
-
}
|
|
1560
|
-
this._computeBlankness();
|
|
1561
|
-
this._scheduleCellsToRenderUpdate();
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
_scheduleCellsToRenderUpdate() {
|
|
1565
|
-
const {first, last} = this.state.cellsAroundViewport;
|
|
1566
|
-
const {offset, visibleLength, velocity} = this._scrollMetrics;
|
|
1567
|
-
const itemCount = this.props.getItemCount(this.props.data);
|
|
1568
|
-
let hiPri = false;
|
|
1569
|
-
const onEndReachedThreshold = onEndReachedThresholdOrDefault(
|
|
1570
|
-
this.props.onEndReachedThreshold,
|
|
1571
|
-
);
|
|
1572
|
-
const scrollingThreshold = (onEndReachedThreshold * visibleLength) / 2;
|
|
1573
|
-
// Mark as high priority if we're close to the start of the first item
|
|
1574
|
-
// But only if there are items before the first rendered item
|
|
1575
|
-
if (first > 0) {
|
|
1576
|
-
const distTop =
|
|
1577
|
-
offset - this.__getFrameMetricsApprox(first, this.props).offset;
|
|
1578
|
-
hiPri =
|
|
1579
|
-
hiPri || distTop < 0 || (velocity < -2 && distTop < scrollingThreshold);
|
|
1580
|
-
}
|
|
1581
|
-
// Mark as high priority if we're close to the end of the last item
|
|
1582
|
-
// But only if there are items after the last rendered item
|
|
1583
|
-
if (last >= 0 && last < itemCount - 1) {
|
|
1584
|
-
const distBottom =
|
|
1585
|
-
this.__getFrameMetricsApprox(last, this.props).offset -
|
|
1586
|
-
(offset + visibleLength);
|
|
1587
|
-
hiPri =
|
|
1588
|
-
hiPri ||
|
|
1589
|
-
distBottom < 0 ||
|
|
1590
|
-
(velocity > 2 && distBottom < scrollingThreshold);
|
|
1591
|
-
}
|
|
1592
|
-
// Only trigger high-priority updates if we've actually rendered cells,
|
|
1593
|
-
// and with that size estimate, accurately compute how many cells we should render.
|
|
1594
|
-
// Otherwise, it would just render as many cells as it can (of zero dimension),
|
|
1595
|
-
// each time through attempting to render more (limited by maxToRenderPerBatch),
|
|
1596
|
-
// starving the renderer from actually laying out the objects and computing _averageCellLength.
|
|
1597
|
-
// If this is triggered in an `componentDidUpdate` followed by a hiPri cellToRenderUpdate
|
|
1598
|
-
// We shouldn't do another hipri cellToRenderUpdate
|
|
1599
|
-
if (
|
|
1600
|
-
hiPri &&
|
|
1601
|
-
(this._averageCellLength || this.props.getItemLayout) &&
|
|
1602
|
-
!this._hiPriInProgress
|
|
1603
|
-
) {
|
|
1604
|
-
this._hiPriInProgress = true;
|
|
1605
|
-
// Don't worry about interactions when scrolling quickly; focus on filling content as fast
|
|
1606
|
-
// as possible.
|
|
1607
|
-
this._updateCellsToRenderBatcher.dispose({abort: true});
|
|
1608
|
-
this._updateCellsToRender();
|
|
1609
|
-
return;
|
|
1610
|
-
} else {
|
|
1611
|
-
this._updateCellsToRenderBatcher.schedule();
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
_onScrollBeginDrag = (e: ScrollEvent): void => {
|
|
1616
|
-
this._nestedChildLists.forEach(childList => {
|
|
1617
|
-
childList._onScrollBeginDrag(e);
|
|
1618
|
-
});
|
|
1619
|
-
this._viewabilityTuples.forEach(tuple => {
|
|
1620
|
-
tuple.viewabilityHelper.recordInteraction();
|
|
1621
|
-
});
|
|
1622
|
-
this._hasInteracted = true;
|
|
1623
|
-
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
|
|
1624
|
-
};
|
|
1625
|
-
|
|
1626
|
-
_onScrollEndDrag = (e: ScrollEvent): void => {
|
|
1627
|
-
this._nestedChildLists.forEach(childList => {
|
|
1628
|
-
childList._onScrollEndDrag(e);
|
|
1629
|
-
});
|
|
1630
|
-
const {velocity} = e.nativeEvent;
|
|
1631
|
-
if (velocity) {
|
|
1632
|
-
this._scrollMetrics.velocity = this._selectOffset(velocity);
|
|
1633
|
-
}
|
|
1634
|
-
this._computeBlankness();
|
|
1635
|
-
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
|
|
1636
|
-
};
|
|
1637
|
-
|
|
1638
|
-
_onMomentumScrollBegin = (e: ScrollEvent): void => {
|
|
1639
|
-
this._nestedChildLists.forEach(childList => {
|
|
1640
|
-
childList._onMomentumScrollBegin(e);
|
|
1641
|
-
});
|
|
1642
|
-
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1645
|
-
_onMomentumScrollEnd = (e: ScrollEvent): void => {
|
|
1646
|
-
this._nestedChildLists.forEach(childList => {
|
|
1647
|
-
childList._onMomentumScrollEnd(e);
|
|
1648
|
-
});
|
|
1649
|
-
this._scrollMetrics.velocity = 0;
|
|
1650
|
-
this._computeBlankness();
|
|
1651
|
-
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
|
|
1652
|
-
};
|
|
1653
|
-
|
|
1654
|
-
_updateCellsToRender = () => {
|
|
1655
|
-
this.setState((state, props) => {
|
|
1656
|
-
const cellsAroundViewport = this._adjustCellsAroundViewport(
|
|
1657
|
-
props,
|
|
1658
|
-
state.cellsAroundViewport,
|
|
1659
|
-
);
|
|
1660
|
-
const renderMask = VirtualizedList._createRenderMask(
|
|
1661
|
-
props,
|
|
1662
|
-
cellsAroundViewport,
|
|
1663
|
-
this._getNonViewportRenderRegions(props),
|
|
1664
|
-
);
|
|
1665
|
-
|
|
1666
|
-
if (
|
|
1667
|
-
cellsAroundViewport.first === state.cellsAroundViewport.first &&
|
|
1668
|
-
cellsAroundViewport.last === state.cellsAroundViewport.last &&
|
|
1669
|
-
renderMask.equals(state.renderMask)
|
|
1670
|
-
) {
|
|
1671
|
-
return null;
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
return {cellsAroundViewport, renderMask};
|
|
1675
|
-
});
|
|
1676
|
-
};
|
|
1677
|
-
|
|
1678
|
-
_createViewToken = (
|
|
1679
|
-
index: number,
|
|
1680
|
-
isViewable: boolean,
|
|
1681
|
-
props: FrameMetricProps,
|
|
1682
|
-
// $FlowFixMe[missing-local-annot]
|
|
1683
|
-
) => {
|
|
1684
|
-
const {data, getItem} = props;
|
|
1685
|
-
const item = getItem(data, index);
|
|
1686
|
-
return {
|
|
1687
|
-
index,
|
|
1688
|
-
item,
|
|
1689
|
-
key: this._keyExtractor(item, index, props),
|
|
1690
|
-
isViewable,
|
|
1691
|
-
};
|
|
1692
|
-
};
|
|
1693
|
-
|
|
1694
|
-
/**
|
|
1695
|
-
* Gets an approximate offset to an item at a given index. Supports
|
|
1696
|
-
* fractional indices.
|
|
1697
|
-
*/
|
|
1698
|
-
_getOffsetApprox = (index: number, props: FrameMetricProps): number => {
|
|
1699
|
-
if (Number.isInteger(index)) {
|
|
1700
|
-
return this.__getFrameMetricsApprox(index, props).offset;
|
|
1701
|
-
} else {
|
|
1702
|
-
const frameMetrics = this.__getFrameMetricsApprox(
|
|
1703
|
-
Math.floor(index),
|
|
1704
|
-
props,
|
|
1705
|
-
);
|
|
1706
|
-
const remainder = index - Math.floor(index);
|
|
1707
|
-
return frameMetrics.offset + remainder * frameMetrics.length;
|
|
1708
|
-
}
|
|
1709
|
-
};
|
|
1710
|
-
|
|
1711
|
-
__getFrameMetricsApprox: (
|
|
1712
|
-
index: number,
|
|
1713
|
-
props: FrameMetricProps,
|
|
1714
|
-
) => {
|
|
1715
|
-
length: number,
|
|
1716
|
-
offset: number,
|
|
1717
|
-
...
|
|
1718
|
-
} = (index, props) => {
|
|
1719
|
-
const frame = this._getFrameMetrics(index, props);
|
|
1720
|
-
if (frame && frame.index === index) {
|
|
1721
|
-
// check for invalid frames due to row re-ordering
|
|
1722
|
-
return frame;
|
|
1723
|
-
} else {
|
|
1724
|
-
const {data, getItemCount, getItemLayout} = props;
|
|
1725
|
-
invariant(
|
|
1726
|
-
index >= 0 && index < getItemCount(data),
|
|
1727
|
-
'Tried to get frame for out of range index ' + index,
|
|
1728
|
-
);
|
|
1729
|
-
invariant(
|
|
1730
|
-
!getItemLayout,
|
|
1731
|
-
'Should not have to estimate frames when a measurement metrics function is provided',
|
|
1732
|
-
);
|
|
1733
|
-
return {
|
|
1734
|
-
length: this._averageCellLength,
|
|
1735
|
-
offset: this._averageCellLength * index,
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
|
-
_getFrameMetrics = (
|
|
1741
|
-
index: number,
|
|
1742
|
-
props: FrameMetricProps,
|
|
1743
|
-
): ?{
|
|
1744
|
-
length: number,
|
|
1745
|
-
offset: number,
|
|
1746
|
-
index: number,
|
|
1747
|
-
inLayout?: boolean,
|
|
1748
|
-
...
|
|
1749
|
-
} => {
|
|
1750
|
-
const {data, getItem, getItemCount, getItemLayout} = props;
|
|
1751
|
-
invariant(
|
|
1752
|
-
index >= 0 && index < getItemCount(data),
|
|
1753
|
-
'Tried to get frame for out of range index ' + index,
|
|
1754
|
-
);
|
|
1755
|
-
const item = getItem(data, index);
|
|
1756
|
-
const frame = item && this._frames[this._keyExtractor(item, index, props)];
|
|
1757
|
-
if (!frame || frame.index !== index) {
|
|
1758
|
-
if (getItemLayout) {
|
|
1759
|
-
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
|
|
1760
|
-
* suppresses an error found when Flow v0.63 was deployed. To see the error
|
|
1761
|
-
* delete this comment and run Flow. */
|
|
1762
|
-
return getItemLayout(data, index);
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
return frame;
|
|
1766
|
-
};
|
|
1767
|
-
|
|
1768
|
-
_getNonViewportRenderRegions = (
|
|
1769
|
-
props: FrameMetricProps,
|
|
1770
|
-
): $ReadOnlyArray<{
|
|
1771
|
-
first: number,
|
|
1772
|
-
last: number,
|
|
1773
|
-
}> => {
|
|
1774
|
-
// Keep a viewport's worth of content around the last focused cell to allow
|
|
1775
|
-
// random navigation around it without any blanking. E.g. tabbing from one
|
|
1776
|
-
// focused item out of viewport to another.
|
|
1777
|
-
if (
|
|
1778
|
-
!(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey])
|
|
1779
|
-
) {
|
|
1780
|
-
return [];
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
const lastFocusedCellRenderer = this._cellRefs[this._lastFocusedCellKey];
|
|
1784
|
-
const focusedCellIndex = lastFocusedCellRenderer.props.index;
|
|
1785
|
-
const itemCount = props.getItemCount(props.data);
|
|
1786
|
-
|
|
1787
|
-
// The cell may have been unmounted and have a stale index
|
|
1788
|
-
if (
|
|
1789
|
-
focusedCellIndex >= itemCount ||
|
|
1790
|
-
this._indicesToKeys.get(focusedCellIndex) !== this._lastFocusedCellKey
|
|
1791
|
-
) {
|
|
1792
|
-
return [];
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
let first = focusedCellIndex;
|
|
1796
|
-
let heightOfCellsBeforeFocused = 0;
|
|
1797
|
-
for (
|
|
1798
|
-
let i = first - 1;
|
|
1799
|
-
i >= 0 && heightOfCellsBeforeFocused < this._scrollMetrics.visibleLength;
|
|
1800
|
-
i--
|
|
1801
|
-
) {
|
|
1802
|
-
first--;
|
|
1803
|
-
heightOfCellsBeforeFocused += this.__getFrameMetricsApprox(
|
|
1804
|
-
i,
|
|
1805
|
-
props,
|
|
1806
|
-
).length;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
let last = focusedCellIndex;
|
|
1810
|
-
let heightOfCellsAfterFocused = 0;
|
|
1811
|
-
for (
|
|
1812
|
-
let i = last + 1;
|
|
1813
|
-
i < itemCount &&
|
|
1814
|
-
heightOfCellsAfterFocused < this._scrollMetrics.visibleLength;
|
|
1815
|
-
i++
|
|
1816
|
-
) {
|
|
1817
|
-
last++;
|
|
1818
|
-
heightOfCellsAfterFocused += this.__getFrameMetricsApprox(
|
|
1819
|
-
i,
|
|
1820
|
-
props,
|
|
1821
|
-
).length;
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
return [{first, last}];
|
|
1825
|
-
};
|
|
1826
|
-
|
|
1827
|
-
_updateViewableItems(
|
|
1828
|
-
props: FrameMetricProps,
|
|
1829
|
-
cellsAroundViewport: {first: number, last: number},
|
|
1830
|
-
) {
|
|
1831
|
-
this._viewabilityTuples.forEach(tuple => {
|
|
1832
|
-
tuple.viewabilityHelper.onUpdate(
|
|
1833
|
-
props,
|
|
1834
|
-
this._scrollMetrics.offset,
|
|
1835
|
-
this._scrollMetrics.visibleLength,
|
|
1836
|
-
this._getFrameMetrics,
|
|
1837
|
-
this._createViewToken,
|
|
1838
|
-
tuple.onViewableItemsChanged,
|
|
1839
|
-
cellsAroundViewport,
|
|
1840
|
-
);
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
const styles = StyleSheet.create({
|
|
1846
|
-
verticallyInverted: {
|
|
1847
|
-
transform: [{scaleY: -1}],
|
|
1848
|
-
},
|
|
1849
|
-
horizontallyInverted: {
|
|
1850
|
-
transform: [{scaleX: -1}],
|
|
1851
|
-
},
|
|
1852
|
-
debug: {
|
|
1853
|
-
flex: 1,
|
|
1854
|
-
},
|
|
1855
|
-
debugOverlayBase: {
|
|
1856
|
-
position: 'absolute',
|
|
1857
|
-
top: 0,
|
|
1858
|
-
right: 0,
|
|
1859
|
-
},
|
|
1860
|
-
debugOverlay: {
|
|
1861
|
-
bottom: 0,
|
|
1862
|
-
width: 20,
|
|
1863
|
-
borderColor: 'blue',
|
|
1864
|
-
borderWidth: 1,
|
|
1865
|
-
},
|
|
1866
|
-
debugOverlayFrame: {
|
|
1867
|
-
left: 0,
|
|
1868
|
-
backgroundColor: 'orange',
|
|
1869
|
-
},
|
|
1870
|
-
debugOverlayFrameLast: {
|
|
1871
|
-
left: 0,
|
|
1872
|
-
borderColor: 'green',
|
|
1873
|
-
borderWidth: 2,
|
|
1874
|
-
},
|
|
1875
|
-
debugOverlayFrameVis: {
|
|
1876
|
-
left: 0,
|
|
1877
|
-
borderColor: 'red',
|
|
1878
|
-
borderWidth: 2,
|
|
1879
|
-
},
|
|
1880
|
-
});
|
|
18
|
+
export type {
|
|
19
|
+
RenderItemProps,
|
|
20
|
+
RenderItemType,
|
|
21
|
+
Separators,
|
|
22
|
+
} from '@react-native/virtualized-lists';
|
|
23
|
+
module.exports = VirtualizedList;
|