@office-iss/react-native-win32 0.0.0-canary.27 → 0.0.0-canary.271
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/.eslintignore +5 -2
- package/.eslintrc.js +27 -2
- package/.flowconfig +72 -37
- package/CHANGELOG.json +5588 -1
- package/CHANGELOG.md +2224 -7
- package/IntegrationTests/AccessibilityManagerTest.js +8 -11
- package/IntegrationTests/AppEventsTest.js +3 -3
- package/IntegrationTests/GlobalEvalWithSourceUrlTest.js +12 -5
- package/IntegrationTests/ImageCachePolicyTest.js +5 -5
- package/IntegrationTests/ImageSnapshotTest.js +2 -2
- package/IntegrationTests/IntegrationTestHarnessTest.js +9 -6
- package/IntegrationTests/IntegrationTestsApp.js +16 -21
- package/IntegrationTests/LayoutEventsTest.js +14 -12
- package/IntegrationTests/LoggingTestModule.js +10 -12
- package/IntegrationTests/PromiseTest.js +2 -1
- package/IntegrationTests/SimpleSnapshotTest.js +2 -4
- package/IntegrationTests/SyncMethodTest.js +2 -2
- package/IntegrationTests/TimersTest.js +20 -5
- package/IntegrationTests/WebSocketTest.js +5 -5
- package/IntegrationTests/launchWebSocketServer.sh +12 -0
- package/IntegrationTests/websocket_integration_test_server.js +3 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +86 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +38 -11
- package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +5 -43
- package/Libraries/Alert/Alert.d.ts +91 -0
- package/Libraries/Alert/Alert.js +31 -10
- package/Libraries/Alert/Alert.win32.js +6 -4
- package/Libraries/Alert/NativeAlertManager.js +5 -26
- package/Libraries/Alert/RCTAlertManager.android.js +2 -4
- package/Libraries/Alert/RCTAlertManager.ios.js +2 -3
- package/Libraries/Animated/Animated.d.ts +626 -0
- package/Libraries/Animated/Animated.js +48 -0
- package/Libraries/Animated/AnimatedEvent.js +256 -0
- package/Libraries/Animated/AnimatedImplementation.js +754 -0
- package/Libraries/Animated/AnimatedMock.js +195 -0
- package/Libraries/Animated/AnimatedPlatformConfig.js +13 -0
- package/Libraries/Animated/AnimatedWeb.js +26 -0
- package/Libraries/Animated/Easing.d.ts +37 -0
- package/Libraries/Animated/Easing.js +250 -0
- package/Libraries/Animated/NativeAnimatedAllowlist.js +122 -0
- package/Libraries/Animated/NativeAnimatedModule.js +13 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +13 -0
- package/Libraries/Animated/SpringConfig.js +98 -0
- package/Libraries/Animated/animations/Animation.js +175 -0
- package/Libraries/Animated/animations/DecayAnimation.js +121 -0
- package/Libraries/Animated/animations/SpringAnimation.js +372 -0
- package/Libraries/Animated/animations/TimingAnimation.js +173 -0
- package/Libraries/Animated/bezier.js +164 -0
- package/Libraries/Animated/components/AnimatedFlatList.js +20 -0
- package/Libraries/Animated/components/AnimatedImage.js +22 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +137 -0
- package/Libraries/Animated/components/AnimatedSectionList.js +20 -0
- package/Libraries/Animated/components/AnimatedText.js +22 -0
- package/Libraries/Animated/components/AnimatedView.js +20 -0
- package/Libraries/Animated/createAnimatedComponent.js +101 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +64 -0
- package/Libraries/Animated/nodes/AnimatedColor.js +320 -0
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +72 -0
- package/Libraries/Animated/nodes/AnimatedDivision.js +80 -0
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +416 -0
- package/Libraries/Animated/nodes/AnimatedModulo.js +63 -0
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +63 -0
- package/Libraries/Animated/nodes/AnimatedNode.js +200 -0
- package/Libraries/Animated/nodes/AnimatedObject.js +162 -0
- package/Libraries/Animated/nodes/AnimatedProps.js +273 -0
- package/Libraries/Animated/nodes/AnimatedStyle.js +243 -0
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +64 -0
- package/Libraries/Animated/nodes/AnimatedTracking.js +100 -0
- package/Libraries/Animated/nodes/AnimatedTransform.js +198 -0
- package/Libraries/Animated/nodes/AnimatedValue.js +303 -0
- package/Libraries/Animated/nodes/AnimatedValueXY.js +236 -0
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +85 -0
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
- package/Libraries/Animated/useAnimatedProps.js +401 -0
- package/Libraries/Animated/useAnimatedValue.d.ts +15 -0
- package/Libraries/Animated/useAnimatedValue.js +25 -0
- package/Libraries/AppState/AppState.d.ts +58 -0
- package/Libraries/AppState/AppState.js +91 -144
- package/Libraries/AppState/NativeAppState.js +5 -22
- package/Libraries/BatchedBridge/BatchedBridge.js +2 -2
- package/Libraries/BatchedBridge/MessageQueue.js +136 -114
- package/Libraries/BatchedBridge/NativeModules.d.ts +25 -0
- package/Libraries/BatchedBridge/NativeModules.js +36 -21
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +1 -1
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +3 -3
- package/Libraries/Blob/Blob.js +20 -3
- package/Libraries/Blob/BlobManager.js +7 -10
- package/Libraries/Blob/BlobRegistry.js +15 -10
- package/Libraries/Blob/BlobTypes.js +1 -1
- package/Libraries/Blob/File.js +3 -4
- package/Libraries/Blob/FileReader.js +36 -16
- package/Libraries/Blob/NativeBlobModule.js +5 -18
- package/Libraries/Blob/NativeFileReaderModule.js +5 -15
- package/Libraries/Blob/URL.js +38 -87
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Blob/__mocks__/BlobModule.js +1 -1
- package/Libraries/Blob/__mocks__/FileReaderModule.js +1 -1
- package/Libraries/BugReporting/BugReporting.js +8 -9
- package/Libraries/BugReporting/NativeBugReporting.js +5 -12
- package/Libraries/BugReporting/dumpReactTree.js +1 -1
- package/Libraries/BugReporting/getReactData.js +17 -8
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +177 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +479 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +447 -96
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js +5 -19
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoWin32.js +11 -0
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js +5 -51
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js +36 -0
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.ios.js +26 -0
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.win32.js +36 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +86 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +73 -48
- package/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +4 -47
- package/Libraries/Components/Button/ButtonWin32.Props.d.ts +36 -36
- package/Libraries/Components/Button/ButtonWin32.Props.js +3 -3
- package/Libraries/Components/Button/ButtonWin32.Props.js.map +1 -0
- package/Libraries/Components/Button/ButtonWin32.d.ts +19 -19
- package/Libraries/Components/Button/ButtonWin32.js +83 -103
- package/Libraries/Components/Button/ButtonWin32.js.map +1 -0
- package/Libraries/Components/Button.d.ts +42 -0
- package/Libraries/Components/Button.js +325 -125
- package/Libraries/Components/Button.win32.js +460 -0
- package/Libraries/Components/Clipboard/Clipboard.d.ts +28 -0
- package/Libraries/Components/Clipboard/Clipboard.js +3 -5
- package/Libraries/Components/Clipboard/NativeClipboard.js +5 -14
- package/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +4 -116
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +44 -35
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +141 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +4 -2
- package/Libraries/Components/EnterString.win32.d.ts +12 -12
- package/Libraries/Components/EnterString.win32.js +82 -114
- package/Libraries/Components/EnterString.win32.js.map +1 -0
- package/Libraries/Components/Keyboard/Keyboard.d.ts +109 -0
- package/Libraries/Components/Keyboard/Keyboard.js +81 -71
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts +46 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +116 -56
- package/Libraries/Components/Keyboard/NativeKeyboardObserver.js +5 -13
- package/Libraries/Components/Pressable/Pressable.d.ts +167 -0
- package/Libraries/Components/Pressable/Pressable.js +176 -43
- package/Libraries/Components/Pressable/Pressable.win32.js +437 -0
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +38 -23
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +28 -22
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +83 -0
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +1 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +5 -27
- package/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +4 -77
- package/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +4 -56
- package/Libraries/Components/RefreshControl/RefreshControl.d.ts +87 -0
- package/Libraries/Components/RefreshControl/RefreshControl.js +16 -38
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +7 -10
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +4 -20
- package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +24 -0
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +12 -39
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +12 -41
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +5 -32
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +39 -21
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +13 -20
- package/Libraries/Components/ScrollView/ScrollView.d.ts +910 -0
- package/Libraries/Components/ScrollView/ScrollView.js +1153 -434
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +4 -4
- package/Libraries/Components/ScrollView/ScrollViewContext.js +22 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +170 -18
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +11 -17
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +207 -62
- package/Libraries/Components/ScrollView/processDecelerationRate.js +2 -4
- package/Libraries/Components/Sound/NativeSoundManager.js +5 -15
- package/Libraries/Components/Sound/SoundManager.js +3 -4
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +5 -27
- package/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +5 -35
- package/Libraries/Components/StatusBar/StatusBar.d.ts +138 -0
- package/Libraries/Components/StatusBar/StatusBar.js +40 -60
- package/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +5 -56
- package/Libraries/Components/Switch/Switch.d.ts +115 -0
- package/Libraries/Components/Switch/Switch.js +162 -133
- package/Libraries/Components/Switch/SwitchNativeComponent.js +5 -50
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +237 -67
- package/Libraries/Components/TextInput/InputAccessoryView.d.ts +34 -0
- package/Libraries/Components/TextInput/InputAccessoryView.js +28 -23
- package/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +5 -18
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +26 -31
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +18 -38
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +167 -0
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +8 -8
- package/Libraries/Components/TextInput/Tests/TextInputTest.js +128 -126
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +1003 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +1105 -0
- package/Libraries/Components/TextInput/TextInput.js +1132 -445
- package/Libraries/Components/TextInput/TextInput.win32.js +2028 -179
- package/Libraries/Components/TextInput/TextInputNativeCommands.js +29 -0
- package/Libraries/Components/TextInput/TextInputState.js +42 -21
- package/Libraries/Components/TextInput/TextInputState.win32.js +55 -30
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +23 -0
- package/Libraries/Components/ToastAndroid/NativeToastAndroid.js +5 -31
- package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +11 -10
- package/Libraries/Components/ToastAndroid/ToastAndroid.d.ts +47 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +45 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +16 -10
- package/Libraries/Components/Touchable/BoundingDimensions.js +13 -6
- package/Libraries/Components/Touchable/PooledClass.js +26 -15
- package/Libraries/Components/Touchable/Position.js +9 -5
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +8 -8
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +344 -381
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -0
- package/Libraries/Components/Touchable/Touchable.d.ts +90 -0
- package/Libraries/Components/Touchable/Touchable.js +122 -133
- package/Libraries/Components/Touchable/Touchable.win32.js +978 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +56 -55
- package/Libraries/Components/Touchable/TouchableHighlight.d.ts +62 -0
- package/Libraries/Components/Touchable/TouchableHighlight.js +66 -56
- package/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +119 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +86 -67
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +99 -51
- package/Libraries/Components/Touchable/TouchableOpacity.d.ts +81 -0
- package/Libraries/Components/Touchable/TouchableOpacity.js +94 -58
- package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +37 -34
- package/Libraries/Components/Touchable/TouchableWin32.Props.js +3 -3
- package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -0
- package/Libraries/Components/Touchable/TouchableWin32.Types.d.ts +114 -114
- package/Libraries/Components/Touchable/TouchableWin32.Types.js +3 -3
- package/Libraries/Components/Touchable/TouchableWin32.Types.js.map +1 -0
- package/Libraries/Components/Touchable/TouchableWin32.d.ts +91 -91
- package/Libraries/Components/Touchable/TouchableWin32.js +507 -529
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +151 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +149 -107
- package/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +4 -19
- package/Libraries/Components/UnimplementedViews/UnimplementedView.js +3 -4
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +200 -69
- package/Libraries/Components/View/ReactNativeViewAttributes.js +7 -3
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +37 -13
- package/Libraries/Components/View/View.d.ts +29 -0
- package/Libraries/Components/View/View.js +105 -13
- package/Libraries/Components/View/View.win32.js +276 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +566 -0
- package/Libraries/Components/View/ViewAccessibility.js +88 -7
- package/Libraries/Components/View/ViewAccessibility.win32.js +180 -0
- package/Libraries/Components/View/ViewNativeComponent.js +98 -67
- package/Libraries/Components/View/ViewPropTypes.d.ts +354 -0
- package/Libraries/Components/View/ViewPropTypes.js +230 -66
- package/Libraries/Components/View/ViewPropTypes.win32.js +743 -0
- package/Libraries/Components/View/ViewWin32.d.ts +30 -12
- package/Libraries/Components/View/ViewWin32.js +129 -80
- package/Libraries/Core/Devtools/getDevServer.js +9 -8
- package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
- package/Libraries/Core/Devtools/openFileInEditor.js +6 -2
- package/Libraries/Core/Devtools/openURLInBrowser.js +3 -2
- package/Libraries/Core/Devtools/parseErrorStack.js +14 -23
- package/Libraries/Core/Devtools/parseHermesStack.js +71 -44
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +13 -58
- package/Libraries/Core/ExceptionsManager.js +93 -98
- package/Libraries/Core/ExtendedError.js +33 -0
- package/Libraries/Core/InitializeCore.js +7 -3
- package/Libraries/Core/NativeExceptionsManager.js +5 -100
- package/Libraries/Core/RawEventEmitter.js +39 -0
- package/Libraries/Core/ReactFiberErrorDialog.js +47 -38
- package/Libraries/Core/ReactNativeVersion.js +13 -7
- package/Libraries/Core/ReactNativeVersionCheck.js +11 -8
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +11 -8
- package/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +5 -21
- package/Libraries/Core/Timers/JSTimers.js +94 -120
- package/Libraries/Core/Timers/NativeTiming.js +5 -19
- package/Libraries/Core/Timers/immediateShim.js +68 -0
- package/Libraries/Core/Timers/queueMicrotask.js +41 -0
- package/Libraries/Core/__mocks__/ErrorUtils.js +1 -1
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
- package/Libraries/Core/checkNativeVersion.js +1 -1
- package/Libraries/Core/polyfillPromise.js +19 -3
- package/Libraries/Core/registerCallableModule.d.ts +16 -0
- package/Libraries/Core/registerCallableModule.js +42 -0
- package/Libraries/Core/setUpAlert.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +15 -11
- package/Libraries/Core/setUpDeveloperTools.js +59 -60
- package/Libraries/Core/setUpErrorHandling.js +9 -3
- package/Libraries/Core/setUpGlobals.js +8 -6
- package/Libraries/Core/setUpNavigator.js +8 -7
- package/Libraries/Core/setUpPerformance.js +31 -0
- package/Libraries/Core/setUpReactDevTools.js +121 -12
- package/Libraries/Core/setUpReactRefresh.js +4 -6
- package/Libraries/Core/setUpRegeneratorRuntime.js +28 -9
- package/Libraries/Core/setUpSegmentFetcher.js +9 -47
- package/Libraries/Core/setUpTimers.js +96 -8
- package/Libraries/Core/setUpXHR.js +5 -5
- package/Libraries/Debugging/DebuggingOverlay.js +111 -0
- package/Libraries/Debugging/DebuggingOverlayNativeComponent.js +13 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +513 -0
- package/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry.js +32 -0
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +63 -0
- package/Libraries/EventEmitter/NativeEventEmitter.js +92 -40
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +29 -0
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +27 -68
- package/Libraries/EventEmitter/RCTEventEmitter.js +6 -2
- package/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +32 -0
- package/Libraries/EventEmitter/RCTNativeAppEventEmitter.js +2 -4
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +34 -11
- package/Libraries/Events/CustomEvent.js +32 -0
- package/Libraries/Events/EventPolyfill.js +239 -0
- package/Libraries/HeapCapture/HeapCapture.js +3 -5
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +5 -12
- package/Libraries/Image/AssetRegistry.js +2 -27
- package/Libraries/Image/AssetSourceResolver.js +65 -39
- package/Libraries/Image/AssetUtils.js +47 -0
- package/Libraries/Image/Image.android.js +208 -271
- package/Libraries/Image/Image.d.ts +382 -0
- package/Libraries/Image/Image.ios.js +147 -104
- package/Libraries/Image/Image.win32.js +152 -93
- package/Libraries/Image/ImageAnalyticsTagContext.js +22 -0
- package/Libraries/Image/ImageBackground.js +29 -13
- package/Libraries/Image/ImageInjection.js +87 -0
- package/Libraries/Image/ImageProps.js +154 -29
- package/Libraries/Image/ImageResizeMode.d.ts +49 -0
- package/Libraries/Image/ImageResizeMode.js +1 -1
- package/Libraries/Image/ImageSource.d.ts +76 -0
- package/Libraries/Image/ImageSource.js +73 -21
- package/Libraries/Image/ImageSourceUtils.js +80 -0
- package/Libraries/Image/ImageTypes.d.ts +25 -25
- package/Libraries/Image/ImageTypes.flow.js +76 -0
- package/Libraries/Image/ImageTypes.js +8 -8
- package/Libraries/Image/ImageTypes.js.map +1 -0
- package/Libraries/Image/ImageUtils.js +22 -0
- package/Libraries/Image/ImageViewNativeComponent.js +145 -29
- package/Libraries/Image/NativeImageEditor.js +13 -0
- package/Libraries/Image/NativeImageLoaderAndroid.js +5 -32
- package/Libraries/Image/NativeImageLoaderIOS.js +5 -24
- package/Libraries/Image/NativeImageLoaderWin32.js +5 -32
- package/Libraries/Image/NativeImageStoreAndroid.js +13 -0
- package/Libraries/Image/NativeImageStoreIOS.js +13 -0
- package/Libraries/Image/RelativeImageStub.js +2 -2
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +8 -8
- package/Libraries/Image/Tests/ImageWin32Test.js +22 -19
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -0
- package/Libraries/Image/TextInlineImageNativeComponent.js +38 -7
- package/Libraries/Image/assetPaths.js +36 -0
- package/Libraries/Image/nativeImageSource.js +4 -6
- package/Libraries/Image/resolveAssetSource.js +65 -31
- package/Libraries/Image/resolveAssetSource.win32.js +18 -6
- package/Libraries/Inspector/BorderBox.js +2 -2
- package/Libraries/Inspector/BoxInspector.js +4 -5
- package/Libraries/Inspector/ElementBox.js +15 -10
- package/Libraries/Inspector/ElementProperties.js +35 -62
- package/Libraries/Inspector/Inspector.js +152 -259
- package/Libraries/Inspector/Inspector.win32.js +156 -263
- package/Libraries/Inspector/InspectorOverlay.js +28 -53
- package/Libraries/Inspector/InspectorOverlay.win32.js +31 -54
- package/Libraries/Inspector/InspectorPanel.js +31 -37
- package/Libraries/Inspector/NetworkOverlay.js +28 -18
- package/Libraries/Inspector/PerformanceOverlay.js +5 -5
- package/Libraries/Inspector/ReactDevToolsOverlay.js +165 -0
- package/Libraries/Inspector/StyleInspector.js +3 -3
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +81 -0
- package/Libraries/Inspector/resolveBoxStyle.js +1 -1
- package/Libraries/Interaction/FrameRateLogger.js +10 -22
- package/Libraries/Interaction/InteractionManager.d.ts +74 -0
- package/Libraries/Interaction/InteractionManager.js +29 -40
- package/Libraries/Interaction/JSEventLoopWatchdog.js +10 -15
- package/Libraries/Interaction/NativeFrameRateLogger.js +5 -16
- package/Libraries/Interaction/PanResponder.d.ts +202 -0
- package/Libraries/Interaction/PanResponder.js +26 -28
- package/Libraries/Interaction/TaskQueue.js +15 -16
- package/Libraries/Interaction/TouchHistoryMath.js +32 -29
- package/Libraries/JSInspector/InspectorAgent.js +4 -4
- package/Libraries/JSInspector/JSInspector.js +2 -5
- package/Libraries/JSInspector/NetworkAgent.js +12 -17
- package/Libraries/LayoutAnimation/LayoutAnimation.d.ts +84 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +86 -37
- package/Libraries/Linking/Linking.d.ts +61 -0
- package/Libraries/Linking/Linking.js +50 -41
- package/Libraries/Linking/NativeIntentAndroid.js +13 -0
- package/Libraries/Linking/NativeLinkingManager.js +13 -0
- package/Libraries/Lists/FillRateHelper.js +6 -232
- package/Libraries/Lists/FlatList.d.ts +244 -0
- package/Libraries/Lists/FlatList.js +194 -127
- package/Libraries/Lists/SectionList.d.ts +267 -0
- package/Libraries/Lists/SectionList.js +38 -33
- package/Libraries/Lists/SectionListModern.js +249 -0
- package/Libraries/Lists/ViewabilityHelper.js +10 -327
- package/Libraries/Lists/VirtualizeUtils.js +6 -235
- package/Libraries/Lists/VirtualizedList.js +10 -2224
- package/Libraries/Lists/VirtualizedListContext.js +18 -0
- package/Libraries/Lists/VirtualizedSectionList.js +9 -565
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +4 -3
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +9 -9
- package/Libraries/LogBox/Data/LogBoxData.js +104 -73
- package/Libraries/LogBox/Data/LogBoxLog.js +125 -12
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +10 -9
- package/Libraries/LogBox/Data/parseLogBoxLog.js +289 -76
- package/Libraries/LogBox/LogBox.d.ts +28 -0
- package/Libraries/LogBox/LogBox.js +163 -91
- package/Libraries/LogBox/LogBoxInspectorContainer.js +6 -6
- package/Libraries/LogBox/LogBoxNotificationContainer.js +10 -7
- package/Libraries/LogBox/UI/AnsiHighlight.js +17 -8
- package/Libraries/LogBox/UI/LogBoxButton.js +6 -7
- package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
- package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
- package/Libraries/LogBox/UI/LogBoxInspector.js +13 -77
- package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +12 -10
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +9 -53
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +19 -79
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +113 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +6 -7
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +16 -14
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +196 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSection.js +3 -5
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +6 -10
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +8 -10
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +118 -0
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +19 -11
- package/Libraries/LogBox/UI/LogBoxMessage.js +100 -19
- package/Libraries/LogBox/UI/LogBoxNotification.js +20 -158
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
- package/Libraries/LogBox/UI/LogBoxStyle.js +1 -3
- package/Libraries/LogBox/UI/LogBoxStyle.win32.js +65 -0
- package/Libraries/Modal/Modal.d.ts +111 -0
- package/Libraries/Modal/Modal.js +147 -72
- package/Libraries/Modal/ModalInjection.js +15 -0
- package/Libraries/Modal/NativeModalManager.js +5 -14
- package/Libraries/Modal/RCTModalHostViewNativeComponent.js +4 -117
- package/Libraries/NativeComponent/BaseViewConfig.android.js +358 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +423 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +415 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +164 -0
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +30 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +25 -0
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +144 -0
- package/Libraries/NativeComponent/ViewConfig.js +52 -0
- package/Libraries/NativeComponent/ViewConfigIgnore.js +51 -0
- package/Libraries/NativeModules/specs/NativeDevMenu.js +5 -16
- package/Libraries/NativeModules/specs/NativeDevSettings.js +5 -26
- package/Libraries/NativeModules/specs/NativeDeviceEventManager.js +5 -12
- package/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js +5 -41
- package/Libraries/NativeModules/specs/NativeLogBox.js +5 -13
- package/Libraries/NativeModules/specs/NativeRedBox.js +5 -13
- package/Libraries/NativeModules/specs/NativeSourceCode.js +5 -14
- package/Libraries/Network/FormData.js +13 -5
- package/Libraries/Network/NativeNetworkingAndroid.js +5 -30
- package/Libraries/Network/NativeNetworkingIOS.js +5 -30
- package/Libraries/Network/RCTNetworking.android.js +16 -12
- package/Libraries/Network/RCTNetworking.ios.js +67 -18
- package/Libraries/Network/RCTNetworking.win32.js +84 -68
- package/Libraries/Network/XHRInterceptor.js +66 -18
- package/Libraries/Network/XMLHttpRequest.js +107 -31
- package/Libraries/Network/convertRequestBody.js +4 -4
- package/Libraries/Network/fetch.js +2 -1
- package/Libraries/NewAppScreen/components/Colors.js +2 -3
- package/Libraries/NewAppScreen/components/DebugInstructions.js +9 -6
- package/Libraries/NewAppScreen/components/Header.js +38 -16
- package/Libraries/NewAppScreen/components/HermesBadge.js +53 -0
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +52 -27
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +5 -2
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +12 -6
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +5 -12
- package/Libraries/Performance/SamplingProfiler.js +5 -5
- package/Libraries/Performance/Systrace.d.ts +66 -0
- package/Libraries/Performance/Systrace.js +116 -171
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +5 -52
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +116 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +60 -23
- package/Libraries/PersonaCoin/PersonaCoin.d.ts +3 -3
- package/Libraries/PersonaCoin/PersonaCoin.js +15 -22
- package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -0
- package/Libraries/PersonaCoin/PersonaCoinPropTypes.d.ts +2 -2
- package/Libraries/PersonaCoin/PersonaCoinPropTypes.js +20 -20
- package/Libraries/PersonaCoin/PersonaCoinPropTypes.js.map +1 -0
- package/Libraries/PersonaCoin/PersonaCoinTypes.d.ts +33 -33
- package/Libraries/PersonaCoin/PersonaCoinTypes.js +24 -24
- package/Libraries/PersonaCoin/PersonaCoinTypes.js.map +1 -0
- package/Libraries/Pressability/HoverState.js +4 -4
- package/Libraries/Pressability/HoverState.win32.js +62 -0
- package/Libraries/Pressability/Pressability.js +244 -150
- package/Libraries/Pressability/Pressability.win32.js +1093 -0
- package/Libraries/Pressability/PressabilityDebug.js +31 -27
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +49 -0
- package/Libraries/Pressability/PressabilityTypes.js +18 -0
- package/Libraries/Pressability/usePressability.js +25 -11
- package/Libraries/Promise.js +5 -35
- package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +5 -66
- package/Libraries/PushNotificationIOS/PushNotificationIOS.d.ts +295 -0
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +134 -83
- package/Libraries/QuirkSettings/CachingNativeQuirkSettings.js +30 -0
- package/Libraries/QuirkSettings/NativeQuirkSettings.js +17 -0
- package/Libraries/QuirkSettings/QuirkSettings.js +34 -0
- package/Libraries/QuirkSettings/Quirks.js +17 -0
- package/Libraries/ReactNative/AppContainer-dev.js +208 -0
- package/Libraries/ReactNative/AppContainer-prod.js +50 -0
- package/Libraries/ReactNative/AppContainer.js +13 -138
- package/Libraries/ReactNative/AppRegistry.d.ts +121 -0
- package/Libraries/ReactNative/AppRegistry.js +133 -78
- package/Libraries/ReactNative/BridgelessUIManager.js +419 -0
- package/Libraries/ReactNative/DisplayMode.js +32 -0
- package/Libraries/ReactNative/FabricUIManager.js +116 -27
- package/Libraries/ReactNative/HeadlessJsTaskError.js +1 -3
- package/Libraries/ReactNative/I18nManager.d.ts +25 -0
- package/Libraries/ReactNative/I18nManager.js +17 -12
- package/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js +5 -13
- package/Libraries/ReactNative/NativeI18nManager.js +5 -18
- package/Libraries/ReactNative/NativeUIManager.js +5 -114
- package/Libraries/ReactNative/PaperUIManager.js +79 -52
- package/Libraries/ReactNative/PaperUIManager.win32.js +210 -0
- package/Libraries/ReactNative/ReactFabricInternals.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +150 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +100 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +38 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +33 -0
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +31 -0
- package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
- package/Libraries/ReactNative/RendererImplementation.js +164 -0
- package/Libraries/ReactNative/RendererProxy.d.ts +20 -0
- package/Libraries/ReactNative/RendererProxy.js +26 -0
- package/Libraries/ReactNative/RootTag.d.ts +13 -0
- package/Libraries/ReactNative/RootTag.js +27 -0
- package/Libraries/ReactNative/UIManager.d.ts +113 -0
- package/Libraries/ReactNative/UIManager.js +178 -24
- package/Libraries/ReactNative/UIManagerProperties.js +3 -8
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +334 -0
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +35 -0
- package/Libraries/ReactNative/getNativeComponentAttributes.js +51 -25
- package/Libraries/ReactNative/renderApplication.js +71 -23
- package/Libraries/ReactNative/requireNativeComponent.d.ts +23 -0
- package/Libraries/ReactNative/requireNativeComponent.js +4 -4
- package/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +66 -11
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +16225 -19958
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +8087 -5327
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +8773 -5583
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16543 -20582
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +8148 -5386
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +8836 -5645
- package/Libraries/Renderer/shims/ReactFabric.js +9 -8
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +4 -2
- package/Libraries/Renderer/shims/ReactNative.js +4 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +237 -81
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +27 -37
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +7 -6
- package/Libraries/Settings/NativeSettingsManager.js +5 -18
- package/Libraries/Settings/Settings.d.ts +18 -0
- package/Libraries/Settings/Settings.ios.js +7 -7
- package/Libraries/Settings/Settings.js +33 -0
- package/Libraries/Share/NativeShareModule.js +5 -16
- package/Libraries/Share/Share.d.ts +80 -0
- package/Libraries/Share/Share.js +33 -25
- package/Libraries/StyleSheet/EdgeInsetsPropType.js +5 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +10 -11
- package/Libraries/StyleSheet/PlatformColorValueTypes.d.ts +18 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +52 -16
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +15 -5
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts +25 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +11 -5
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +4 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +2 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesWin32.js +2 -2
- package/Libraries/StyleSheet/PointPropType.js +1 -1
- package/Libraries/StyleSheet/Rect.js +1 -3
- package/Libraries/StyleSheet/StyleSheet.d.ts +150 -0
- package/Libraries/StyleSheet/StyleSheet.js +42 -56
- package/Libraries/StyleSheet/StyleSheet.win32.js +43 -57
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +567 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +457 -130
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +11 -35
- package/Libraries/StyleSheet/flattenStyle.js +14 -9
- package/Libraries/StyleSheet/normalizeColor.js +11 -370
- package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +15 -0
- package/Libraries/StyleSheet/private/_TransformStyle.js +69 -0
- package/Libraries/StyleSheet/processAspectRatio.js +63 -0
- package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
- package/Libraries/StyleSheet/processBoxShadow.js +209 -0
- package/Libraries/StyleSheet/processColor.d.ts +16 -0
- package/Libraries/StyleSheet/processColor.js +6 -8
- package/Libraries/StyleSheet/processColorArray.js +18 -7
- package/Libraries/StyleSheet/processFilter.js +321 -0
- package/Libraries/StyleSheet/processFontVariant.js +30 -0
- package/Libraries/StyleSheet/processTransform.js +125 -111
- package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
- package/Libraries/StyleSheet/setNormalizedColorAlpha.js +1 -1
- package/Libraries/StyleSheet/splitLayoutProps.js +57 -49
- package/Libraries/Text/Text.d.ts +304 -0
- package/Libraries/Text/Text.js +508 -270
- package/Libraries/Text/Text.win32.js +580 -0
- package/Libraries/Text/TextAncestor.js +7 -2
- package/Libraries/Text/TextNativeComponent.js +82 -0
- package/Libraries/Text/TextNativeComponent.win32.js +117 -0
- package/Libraries/Text/TextProps.js +107 -29
- package/Libraries/Text/TextProps.win32.js +281 -0
- package/Libraries/TurboModule/RCTExport.d.ts +12 -0
- package/Libraries/TurboModule/RCTExport.js +3 -1
- package/Libraries/TurboModule/TurboModuleRegistry.d.ts +13 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +24 -16
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +5 -28
- package/Libraries/Types/CodegenTypes.js +9 -2
- package/Libraries/Types/CoreEventTypes.d.ts +259 -0
- package/Libraries/Types/CoreEventTypes.js +145 -10
- package/Libraries/Types/CoreEventTypes.win32.js +340 -0
- package/Libraries/Types/ReactDevToolsTypes.js +58 -0
- package/Libraries/Types/RootTagTypes.js +11 -0
- package/Libraries/Types/UIManagerJSInterface.js +16 -0
- package/Libraries/UTFSequence.js +6 -4
- package/Libraries/Utilities/Appearance.d.ts +53 -0
- package/Libraries/Utilities/Appearance.js +116 -63
- package/Libraries/Utilities/BackHandler.android.js +14 -23
- package/Libraries/Utilities/BackHandler.d.ts +38 -0
- package/Libraries/Utilities/BackHandler.ios.js +14 -96
- package/Libraries/Utilities/BackHandler.win32.js +107 -7
- package/Libraries/Utilities/DebugEnvironment.js +16 -0
- package/Libraries/Utilities/DevLoadingView.js +64 -0
- package/Libraries/Utilities/DevSettings.d.ts +32 -0
- package/Libraries/Utilities/DevSettings.js +55 -48
- package/Libraries/Utilities/DeviceInfo.js +1 -3
- package/Libraries/Utilities/DeviceInfo.win32.js +0 -2
- package/Libraries/Utilities/Dimensions.d.ts +79 -0
- package/Libraries/Utilities/Dimensions.js +30 -49
- package/Libraries/Utilities/Dimensions.win32.js +106 -18
- package/Libraries/Utilities/FeatureDetection.js +31 -0
- package/Libraries/Utilities/FocusManager.win32.d.ts +12 -0
- package/Libraries/Utilities/FocusManager.win32.js +42 -0
- package/Libraries/Utilities/GlobalPerformanceLogger.js +4 -5
- package/Libraries/Utilities/HMRClient.js +102 -39
- package/Libraries/Utilities/HMRClientProdShim.js +2 -1
- package/Libraries/Utilities/IPerformanceLogger.d.ts +48 -0
- package/Libraries/Utilities/IPerformanceLogger.js +49 -0
- package/Libraries/Utilities/NativeAppearance.js +5 -28
- package/Libraries/Utilities/NativeDevLoadingView.js +5 -17
- package/Libraries/Utilities/NativeDeviceInfo.js +4 -40
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +5 -30
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +5 -26
- package/Libraries/Utilities/NativePlatformConstantsWin.js +4 -21
- package/Libraries/Utilities/PerformanceLoggerContext.js +17 -10
- package/Libraries/Utilities/PixelRatio.d.ts +64 -0
- package/Libraries/Utilities/PixelRatio.js +6 -6
- package/Libraries/Utilities/Platform.android.js +37 -16
- package/Libraries/Utilities/Platform.d.ts +106 -0
- package/Libraries/Utilities/Platform.flow.js +91 -0
- package/Libraries/Utilities/Platform.flow.win32.js +124 -0
- package/Libraries/Utilities/Platform.ios.js +39 -19
- package/Libraries/Utilities/Platform.win32.js +42 -15
- package/Libraries/Utilities/PolyfillFunctions.js +6 -6
- package/Libraries/Utilities/RCTLog.js +6 -5
- package/Libraries/Utilities/ReactNativeTestTools.js +36 -58
- package/Libraries/Utilities/SceneTracker.js +6 -5
- package/Libraries/Utilities/__mocks__/BackHandler.js +6 -6
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +1 -1
- package/Libraries/Utilities/__mocks__/PixelRatio.js +2 -2
- package/Libraries/Utilities/binaryToBase64.js +6 -4
- package/Libraries/Utilities/codegenNativeCommands.js +6 -6
- package/Libraries/Utilities/codegenNativeComponent.js +24 -14
- package/Libraries/Utilities/createPerformanceLogger.js +259 -244
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +12 -6
- package/Libraries/Utilities/defineLazyObjectProperty.js +3 -3
- package/Libraries/Utilities/differ/deepDiffer.js +3 -3
- package/Libraries/Utilities/differ/insetsDiffer.js +2 -2
- package/Libraries/Utilities/differ/matricesDiffer.js +6 -2
- package/Libraries/Utilities/differ/pointsDiffer.js +2 -2
- package/Libraries/Utilities/differ/sizesDiffer.js +11 -5
- package/Libraries/Utilities/dismissKeyboard.js +1 -1
- package/Libraries/Utilities/infoLog.js +3 -2
- package/Libraries/Utilities/logError.js +2 -2
- package/Libraries/Utilities/mapWithSeparator.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +8 -8
- package/Libraries/Utilities/stringifyViewConfig.js +22 -0
- package/Libraries/Utilities/useColorScheme.js +10 -16
- package/Libraries/Utilities/useMergeRefs.js +40 -0
- package/Libraries/Utilities/useRefEffect.js +45 -0
- package/Libraries/Utilities/useWindowDimensions.js +15 -8
- package/Libraries/Utilities/warnOnce.js +3 -5
- package/Libraries/Vibration/NativeVibration.js +5 -17
- package/Libraries/Vibration/Vibration.d.ts +43 -0
- package/Libraries/Vibration/Vibration.js +16 -14
- package/Libraries/WebSocket/NativeWebSocketModule.js +5 -27
- package/Libraries/WebSocket/WebSocket.js +47 -27
- package/Libraries/WebSocket/WebSocketEvent.js +5 -2
- package/Libraries/WebSocket/WebSocketInterceptor.js +46 -27
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +1 -1
- package/Libraries/YellowBox/YellowBoxDeprecated.d.ts +19 -0
- package/Libraries/YellowBox/YellowBoxDeprecated.js +6 -6
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -6
- package/Libraries/__tests__/ButtonWin32-test.js +17 -0
- package/Libraries/platform-types.d.ts +25 -0
- package/Libraries/promiseRejectionTrackingOptions.js +72 -0
- package/Libraries/vendor/core/ErrorUtils.d.ts +15 -0
- package/Libraries/vendor/core/ErrorUtils.js +2 -2
- package/Libraries/vendor/emitter/EventEmitter.d.ts +164 -0
- package/Libraries/vendor/emitter/EventEmitter.js +123 -193
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +81 -0
- package/babel.config.js +3 -0
- package/flow/HermesInternalType.js +114 -0
- package/flow/Position.js +1 -1
- package/flow/Stringish.js +1 -1
- package/flow/console.js +1 -1
- package/flow/global.js +87 -0
- package/flow/jest.js +266 -168
- package/flow/react.js +15 -0
- package/index.js +359 -254
- package/index.win32.js +768 -42
- package/interface.js +9 -9
- package/jest/MockNativeMethods.js +1 -1
- package/jest/__tests__/setup-test.js +18 -0
- package/jest/assetFileTransformer.js +7 -5
- package/jest/local-setup.js +28 -0
- package/jest/mockComponent.js +28 -16
- package/jest/mockModal.js +32 -0
- package/jest/mockNativeComponent.js +40 -0
- package/jest/mockScrollView.js +35 -0
- package/jest/react-native-env.js +16 -0
- package/jest/renderer.js +29 -22
- package/jest/setup.js +188 -88
- package/jest-snapshot-resolver.js +2 -0
- package/jest.config.js +38 -0
- package/just-task.js +11 -53
- package/metro.config.js +5 -20
- package/metroShortPathAssetDataPlugin.js +15 -0
- package/overrides.json +535 -0
- package/package.json +90 -48
- package/react-native.config.js +2 -0
- package/rn-get-polyfills.js +3 -6
- package/saveAssetPlugin.js +45 -0
- package/src/private/animated/NativeAnimatedHelper.js +440 -0
- package/src/private/animated/NativeAnimatedHelper.win32.js +443 -0
- package/src/private/animated/NativeAnimatedValidation.js +64 -0
- package/src/private/animated/useAnimatedPropsMemo.js +349 -0
- package/src/private/components/HScrollViewNativeComponents.js +55 -0
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +31 -0
- package/src/private/components/VScrollViewNativeComponents.js +48 -0
- package/src/private/components/useSyncOnScroll.js +48 -0
- package/src/private/debugging/FuseboxSessionObserver.js +42 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
- package/src/private/debugging/setUpFuseboxReactDevToolsDispatcher.js +114 -0
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +390 -0
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +109 -0
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +81 -0
- package/src/private/renderer/errorhandling/ErrorHandlers.js +126 -0
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/components/ActivityIndicatorViewNativeComponent.js +53 -0
- package/src/private/specs/components/AndroidDrawerLayoutNativeComponent.js +124 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +27 -0
- package/src/private/specs/components/AndroidSwipeRefreshLayoutNativeComponent.js +74 -0
- package/src/private/specs/components/AndroidSwitchNativeComponent.js +62 -0
- package/src/private/specs/components/DebuggingOverlayNativeComponent.js +61 -0
- package/src/private/specs/components/ProgressBarAndroidNativeComponent.js +36 -0
- package/src/private/specs/components/PullToRefreshViewNativeComponent.js +71 -0
- package/src/private/specs/components/RCTInputAccessoryViewNativeComponent.js +26 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +139 -0
- package/src/private/specs/components/RCTSafeAreaViewNativeComponent.js +25 -0
- package/src/private/specs/components/SwitchNativeComponent.js +61 -0
- package/src/private/specs/components/UnimplementedNativeViewNativeComponent.js +26 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +36 -0
- package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +42 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +70 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +54 -0
- package/src/private/specs/modules/NativeAlertManager.js +35 -0
- package/src/private/specs/modules/NativeAnimatedModule.js +77 -0
- package/src/private/specs/modules/NativeAnimatedTurboModule.js +78 -0
- package/src/private/specs/modules/NativeAppState.js +33 -0
- package/src/private/specs/modules/NativeAppearance.js +36 -0
- package/src/private/specs/modules/NativeBlobModule.js +61 -0
- package/src/private/specs/modules/NativeBugReporting.js +20 -0
- package/src/private/specs/modules/NativeClipboard.js +21 -0
- package/src/private/specs/modules/NativeDevLoadingView.js +24 -0
- package/src/private/specs/modules/NativeDevMenu.js +23 -0
- package/src/private/specs/modules/NativeDevSettings.js +34 -0
- package/src/private/specs/modules/NativeDeviceEventManager.js +19 -0
- package/src/private/specs/modules/NativeDeviceInfo.js +58 -0
- package/src/private/specs/modules/NativeDialogManagerAndroid.js +48 -0
- package/src/private/specs/modules/NativeExceptionsManager.js +103 -0
- package/src/private/specs/modules/NativeFileReaderModule.js +22 -0
- package/src/private/specs/modules/NativeFrameRateLogger.js +22 -0
- package/src/private/specs/modules/NativeHeadlessJsTaskSupport.js +20 -0
- package/src/private/specs/modules/NativeI18nManager.js +28 -0
- package/src/private/specs/modules/NativeImageEditor.js +52 -0
- package/src/private/specs/modules/NativeImageLoaderAndroid.js +30 -0
- package/src/private/specs/modules/NativeImageLoaderIOS.js +37 -0
- package/src/private/specs/modules/NativeImageLoaderWin32.js +45 -0
- package/src/private/specs/modules/NativeImageStoreAndroid.js +26 -0
- package/src/private/specs/modules/NativeImageStoreIOS.js +33 -0
- package/src/private/specs/modules/NativeIntentAndroid.js +30 -0
- package/src/private/specs/modules/NativeJSCHeapCapture.js +19 -0
- package/src/private/specs/modules/NativeJSCSamplingProfiler.js +19 -0
- package/src/private/specs/modules/NativeKeyboardObserver.js +20 -0
- package/src/private/specs/modules/NativeLinkingManager.js +27 -0
- package/src/private/specs/modules/NativeLogBox.js +20 -0
- package/src/private/specs/modules/NativeModalManager.js +21 -0
- package/src/private/specs/modules/NativeNetworkingAndroid.js +37 -0
- package/src/private/specs/modules/NativeNetworkingIOS.js +37 -0
- package/src/private/specs/modules/NativePermissionsAndroid.js +77 -0
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +44 -0
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +37 -0
- package/src/private/specs/modules/NativePlatformConstantsWin.js +44 -0
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +103 -0
- package/src/private/specs/modules/NativeReactDevToolsSettingsManager.js +22 -0
- package/src/private/specs/modules/NativeRedBox.js +20 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +66 -0
- package/src/private/specs/modules/NativeSegmentFetcher.js +28 -0
- package/src/private/specs/modules/NativeSettingsManager.js +25 -0
- package/src/private/specs/modules/NativeShareModule.js +23 -0
- package/src/private/specs/modules/NativeSoundManager.js +22 -0
- package/src/private/specs/modules/NativeSourceCode.js +36 -0
- package/src/private/specs/modules/NativeStatusBarManagerAndroid.js +68 -0
- package/src/private/specs/modules/NativeStatusBarManagerIOS.js +89 -0
- package/src/private/specs/modules/NativeTiming.js +26 -0
- package/src/private/specs/modules/NativeToastAndroid.js +38 -0
- package/src/private/specs/modules/NativeUIManager.js +111 -0
- package/src/private/specs/modules/NativeVibration.js +24 -0
- package/src/private/specs/modules/NativeWebSocketModule.js +34 -0
- package/src/private/styles/composeStyles.js +27 -0
- package/src/private/webapis/dom/geometry/DOMRect.js +82 -0
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +188 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +188 -0
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +71 -0
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +247 -0
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +359 -0
- package/src/private/webapis/dom/nodes/ReadOnlyText.js +30 -0
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
- package/src/private/webapis/dom/nodes/utilities/Traversal.js +54 -0
- package/src/private/webapis/dom/oldstylecollections/ArrayLikeUtils.js +46 -0
- package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +76 -0
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +82 -0
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +104 -0
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +254 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +141 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +276 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +41 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +172 -0
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
- package/src/private/webapis/mutationobserver/MutationObserver.js +186 -0
- package/src/private/webapis/mutationobserver/MutationObserverManager.js +227 -0
- package/src/private/webapis/mutationobserver/MutationRecord.js +82 -0
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +58 -0
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +327 -0
- package/src/private/webapis/performance/EventTiming.js +145 -0
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/MemoryInfo.js +54 -0
- package/src/private/webapis/performance/Performance.js +278 -0
- package/src/private/webapis/performance/PerformanceEntry.js +68 -0
- package/src/private/webapis/performance/PerformanceObserver.js +232 -0
- package/src/private/webapis/performance/RawPerformanceEntry.js +105 -0
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +91 -0
- package/src/private/webapis/performance/UserTiming.js +72 -0
- package/src/private/webapis/performance/Utilities.js +18 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +87 -0
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +247 -0
- package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +177 -0
- package/src-win/Libraries/Components/Button/ButtonWin32.Props.ts +45 -0
- package/src-win/Libraries/Components/Button/ButtonWin32.tsx +94 -0
- package/src-win/Libraries/Components/EnterString.win32.tsx +110 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +185 -0
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +502 -0
- package/src-win/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +119 -0
- package/src-win/Libraries/Components/Touchable/TouchableWin32.Props.tsx +46 -0
- package/src-win/Libraries/Components/Touchable/TouchableWin32.Types.tsx +137 -0
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +624 -0
- package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +566 -0
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +354 -0
- package/src-win/Libraries/Components/View/ViewWin32.d.ts +30 -0
- package/src-win/Libraries/Image/ImageTypes.ts +27 -0
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +22 -0
- package/src-win/Libraries/Image/Tests/img/dpitest.png +0 -0
- package/src-win/Libraries/Image/Tests/img/dpitest@1.5x.png +0 -0
- package/src-win/Libraries/Image/Tests/img/dpitest@2x.png +0 -0
- package/src-win/Libraries/Image/Tests/img/dpitest@3x.png +0 -0
- package/src-win/Libraries/Image/Tests/img/en-us/dpitest.png +0 -0
- package/src-win/Libraries/Image/Tests/img/en-us/dpitest@1.5x.png +0 -0
- package/src-win/Libraries/Image/Tests/img/en-us/dpitest@3x.png +0 -0
- package/src-win/Libraries/PersonaCoin/PersonaCoin.tsx +12 -0
- package/src-win/Libraries/PersonaCoin/PersonaCoinPropTypes.ts +17 -0
- package/src-win/Libraries/PersonaCoin/PersonaCoinTypes.ts +36 -0
- package/src-win/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +38 -0
- package/src-win/Libraries/Text/Text.d.ts +304 -0
- package/src-win/Libraries/Utilities/FocusManager.win32.d.ts +12 -0
- package/src-win/Libraries/__tests__/__snapshots__/ButtonWin32-test.js.snap +22 -0
- package/src-win/Libraries/platform-types.d.ts +25 -0
- package/types/experimental.d.ts +59 -0
- package/types/index.d.ts +218 -0
- package/types/modules/BatchedBridge.d.ts +32 -0
- package/types/modules/Codegen.d.ts +80 -0
- package/types/modules/Devtools.d.ts +32 -0
- package/types/modules/LaunchScreen.d.ts +18 -0
- package/types/modules/globals.d.ts +599 -0
- package/types/private/TimerMixin.d.ts +19 -0
- package/types/private/Utilities.d.ts +10 -0
- package/types/public/DeprecatedPropertiesAlias.d.ts +185 -0
- package/types/public/Insets.d.ts +15 -0
- package/types/public/ReactNativeRenderer.d.ts +144 -0
- package/types/public/ReactNativeTypes.d.ts +139 -0
- package/IntegrationTests/AsyncStorageTest.js +0 -217
- package/IntegrationTests/PropertiesUpdateTest.js +0 -29
- package/IntegrationTests/RCTRootViewIntegrationTestApp.js +0 -92
- package/IntegrationTests/ReactContentSizeUpdateTest.js +0 -91
- package/IntegrationTests/SizeFlexibilityUpdateTest.js +0 -108
- package/IntegrationTests/launchWebSocketServer.command +0 -18
- package/Libraries/Animated/examples/demo.html +0 -712
- package/Libraries/Animated/examples/pic1.jpg +0 -0
- package/Libraries/Animated/examples/pic2.jpg +0 -0
- package/Libraries/Animated/examples/pic3.jpg +0 -0
- package/Libraries/Animated/release/gulpfile.js +0 -155
- package/Libraries/Animated/src/Animated.js +0 -49
- package/Libraries/Animated/src/AnimatedEvent.js +0 -233
- package/Libraries/Animated/src/AnimatedImplementation.js +0 -712
- package/Libraries/Animated/src/AnimatedMock.js +0 -156
- package/Libraries/Animated/src/AnimatedWeb.js +0 -23
- package/Libraries/Animated/src/Easing.js +0 -252
- package/Libraries/Animated/src/NativeAnimatedHelper.js +0 -342
- package/Libraries/Animated/src/NativeAnimatedModule.js +0 -66
- package/Libraries/Animated/src/SpringConfig.js +0 -103
- package/Libraries/Animated/src/animations/Animation.js +0 -73
- package/Libraries/Animated/src/animations/DecayAnimation.js +0 -120
- package/Libraries/Animated/src/animations/SpringAnimation.js +0 -359
- package/Libraries/Animated/src/animations/TimingAnimation.js +0 -165
- package/Libraries/Animated/src/bezier.js +0 -153
- package/Libraries/Animated/src/components/AnimatedFlatList.js +0 -32
- package/Libraries/Animated/src/components/AnimatedImage.js +0 -25
- package/Libraries/Animated/src/components/AnimatedScrollView.js +0 -32
- package/Libraries/Animated/src/components/AnimatedSectionList.js +0 -32
- package/Libraries/Animated/src/components/AnimatedText.js +0 -25
- package/Libraries/Animated/src/components/AnimatedView.js +0 -23
- package/Libraries/Animated/src/createAnimatedComponent.js +0 -223
- package/Libraries/Animated/src/nodes/AnimatedAddition.js +0 -63
- package/Libraries/Animated/src/nodes/AnimatedDiffClamp.js +0 -71
- package/Libraries/Animated/src/nodes/AnimatedDivision.js +0 -68
- package/Libraries/Animated/src/nodes/AnimatedInterpolation.js +0 -373
- package/Libraries/Animated/src/nodes/AnimatedModulo.js +0 -62
- package/Libraries/Animated/src/nodes/AnimatedMultiplication.js +0 -63
- package/Libraries/Animated/src/nodes/AnimatedNode.js +0 -184
- package/Libraries/Animated/src/nodes/AnimatedProps.js +0 -176
- package/Libraries/Animated/src/nodes/AnimatedStyle.js +0 -127
- package/Libraries/Animated/src/nodes/AnimatedSubtraction.js +0 -63
- package/Libraries/Animated/src/nodes/AnimatedTracking.js +0 -102
- package/Libraries/Animated/src/nodes/AnimatedTransform.js +0 -121
- package/Libraries/Animated/src/nodes/AnimatedValue.js +0 -265
- package/Libraries/Animated/src/nodes/AnimatedValueXY.js +0 -226
- package/Libraries/Animated/src/nodes/AnimatedWithChildren.js +0 -87
- package/Libraries/Animated/src/polyfills/InteractionManager.js +0 -15
- package/Libraries/Animated/src/polyfills/Set.js +0 -26
- package/Libraries/Animated/src/polyfills/flattenStyle.js +0 -13
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js +0 -162
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js +0 -271
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.win32.js +0 -33
- package/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js +0 -23
- package/Libraries/Components/AppleTV/TVEventHandler.js +0 -52
- package/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js +0 -74
- package/Libraries/Components/CheckBox/CheckBox.android.js +0 -228
- package/Libraries/Components/CheckBox/CheckBox.ios.js +0 -13
- package/Libraries/Components/CheckBox/CheckBox.win32.js +0 -12
- package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -46
- package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -189
- package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -46
- package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -89
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.win32.js +0 -30
- package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
- package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -22
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +0 -12
- package/Libraries/Components/MaskedView/MaskedViewIOS.android.js +0 -13
- package/Libraries/Components/MaskedView/MaskedViewIOS.ios.js +0 -93
- package/Libraries/Components/MaskedView/MaskedViewIOS.win32.js +0 -13
- package/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js +0 -21
- package/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js +0 -68
- package/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js +0 -68
- package/Libraries/Components/Picker/Picker.js +0 -159
- package/Libraries/Components/Picker/Picker.win32.d.ts +0 -1
- package/Libraries/Components/Picker/Picker.win32.js +0 -80
- package/Libraries/Components/Picker/PickerAndroid.android.js +0 -146
- package/Libraries/Components/Picker/PickerAndroid.ios.js +0 -12
- package/Libraries/Components/Picker/PickerAndroid.js +0 -12
- package/Libraries/Components/Picker/PickerIOS.android.js +0 -14
- package/Libraries/Components/Picker/PickerIOS.ios.js +0 -164
- package/Libraries/Components/Picker/PickerIOS.js +0 -14
- package/Libraries/Components/Picker/RCTPickerNativeComponent.js +0 -63
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js +0 -12
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -46
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -77
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -8
- package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -35
- package/Libraries/Components/ScrollResponder.js +0 -773
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +0 -77
- package/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js +0 -39
- package/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +0 -46
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +0 -46
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +0 -123
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.js +0 -46
- package/Libraries/Components/Slider/Slider.js +0 -276
- package/Libraries/Components/Slider/SliderNativeComponent.js +0 -60
- package/Libraries/Components/StaticContainer.react.js +0 -51
- package/Libraries/Components/StatusBar/StatusBarIOS.js +0 -22
- package/Libraries/Components/Text/TextWin32.Props.d.ts +0 -26
- package/Libraries/Components/Text/TextWin32.Props.js +0 -3
- package/Libraries/Components/Text/TextWin32.d.ts +0 -6
- package/Libraries/Components/Text/TextWin32.js +0 -41
- package/Libraries/Components/TextInput/AndroidTextInputViewConfig.js +0 -84
- package/Libraries/Components/TextInput/RCTSinglelineTextInputViewConfig.js +0 -134
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +0 -51
- package/Libraries/Components/TextInput/TextInput.Types.win32.js +0 -3
- package/Libraries/Components/TextInput/TextInput.win32.d.ts +0 -68
- package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +0 -39
- package/Libraries/Components/Touchable/TVTouchable.js +0 -55
- package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.d.ts +0 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.js +0 -3
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +0 -16
- package/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js +0 -12
- package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -26
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -347
- package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +0 -384
- package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -74
- package/Libraries/Components/View/Tests/ViewWin32Test.d.ts +0 -8
- package/Libraries/Components/View/Tests/ViewWin32Test.js +0 -235
- package/Libraries/Components/View/ViewWin32.Props.d.ts +0 -149
- package/Libraries/Components/View/ViewWin32.Props.js +0 -11
- package/Libraries/Core/setUpSystrace.js +0 -21
- package/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js +0 -76
- package/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +0 -28
- package/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js +0 -82
- package/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js +0 -40
- package/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js +0 -76
- package/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js +0 -233
- package/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +0 -24
- package/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +0 -30
- package/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js +0 -32
- package/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js +0 -23
- package/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +0 -622
- package/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js +0 -158
- package/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +0 -157
- package/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +0 -99
- package/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js +0 -44
- package/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +0 -408
- package/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js +0 -68
- package/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js +0 -86
- package/Libraries/Image/ImagePickerIOS.js +0 -105
- package/Libraries/Image/ImageViewViewConfig.js +0 -68
- package/Libraries/Image/NativeImagePickerIOS.js +0 -40
- package/Libraries/Image/assetPathUtils.js +0 -91
- package/Libraries/Interaction/Batchinator.js +0 -76
- package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -62
- package/Libraries/Interaction/InteractionMixin.js +0 -55
- package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
- package/Libraries/Linking/NativeLinking.js +0 -41
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -21
- package/Libraries/Performance/PureComponentDebug.js +0 -73
- package/Libraries/Performance/QuickPerformanceLogger.js +0 -101
- package/Libraries/ReactNative/DummyUIManager.js +0 -123
- package/Libraries/ReactNative/RootTagContext.js +0 -15
- package/Libraries/ReactNative/queryLayoutByID.js +0 -58
- package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +0 -20493
- package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +0 -7440
- package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +0 -7718
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +0 -21091
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +0 -7677
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +0 -7955
- package/Libraries/Renderer/shims/ReactTypes.js +0 -192
- package/Libraries/Settings/Settings.android.js +0 -33
- package/Libraries/Storage/AsyncStorage.js +0 -360
- package/Libraries/Storage/NativeAsyncStorage.js +0 -44
- package/Libraries/StyleSheet/PlatformColorValueTypesAndroid.android.js +0 -18
- package/Libraries/StyleSheet/PlatformColorValueTypesAndroid.js +0 -17
- package/Libraries/StyleSheet/StyleSheetValidation.js +0 -97
- package/Libraries/StyleSheet/StyleSheetValidation.win32.js +0 -102
- package/Libraries/Utilities/BackHandler.win32.d.ts +0 -2
- package/Libraries/Utilities/JSDevSupportModule.js +0 -40
- package/Libraries/Utilities/LoadingView.android.js +0 -29
- package/Libraries/Utilities/LoadingView.ios.js +0 -40
- package/Libraries/Utilities/LoadingView.js +0 -16
- package/Libraries/Utilities/MatrixMath.js +0 -752
- package/Libraries/Utilities/NativeJSDevSupport.js +0 -25
- package/Libraries/Utilities/buildStyleInterpolator.js +0 -211
- package/Libraries/Utilities/clamp.js +0 -23
- package/Libraries/Utilities/deprecatedPropType.js +0 -38
- package/Libraries/Utilities/groupByEveryN.js +0 -51
- package/Libraries/Utilities/mergeIntoFast.js +0 -26
- package/Libraries/Utilities/registerGeneratedViewConfig.js +0 -83
- package/Libraries/Utilities/setAndForwardRef.js +0 -71
- package/Libraries/Utilities/truncate.js +0 -51
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -134
- package/Libraries/polyfills/Object.es7.js +0 -58
- package/Libraries/polyfills/console.js +0 -641
- package/Libraries/polyfills/error-guard.js +0 -115
- package/Libraries/promiseRejectionIsError.js +0 -24
- package/Libraries/vendor/emitter/EmitterSubscription.js +0 -59
- package/Libraries/vendor/emitter/EventSubscription.js +0 -40
- package/Libraries/vendor/emitter/EventSubscriptionVendor.js +0 -101
- package/RNTester/APIExamples/AccessibilityExampleWin32.d.ts +0 -8
- package/RNTester/APIExamples/AccessibilityExampleWin32.js +0 -262
- package/RNTester/APIExamples/ThemingModuleAPI.d.ts +0 -8
- package/RNTester/APIExamples/ThemingModuleAPI.js +0 -80
- package/RNTester/js/RNTesterApp.android.js +0 -363
- package/RNTester/js/RNTesterApp.ios.js +0 -272
- package/RNTester/js/RNTesterApp.win32.js +0 -285
- package/RNTester/js/assets/bandaged.png +0 -0
- package/RNTester/js/assets/bunny.png +0 -0
- package/RNTester/js/assets/call.png +0 -0
- package/RNTester/js/assets/dislike.png +0 -0
- package/RNTester/js/assets/fist.png +0 -0
- package/RNTester/js/assets/flowers.png +0 -0
- package/RNTester/js/assets/flux@3x.png +0 -0
- package/RNTester/js/assets/hawk.png +0 -0
- package/RNTester/js/assets/heart.png +0 -0
- package/RNTester/js/assets/helloworld.html +0 -25
- package/RNTester/js/assets/imageMask.png +0 -0
- package/RNTester/js/assets/like.png +0 -0
- package/RNTester/js/assets/liking.png +0 -0
- package/RNTester/js/assets/messagingtest.html +0 -28
- package/RNTester/js/assets/party.png +0 -0
- package/RNTester/js/assets/poke.png +0 -0
- package/RNTester/js/assets/relay@3x.png +0 -0
- package/RNTester/js/assets/slider-left.png +0 -0
- package/RNTester/js/assets/slider-left@2x.png +0 -0
- package/RNTester/js/assets/slider-right.png +0 -0
- package/RNTester/js/assets/slider-right@2x.png +0 -0
- package/RNTester/js/assets/slider.png +0 -0
- package/RNTester/js/assets/slider@2x.png +0 -0
- package/RNTester/js/assets/superlike.png +0 -0
- package/RNTester/js/assets/trees.jpg +0 -0
- package/RNTester/js/assets/tumblr_mfqekpMktw1rn90umo1_500.gif +0 -0
- package/RNTester/js/assets/uie_comment_highlighted@2x.png +0 -0
- package/RNTester/js/assets/uie_comment_normal@2x.png +0 -0
- package/RNTester/js/assets/uie_thumb_big.png +0 -0
- package/RNTester/js/assets/uie_thumb_normal@2x.png +0 -0
- package/RNTester/js/assets/uie_thumb_selected@2x.png +0 -0
- package/RNTester/js/assets/victory.png +0 -0
- package/RNTester/js/components/ListExampleShared.js +0 -377
- package/RNTester/js/components/ListExampleShared.win32.js +0 -384
- package/RNTester/js/components/RNTesterBlock.js +0 -105
- package/RNTester/js/components/RNTesterButton.js +0 -50
- package/RNTester/js/components/RNTesterExampleContainer.js +0 -80
- package/RNTester/js/components/RNTesterExampleFilter.js +0 -120
- package/RNTester/js/components/RNTesterExampleFilter.win32.js +0 -120
- package/RNTester/js/components/RNTesterExampleList.js +0 -254
- package/RNTester/js/components/RNTesterPage.js +0 -76
- package/RNTester/js/components/RNTesterSettingSwitchRow.js +0 -60
- package/RNTester/js/components/RNTesterTheme.js +0 -90
- package/RNTester/js/components/RNTesterTitle.js +0 -58
- package/RNTester/js/components/TextInlineView.js +0 -207
- package/RNTester/js/components/TextLegend.js +0 -248
- package/RNTester/js/components/createExamplePage.js +0 -31
- package/RNTester/js/examples/Accessibility/AccessibilityAndroidExample.android.js +0 -177
- package/RNTester/js/examples/Accessibility/AccessibilityExample.js +0 -792
- package/RNTester/js/examples/Accessibility/AccessibilityIOSExample.js +0 -72
- package/RNTester/js/examples/Accessibility/check.png +0 -0
- package/RNTester/js/examples/Accessibility/mixed.png +0 -0
- package/RNTester/js/examples/Accessibility/uncheck.png +0 -0
- package/RNTester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js +0 -342
- package/RNTester/js/examples/ActivityIndicator/ActivityIndicatorExample.js +0 -162
- package/RNTester/js/examples/Alert/AlertExample.js +0 -158
- package/RNTester/js/examples/Alert/AlertIOSExample.js +0 -204
- package/RNTester/js/examples/Animated/AnimatedExample.js +0 -347
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExApp.js +0 -407
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExBobble.js +0 -171
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExChained.js +0 -120
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExScroll.js +0 -124
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExSet.js +0 -149
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExSlides.md +0 -107
- package/RNTester/js/examples/Animated/AnimatedGratuitousApp/AnExTilt.js +0 -154
- package/RNTester/js/examples/AppState/AppStateExample.js +0 -106
- package/RNTester/js/examples/Appearance/AppearanceExample.js +0 -219
- package/RNTester/js/examples/AsyncStorage/AsyncStorageExample.js +0 -103
- package/RNTester/js/examples/Border/BorderExample.js +0 -301
- package/RNTester/js/examples/BoxShadow/BoxShadowExample.js +0 -100
- package/RNTester/js/examples/Button/ButtonExample.js +0 -127
- package/RNTester/js/examples/CheckBox/CheckBoxExample.js +0 -148
- package/RNTester/js/examples/Clipboard/ClipboardExample.js +0 -68
- package/RNTester/js/examples/ColorGradientWin32Example.js +0 -109
- package/RNTester/js/examples/Crash/CrashExample.js +0 -52
- package/RNTester/js/examples/DatePicker/DatePickerAndroidExample.js +0 -170
- package/RNTester/js/examples/DatePicker/DatePickerIOSExample.js +0 -150
- package/RNTester/js/examples/DevSettings/DevSettingsExample.js +0 -47
- package/RNTester/js/examples/Dimensions/DimensionsExample.js +0 -68
- package/RNTester/js/examples/FlatList/FlatListExample.js +0 -287
- package/RNTester/js/examples/Image/ImageCapInsetsExample.js +0 -68
- package/RNTester/js/examples/Image/ImageExample.js +0 -955
- package/RNTester/js/examples/InputAccessoryView/InputAccessoryViewExample.js +0 -121
- package/RNTester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js +0 -77
- package/RNTester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js +0 -120
- package/RNTester/js/examples/Layout/LayoutAnimationExample.js +0 -221
- package/RNTester/js/examples/Layout/LayoutEventsExample.js +0 -165
- package/RNTester/js/examples/Layout/LayoutExample.js +0 -206
- package/RNTester/js/examples/Linking/LinkingExample.js +0 -128
- package/RNTester/js/examples/MaskedView/MaskedViewExample.js +0 -236
- package/RNTester/js/examples/Modal/ModalExample.js +0 -283
- package/RNTester/js/examples/MultiColumn/MultiColumnExample.js +0 -189
- package/RNTester/js/examples/NativeAnimation/NativeAnimationsExample.js +0 -702
- package/RNTester/js/examples/NewAppScreen/NewAppScreenExample.js +0 -77
- package/RNTester/js/examples/OrientationChange/OrientationChangeExample.js +0 -66
- package/RNTester/js/examples/PanResponder/PanResponderExample.js +0 -154
- package/RNTester/js/examples/PermissionsAndroid/PermissionsExample.js +0 -130
- package/RNTester/js/examples/Picker/PickerExample.js +0 -220
- package/RNTester/js/examples/Picker/PickerIOSExample.js +0 -190
- package/RNTester/js/examples/PlatformColor/PlatformColorExample.js +0 -355
- package/RNTester/js/examples/PointerEvents/PointerEventsExample.js +0 -240
- package/RNTester/js/examples/Pressable/PressableExample.js +0 -426
- package/RNTester/js/examples/ProgressBarAndroid/ProgressBarAndroidExample.android.js +0 -94
- package/RNTester/js/examples/ProgressViewIOS/ProgressViewIOSExample.js +0 -103
- package/RNTester/js/examples/PushNotificationIOS/PushNotificationIOSExample.js +0 -267
- package/RNTester/js/examples/RCTRootView/RCTRootViewIOSExample.js +0 -95
- package/RNTester/js/examples/RTL/RTLExample.js +0 -747
- package/RNTester/js/examples/RefreshControl/RefreshControlExample.js +0 -127
- package/RNTester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js +0 -68
- package/RNTester/js/examples/SafeAreaView/SafeAreaViewExample.js +0 -137
- package/RNTester/js/examples/ScrollView/ScrollViewAnimatedExample.js +0 -107
- package/RNTester/js/examples/ScrollView/ScrollViewExample.js +0 -346
- package/RNTester/js/examples/ScrollView/ScrollViewSimpleExample.js +0 -105
- package/RNTester/js/examples/SectionList/SectionListExample.js +0 -301
- package/RNTester/js/examples/SegmentedControlIOS/SegmentedControlIOSExample.js +0 -183
- package/RNTester/js/examples/SetPropertiesExample/SetPropertiesExampleApp.js +0 -34
- package/RNTester/js/examples/Share/ShareExample.js +0 -124
- package/RNTester/js/examples/Slider/SliderExample.js +0 -136
- package/RNTester/js/examples/Snapshot/SnapshotExample.js +0 -69
- package/RNTester/js/examples/Snapshot/SnapshotViewIOS.android.js +0 -12
- package/RNTester/js/examples/Snapshot/SnapshotViewIOS.ios.js +0 -67
- package/RNTester/js/examples/StatusBar/StatusBarExample.js +0 -522
- package/RNTester/js/examples/Switch/SwitchExample.js +0 -239
- package/RNTester/js/examples/TVEventHandler/TVEventHandlerExample.js +0 -88
- package/RNTester/js/examples/Text/TextExample.android.js +0 -864
- package/RNTester/js/examples/Text/TextExample.ios.js +0 -1153
- package/RNTester/js/examples/TextInput/TextInputExample.android.js +0 -424
- package/RNTester/js/examples/TextInput/TextInputExample.ios.js +0 -710
- package/RNTester/js/examples/TextInput/TextInputSharedExamples.js +0 -618
- package/RNTester/js/examples/Timer/TimerExample.js +0 -373
- package/RNTester/js/examples/ToastAndroid/ToastAndroidExample.android.js +0 -136
- package/RNTester/js/examples/Touchable/TouchableExample.js +0 -664
- package/RNTester/js/examples/Transform/TransformExample.js +0 -336
- package/RNTester/js/examples/TransparentHitTest/TransparentHitTestExample.js +0 -50
- package/RNTester/js/examples/TurboModule/SampleTurboModuleExample.js +0 -190
- package/RNTester/js/examples/TurboModule/TurboModuleExample.js +0 -26
- package/RNTester/js/examples/Vibration/VibrationExample.js +0 -127
- package/RNTester/js/examples/View/ViewExample.js +0 -471
- package/RNTester/js/examples/WebSocket/WebSocketExample.js +0 -356
- package/RNTester/js/examples/WebSocket/http_test_server.js +0 -33
- package/RNTester/js/examples/WebSocket/websocket_test_server.js +0 -46
- package/RNTester/js/examples/XHR/XHRExample.js +0 -62
- package/RNTester/js/examples/XHR/XHRExampleAbortController.js +0 -58
- package/RNTester/js/examples/XHR/XHRExampleBinaryUpload.js +0 -149
- package/RNTester/js/examples/XHR/XHRExampleDownload.js +0 -242
- package/RNTester/js/examples/XHR/XHRExampleFetch.js +0 -133
- package/RNTester/js/examples/XHR/XHRExampleHeaders.js +0 -114
- package/RNTester/js/examples/XHR/XHRExampleOnTimeOut.js +0 -99
- package/RNTester/js/types/RNTesterTypes.js +0 -47
- package/RNTester/js/utils/RNTesterActions.js +0 -53
- package/RNTester/js/utils/RNTesterList.android.js +0 -257
- package/RNTester/js/utils/RNTesterList.ios.js +0 -366
- package/RNTester/js/utils/RNTesterList.win32.js +0 -240
- package/RNTester/js/utils/RNTesterNavigationReducer.js +0 -49
- package/RNTester/js/utils/RNTesterStatePersister.js +0 -86
- package/RNTester/js/utils/URIActionMap.js +0 -48
- package/api-extractor.json +0 -25
- package/demo/DocPagePropsList.d.ts +0 -18
- package/demo/DocPagePropsList.js +0 -7
- package/demo/DocPagePropsList.js.map +0 -1
- package/docs/api/index.md +0 -12
- package/docs/api/react-native-win32.accessibilityactionevent.md +0 -13
- package/docs/api/react-native-win32.accessibilityactioninfo.md +0 -14
- package/docs/api/react-native-win32.accessibilityactionname.md +0 -11
- package/docs/api/react-native-win32.accessibilityannotationinfo.md +0 -16
- package/docs/api/react-native-win32.accessibilitystate.md +0 -14
- package/docs/api/react-native-win32.annotationtype.md +0 -11
- package/docs/api/react-native-win32.ariarole.md +0 -11
- package/docs/api/react-native-win32.basepropswin32.md +0 -17
- package/docs/api/react-native-win32.buttonwin32._constructor_.md +0 -20
- package/docs/api/react-native-win32.buttonwin32.md +0 -27
- package/docs/api/react-native-win32.buttonwin32.render.md +0 -15
- package/docs/api/react-native-win32.buttonwin32omitstyles.md +0 -11
- package/docs/api/react-native-win32.colorgradientwin32.md +0 -15
- package/docs/api/react-native-win32.cursor.md +0 -11
- package/docs/api/react-native-win32.eventphase.md +0 -21
- package/docs/api/react-native-win32.gradientcolorstop.md +0 -16
- package/docs/api/react-native-win32.gradientcolorvaluewin32.md +0 -16
- package/docs/api/react-native-win32.ibuttonwin32props.md +0 -25
- package/docs/api/react-native-win32.ibuttonwin32props.onblur.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.onfocus.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.onmouseenter.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.onmouseleave.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.ontouchend.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.ontouchstart.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32props.style.md +0 -13
- package/docs/api/react-native-win32.ibuttonwin32style.md +0 -13
- package/docs/api/react-native-win32.ichildasfunction.md +0 -13
- package/docs/api/react-native-win32.idimensions.height.md +0 -11
- package/docs/api/react-native-win32.idimensions.md +0 -21
- package/docs/api/react-native-win32.idimensions.width.md +0 -11
- package/docs/api/react-native-win32.ihandledkeyboardevent.md +0 -11
- package/docs/api/react-native-win32.ikeyboardevent.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.altkey.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.ctrlkey.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.eventphase.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.key.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.md +0 -23
- package/docs/api/react-native-win32.inativekeyboardevent.metakey.md +0 -11
- package/docs/api/react-native-win32.inativekeyboardevent.shiftkey.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.brandiconsource.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.color.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.disabled.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.displayname.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.emailaddress.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.initials.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.md +0 -29
- package/docs/api/react-native-win32.ipersonacoinprops.onerror.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.onload.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.presence.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.size.md +0 -11
- package/docs/api/react-native-win32.ipersonacoinprops.source.md +0 -11
- package/docs/api/react-native-win32.iposition.left.md +0 -11
- package/docs/api/react-native-win32.iposition.md +0 -21
- package/docs/api/react-native-win32.iposition.top.md +0 -11
- package/docs/api/react-native-win32.ipressevent.md +0 -24
- package/docs/api/react-native-win32.ipressinlocation.locationx.md +0 -11
- package/docs/api/react-native-win32.ipressinlocation.locationy.md +0 -11
- package/docs/api/react-native-win32.ipressinlocation.md +0 -23
- package/docs/api/react-native-win32.ipressinlocation.pagex.md +0 -11
- package/docs/api/react-native-win32.ipressinlocation.pagey.md +0 -11
- package/docs/api/react-native-win32.irenderchild.md +0 -13
- package/docs/api/react-native-win32.irenderstyle.md +0 -13
- package/docs/api/react-native-win32.irespondersyntheticevent.md +0 -21
- package/docs/api/react-native-win32.irespondersyntheticevent.touchhistory.md +0 -16
- package/docs/api/react-native-win32.isignal.md +0 -13
- package/docs/api/react-native-win32.istate.md +0 -13
- package/docs/api/react-native-win32.istateconditions.md +0 -15
- package/docs/api/react-native-win32.itextwin32props.md +0 -20
- package/docs/api/react-native-win32.itextwin32props.textstyle.md +0 -25
- package/docs/api/react-native-win32.itextwin32props.tooltip.md +0 -13
- package/docs/api/react-native-win32.itouchablewin32props.children.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.disabled.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.filterkeys.md +0 -13
- package/docs/api/react-native-win32.itouchablewin32props.md +0 -36
- package/docs/api/react-native-win32.itouchablewin32props.onlongpress.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.rejectrespondertermination.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.renderstyle.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablegethighlightdelayms.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablegethitslop.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablegetlongpressdelayms.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablegetpressoutdelayms.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablegetpressrectoffset.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandleactivepressin.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandleactivepressout.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandlekeypress.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandlekeypressdown.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandlelongpress.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchablehandlepress.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32props.touchsounddisabled.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32state.isfocused.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32state.ishovered.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32state.ispressed.md +0 -11
- package/docs/api/react-native-win32.itouchablewin32state.md +0 -20
- package/docs/api/react-native-win32.itouchinfo.currentpagex.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.currentpagey.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.currenttimestamp.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.md +0 -29
- package/docs/api/react-native-win32.itouchinfo.previouspagex.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.previouspagey.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.previoustimestamp.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.startpagex.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.startpagey.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.starttimestamp.md +0 -11
- package/docs/api/react-native-win32.itouchinfo.touchactive.md +0 -11
- package/docs/api/react-native-win32.itransitions.md +0 -15
- package/docs/api/react-native-win32.iviewwin32.focus.md +0 -11
- package/docs/api/react-native-win32.iviewwin32.md +0 -18
- package/docs/api/react-native-win32.iviewwin32props.acceptskeyboardfocus.md +0 -16
- package/docs/api/react-native-win32.iviewwin32props.accessibilityactions.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.accessibilityannotation.md +0 -15
- package/docs/api/react-native-win32.iviewwin32props.accessibilitylevel.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.accessibilitypositioninset.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.accessibilitysetsize.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.animationclass.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.children.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.cursor.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.focusable.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.keydownevents.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.keyupevents.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.md +0 -44
- package/docs/api/react-native-win32.iviewwin32props.onblur.md +0 -15
- package/docs/api/react-native-win32.iviewwin32props.onblurcapture.md +0 -15
- package/docs/api/react-native-win32.iviewwin32props.onfocus.md +0 -15
- package/docs/api/react-native-win32.iviewwin32props.onfocuscapture.md +0 -15
- package/docs/api/react-native-win32.iviewwin32props.onkeydown.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.onkeydowncapture.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.onkeyup.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.onkeyupcapture.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.onmouseenter.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.onmouseleave.md +0 -11
- package/docs/api/react-native-win32.iviewwin32props.tooltip.md +0 -13
- package/docs/api/react-native-win32.iviewwin32props.type.md +0 -11
- package/docs/api/react-native-win32.md +0 -85
- package/docs/api/react-native-win32.omittedaccessibilitypropswin32.md +0 -15
- package/docs/api/react-native-win32.personacoin.md +0 -11
- package/docs/api/react-native-win32.personacoinpresence.md +0 -25
- package/docs/api/react-native-win32.personacoinsize.md +0 -23
- package/docs/api/react-native-win32.sharedaccessibilitypropsiosandwin32.md +0 -13
- package/docs/api/react-native-win32.textstyle.md +0 -13
- package/docs/api/react-native-win32.textwin32._constructor_.md +0 -20
- package/docs/api/react-native-win32.textwin32.md +0 -25
- package/docs/api/react-native-win32.textwin32.render.md +0 -15
- package/docs/api/react-native-win32.textwin32omittypes.md +0 -11
- package/docs/api/react-native-win32.touchablewin32._constructor_.md +0 -20
- package/docs/api/react-native-win32.touchablewin32.componentwillunmount.md +0 -15
- package/docs/api/react-native-win32.touchablewin32.focus.md +0 -11
- package/docs/api/react-native-win32.touchablewin32.md +0 -34
- package/docs/api/react-native-win32.touchablewin32.render.md +0 -15
- package/docs/api/react-native-win32.usefrom.md +0 -13
- package/docs/api/react-native-win32.viewwin32.md +0 -11
- package/docs/api/react-native-win32.viewwin32omittypes.md +0 -11
- package/etc/react-native-win32.api.md +0 -481
- package/flow/Promise.js +0 -47
- package/flow/fbjs.js +0 -258
- package/flow/use-subscription.js +0 -19
- package/jest/preprocessor.js +0 -120
- package/typings-index.d.ts +0 -20
- package/typings-index.js +0 -40
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -8,74 +8,155 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const ReactNative = require('../../Renderer/shims/ReactNative');
|
|
17
|
-
require('../../Renderer/shims/ReactNative'); // Force side effects to prevent T55744311
|
|
18
|
-
const ScrollResponder = require('../ScrollResponder');
|
|
19
|
-
const ScrollViewStickyHeader = require('./ScrollViewStickyHeader');
|
|
20
|
-
const StyleSheet = require('../../StyleSheet/StyleSheet');
|
|
21
|
-
const View = require('../View/View');
|
|
22
|
-
|
|
23
|
-
const dismissKeyboard = require('../../Utilities/dismissKeyboard');
|
|
24
|
-
const flattenStyle = require('../../StyleSheet/flattenStyle');
|
|
25
|
-
const invariant = require('invariant');
|
|
26
|
-
const processDecelerationRate = require('./processDecelerationRate');
|
|
27
|
-
const resolveAssetSource = require('../../Image/resolveAssetSource');
|
|
28
|
-
const splitLayoutProps = require('../../StyleSheet/splitLayoutProps');
|
|
29
|
-
const setAndForwardRef = require('../../Utilities/setAndForwardRef');
|
|
30
|
-
|
|
11
|
+
import type {
|
|
12
|
+
TScrollViewNativeComponentInstance,
|
|
13
|
+
TScrollViewNativeImperativeHandle,
|
|
14
|
+
} from '../../../src/private/components/useSyncOnScroll';
|
|
15
|
+
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
|
31
16
|
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
|
32
17
|
import type {PointProp} from '../../StyleSheet/PointPropType';
|
|
33
18
|
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
|
34
|
-
import type {ColorValue} from '../../StyleSheet/
|
|
19
|
+
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
35
20
|
import type {
|
|
21
|
+
LayoutEvent,
|
|
36
22
|
PressEvent,
|
|
37
23
|
ScrollEvent,
|
|
38
|
-
LayoutEvent,
|
|
39
24
|
} from '../../Types/CoreEventTypes';
|
|
40
|
-
import type {
|
|
41
|
-
import type {
|
|
25
|
+
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
|
26
|
+
import type {KeyboardEvent, KeyboardMetrics} from '../Keyboard/Keyboard';
|
|
27
|
+
import typeof View from '../View/View';
|
|
42
28
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
43
29
|
import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
|
|
44
30
|
|
|
45
|
-
import
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
31
|
+
import {
|
|
32
|
+
HScrollContentViewNativeComponent,
|
|
33
|
+
HScrollViewNativeComponent,
|
|
34
|
+
} from '../../../src/private/components/HScrollViewNativeComponents';
|
|
35
|
+
import {
|
|
36
|
+
VScrollContentViewNativeComponent,
|
|
37
|
+
VScrollViewNativeComponent,
|
|
38
|
+
} from '../../../src/private/components/VScrollViewNativeComponents';
|
|
39
|
+
import AnimatedImplementation from '../../Animated/AnimatedImplementation';
|
|
40
|
+
import FrameRateLogger from '../../Interaction/FrameRateLogger';
|
|
41
|
+
import {findNodeHandle} from '../../ReactNative/RendererProxy';
|
|
42
|
+
import UIManager from '../../ReactNative/UIManager';
|
|
43
|
+
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
44
|
+
import splitLayoutProps from '../../StyleSheet/splitLayoutProps';
|
|
45
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
46
|
+
import Dimensions from '../../Utilities/Dimensions';
|
|
47
|
+
import dismissKeyboard from '../../Utilities/dismissKeyboard';
|
|
48
|
+
import Platform from '../../Utilities/Platform';
|
|
49
|
+
import EventEmitter from '../../vendor/emitter/EventEmitter';
|
|
50
|
+
import Keyboard from '../Keyboard/Keyboard';
|
|
51
|
+
import TextInputState from '../TextInput/TextInputState';
|
|
52
|
+
import processDecelerationRate from './processDecelerationRate';
|
|
53
|
+
import Commands from './ScrollViewCommands';
|
|
54
|
+
import ScrollViewContext, {HORIZONTAL, VERTICAL} from './ScrollViewContext';
|
|
55
|
+
import ScrollViewStickyHeader from './ScrollViewStickyHeader';
|
|
56
|
+
import invariant from 'invariant';
|
|
57
|
+
import memoize from 'memoize-one';
|
|
58
|
+
import nullthrows from 'nullthrows';
|
|
59
|
+
import * as React from 'react';
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* iOS scroll event timing nuances:
|
|
63
|
+
* ===============================
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* Scrolling without bouncing, if you touch down:
|
|
67
|
+
* -------------------------------
|
|
68
|
+
*
|
|
69
|
+
* 1. `onMomentumScrollBegin` (when animation begins after letting up)
|
|
70
|
+
* ... physical touch starts ...
|
|
71
|
+
* 2. `onTouchStartCapture` (when you press down to stop the scroll)
|
|
72
|
+
* 3. `onTouchStart` (same, but bubble phase)
|
|
73
|
+
* 4. `onResponderRelease` (when lifting up - you could pause forever before * lifting)
|
|
74
|
+
* 5. `onMomentumScrollEnd`
|
|
75
|
+
*
|
|
76
|
+
*
|
|
77
|
+
* Scrolling with bouncing, if you touch down:
|
|
78
|
+
* -------------------------------
|
|
79
|
+
*
|
|
80
|
+
* 1. `onMomentumScrollBegin` (when animation begins after letting up)
|
|
81
|
+
* ... bounce begins ...
|
|
82
|
+
* ... some time elapses ...
|
|
83
|
+
* ... physical touch during bounce ...
|
|
84
|
+
* 2. `onMomentumScrollEnd` (Makes no sense why this occurs first during bounce)
|
|
85
|
+
* 3. `onTouchStartCapture` (immediately after `onMomentumScrollEnd`)
|
|
86
|
+
* 4. `onTouchStart` (same, but bubble phase)
|
|
87
|
+
* 5. `onTouchEnd` (You could hold the touch start for a long time)
|
|
88
|
+
* 6. `onMomentumScrollBegin` (When releasing the view starts bouncing back)
|
|
89
|
+
*
|
|
90
|
+
* So when we receive an `onTouchStart`, how can we tell if we are touching
|
|
91
|
+
* *during* an animation (which then causes the animation to stop)? The only way
|
|
92
|
+
* to tell is if the `touchStart` occurred immediately after the
|
|
93
|
+
* `onMomentumScrollEnd`.
|
|
94
|
+
*
|
|
95
|
+
* This is abstracted out for you, so you can just call this.scrollResponderIsAnimating() if
|
|
96
|
+
* necessary
|
|
97
|
+
*
|
|
98
|
+
* `ScrollView` also includes logic for blurring a currently focused input
|
|
99
|
+
* if one is focused while scrolling. This is a natural place
|
|
100
|
+
* to put this logic since it can support not dismissing the keyboard while
|
|
101
|
+
* scrolling, unless a recognized "tap"-like gesture has occurred.
|
|
102
|
+
*
|
|
103
|
+
* The public lifecycle API includes events for keyboard interaction, responder
|
|
104
|
+
* interaction, and scrolling (among others). The keyboard callbacks
|
|
105
|
+
* `onKeyboardWill/Did/*` are *global* events, but are invoked on scroll
|
|
106
|
+
* responder's props so that you can guarantee that the scroll responder's
|
|
107
|
+
* internal state has been updated accordingly (and deterministically) by
|
|
108
|
+
* the time the props callbacks are invoke. Otherwise, you would always wonder
|
|
109
|
+
* if the scroll responder is currently in a state where it recognizes new
|
|
110
|
+
* keyboard positions etc. If coordinating scrolling with keyboard movement,
|
|
111
|
+
* *always* use these hooks instead of listening to your own global keyboard
|
|
112
|
+
* events.
|
|
113
|
+
*
|
|
114
|
+
* Public keyboard lifecycle API: (props callbacks)
|
|
115
|
+
*
|
|
116
|
+
* Standard Keyboard Appearance Sequence:
|
|
117
|
+
*
|
|
118
|
+
* this.props.onKeyboardWillShow
|
|
119
|
+
* this.props.onKeyboardDidShow
|
|
120
|
+
*
|
|
121
|
+
* `onScrollResponderKeyboardDismissed` will be invoked if an appropriate
|
|
122
|
+
* tap inside the scroll responder's scrollable region was responsible
|
|
123
|
+
* for the dismissal of the keyboard. There are other reasons why the
|
|
124
|
+
* keyboard could be dismissed.
|
|
125
|
+
*
|
|
126
|
+
* this.props.onScrollResponderKeyboardDismissed
|
|
127
|
+
*
|
|
128
|
+
* Standard Keyboard Hide Sequence:
|
|
129
|
+
*
|
|
130
|
+
* this.props.onKeyboardWillHide
|
|
131
|
+
* this.props.onKeyboardDidHide
|
|
132
|
+
*/
|
|
64
133
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// issue by specifying them manually.
|
|
134
|
+
// Public methods for ScrollView
|
|
135
|
+
export type ScrollViewImperativeMethods = $ReadOnly<{|
|
|
136
|
+
getScrollResponder: $PropertyType<ScrollView, 'getScrollResponder'>,
|
|
69
137
|
getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>,
|
|
70
138
|
getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>,
|
|
71
139
|
getInnerViewRef: $PropertyType<ScrollView, 'getInnerViewRef'>,
|
|
72
140
|
getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>,
|
|
73
|
-
setNativeProps: $PropertyType<ScrollView, 'setNativeProps'>,
|
|
74
141
|
scrollTo: $PropertyType<ScrollView, 'scrollTo'>,
|
|
142
|
+
scrollToEnd: $PropertyType<ScrollView, 'scrollToEnd'>,
|
|
75
143
|
flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
144
|
+
scrollResponderZoomTo: $PropertyType<ScrollView, 'scrollResponderZoomTo'>,
|
|
145
|
+
scrollResponderScrollNativeHandleToKeyboard: $PropertyType<
|
|
146
|
+
ScrollView,
|
|
147
|
+
'scrollResponderScrollNativeHandleToKeyboard',
|
|
148
|
+
>,
|
|
149
|
+
|}>;
|
|
150
|
+
|
|
151
|
+
export type DecelerationRateType = 'fast' | 'normal' | number;
|
|
152
|
+
export type ScrollResponderType = ScrollViewImperativeMethods;
|
|
153
|
+
|
|
154
|
+
type PublicScrollViewInstance = $ReadOnly<{|
|
|
155
|
+
...$Exact<TScrollViewNativeComponentInstance>,
|
|
156
|
+
...ScrollViewImperativeMethods,
|
|
157
|
+
|}>;
|
|
158
|
+
|
|
159
|
+
type InnerViewInstance = React.ElementRef<View>;
|
|
79
160
|
|
|
80
161
|
type IOSProps = $ReadOnly<{|
|
|
81
162
|
/**
|
|
@@ -86,17 +167,23 @@ type IOSProps = $ReadOnly<{|
|
|
|
86
167
|
*/
|
|
87
168
|
automaticallyAdjustContentInsets?: ?boolean,
|
|
88
169
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
170
|
+
* Controls whether the ScrollView should automatically adjust its `contentInset`
|
|
171
|
+
* and `scrollViewInsets` when the Keyboard changes its size. The default value is false.
|
|
91
172
|
* @platform ios
|
|
92
173
|
*/
|
|
93
|
-
|
|
174
|
+
automaticallyAdjustKeyboardInsets?: ?boolean,
|
|
94
175
|
/**
|
|
95
|
-
*
|
|
96
|
-
* The default value is
|
|
176
|
+
* Controls whether iOS should automatically adjust the scroll indicator
|
|
177
|
+
* insets. The default value is true. Available on iOS 13 and later.
|
|
97
178
|
* @platform ios
|
|
98
179
|
*/
|
|
99
|
-
|
|
180
|
+
automaticallyAdjustsScrollIndicatorInsets?: ?boolean,
|
|
181
|
+
/**
|
|
182
|
+
* The amount by which the scroll view content is inset from the edges
|
|
183
|
+
* of the scroll view. Defaults to `{top: 0, left: 0, bottom: 0, right: 0}`.
|
|
184
|
+
* @platform ios
|
|
185
|
+
*/
|
|
186
|
+
contentInset?: ?EdgeInsetsProp,
|
|
100
187
|
/**
|
|
101
188
|
* When true, the scroll view bounces when it reaches the end of the
|
|
102
189
|
* content if the content is larger then the scroll view along the axis of
|
|
@@ -163,34 +250,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
163
250
|
* @platform ios
|
|
164
251
|
*/
|
|
165
252
|
canCancelContentTouches?: ?boolean,
|
|
166
|
-
/**
|
|
167
|
-
* When set, the scroll view will adjust the scroll position so that the first child that is
|
|
168
|
-
* currently visible and at or beyond `minIndexForVisible` will not change position. This is
|
|
169
|
-
* useful for lists that are loading content in both directions, e.g. a chat thread, where new
|
|
170
|
-
* messages coming in might otherwise cause the scroll position to jump. A value of 0 is common,
|
|
171
|
-
* but other values such as 1 can be used to skip loading spinners or other content that should
|
|
172
|
-
* not maintain position.
|
|
173
|
-
*
|
|
174
|
-
* The optional `autoscrollToTopThreshold` can be used to make the content automatically scroll
|
|
175
|
-
* to the top after making the adjustment if the user was within the threshold of the top before
|
|
176
|
-
* the adjustment was made. This is also useful for chat-like applications where you want to see
|
|
177
|
-
* new messages scroll into place, but not if the user has scrolled up a ways and it would be
|
|
178
|
-
* disruptive to scroll a bunch.
|
|
179
|
-
*
|
|
180
|
-
* Caveat 1: Reordering elements in the scrollview with this enabled will probably cause
|
|
181
|
-
* jumpiness and jank. It can be fixed, but there are currently no plans to do so. For now,
|
|
182
|
-
* don't re-order the content of any ScrollViews or Lists that use this feature.
|
|
183
|
-
*
|
|
184
|
-
* Caveat 2: This simply uses `contentOffset` and `frame.origin` in native code to compute
|
|
185
|
-
* visibility. Occlusion, transforms, and other complexity won't be taken into account as to
|
|
186
|
-
* whether content is "visible" or not.
|
|
187
|
-
*
|
|
188
|
-
* @platform ios
|
|
189
|
-
*/
|
|
190
|
-
maintainVisibleContentPosition?: ?$ReadOnly<{|
|
|
191
|
-
minIndexForVisible: number,
|
|
192
|
-
autoscrollToTopThreshold?: ?number,
|
|
193
|
-
|}>,
|
|
194
253
|
/**
|
|
195
254
|
* The maximum allowed zoom scale. The default value is 1.0.
|
|
196
255
|
* @platform ios
|
|
@@ -207,24 +266,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
207
266
|
* @platform ios
|
|
208
267
|
*/
|
|
209
268
|
pinchGestureEnabled?: ?boolean,
|
|
210
|
-
/**
|
|
211
|
-
* This controls how often the scroll event will be fired while scrolling
|
|
212
|
-
* (as a time interval in ms). A lower number yields better accuracy for code
|
|
213
|
-
* that is tracking the scroll position, but can lead to scroll performance
|
|
214
|
-
* problems due to the volume of information being send over the bridge.
|
|
215
|
-
*
|
|
216
|
-
* Values between 0 and 17ms indicate 60fps updates are needed and throttling
|
|
217
|
-
* will be disabled.
|
|
218
|
-
*
|
|
219
|
-
* If you do not need precise scroll position tracking, set this value higher
|
|
220
|
-
* to limit the information being sent across the bridge.
|
|
221
|
-
*
|
|
222
|
-
* The default value is zero, which results in the scroll event being sent only
|
|
223
|
-
* once each time the view is scrolled.
|
|
224
|
-
*
|
|
225
|
-
* @platform ios
|
|
226
|
-
*/
|
|
227
|
-
scrollEventThrottle?: ?number,
|
|
228
269
|
/**
|
|
229
270
|
* The amount by which the scroll view indicators are inset from the edges
|
|
230
271
|
* of the scroll view. This should normally be set to the same value as
|
|
@@ -254,17 +295,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
254
295
|
* The default value is true.
|
|
255
296
|
*/
|
|
256
297
|
showsHorizontalScrollIndicator?: ?boolean,
|
|
257
|
-
/**
|
|
258
|
-
* When `snapToInterval` is set, `snapToAlignment` will define the relationship
|
|
259
|
-
* of the snapping to the scroll view.
|
|
260
|
-
*
|
|
261
|
-
* - `'start'` (the default) will align the snap at the left (horizontal) or top (vertical)
|
|
262
|
-
* - `'center'` will align the snap in the center
|
|
263
|
-
* - `'end'` will align the snap at the right (horizontal) or bottom (vertical)
|
|
264
|
-
*
|
|
265
|
-
* @platform ios
|
|
266
|
-
*/
|
|
267
|
-
snapToAlignment?: ?('start' | 'center' | 'end'),
|
|
268
298
|
/**
|
|
269
299
|
* The current scale of the scroll view content. The default value is 1.0.
|
|
270
300
|
* @platform ios
|
|
@@ -282,15 +312,6 @@ type IOSProps = $ReadOnly<{|
|
|
|
282
312
|
| 'never'
|
|
283
313
|
| 'always'
|
|
284
314
|
),
|
|
285
|
-
/**
|
|
286
|
-
* When true, ScrollView will emit updateChildFrames data in scroll events,
|
|
287
|
-
* otherwise will not compute or emit child frame data. This only exists
|
|
288
|
-
* to support legacy issues, `onLayout` should be used instead to retrieve
|
|
289
|
-
* frame data.
|
|
290
|
-
* The default value is false.
|
|
291
|
-
* @platform ios
|
|
292
|
-
*/
|
|
293
|
-
DEPRECATED_sendUpdatedChildFrames?: ?boolean,
|
|
294
315
|
|}>;
|
|
295
316
|
|
|
296
317
|
type AndroidProps = $ReadOnly<{|
|
|
@@ -337,7 +358,7 @@ type AndroidProps = $ReadOnly<{|
|
|
|
337
358
|
*/
|
|
338
359
|
persistentScrollbar?: ?boolean,
|
|
339
360
|
/**
|
|
340
|
-
* Fades out the edges of the
|
|
361
|
+
* Fades out the edges of the scroll content.
|
|
341
362
|
*
|
|
342
363
|
* If the value is greater than 0, the fading edges will be set accordingly
|
|
343
364
|
* to the current scroll direction and position,
|
|
@@ -350,32 +371,15 @@ type AndroidProps = $ReadOnly<{|
|
|
|
350
371
|
fadingEdgeLength?: ?number,
|
|
351
372
|
|}>;
|
|
352
373
|
|
|
353
|
-
type VRProps = $ReadOnly<{|
|
|
354
|
-
/**
|
|
355
|
-
* Optionally an image can be used for the scroll bar thumb. This will
|
|
356
|
-
* override the color. While the image is loading or the image fails to
|
|
357
|
-
* load the color will be used instead. Use an alpha of 0 in the color
|
|
358
|
-
* to avoid seeing it while the image is loading.
|
|
359
|
-
*
|
|
360
|
-
* - `uri` - a string representing the resource identifier for the image, which
|
|
361
|
-
* should be either a local file path or the name of a static image resource
|
|
362
|
-
* - `number` - Opaque type returned by something like
|
|
363
|
-
* `import IMAGE from './image.jpg'`.
|
|
364
|
-
* @platform vr
|
|
365
|
-
*/
|
|
366
|
-
scrollBarThumbImage?: ?($ReadOnly<{||}> | number), // Opaque type returned by import IMAGE from './image.jpg'
|
|
367
|
-
|}>;
|
|
368
|
-
|
|
369
374
|
type StickyHeaderComponentType = React.AbstractComponent<
|
|
370
375
|
ScrollViewStickyHeaderProps,
|
|
371
|
-
$ReadOnly<{setNextHeaderY: number => void
|
|
376
|
+
$ReadOnly<interface {setNextHeaderY: number => void}>,
|
|
372
377
|
>;
|
|
373
378
|
|
|
374
379
|
export type Props = $ReadOnly<{|
|
|
375
380
|
...ViewProps,
|
|
376
381
|
...IOSProps,
|
|
377
382
|
...AndroidProps,
|
|
378
|
-
...VRProps,
|
|
379
383
|
|
|
380
384
|
/**
|
|
381
385
|
* These styles will be applied to the scroll view content container which
|
|
@@ -395,6 +399,11 @@ export type Props = $ReadOnly<{|
|
|
|
395
399
|
* ```
|
|
396
400
|
*/
|
|
397
401
|
contentContainerStyle?: ?ViewStyleProp,
|
|
402
|
+
/**
|
|
403
|
+
* Used to manually set the starting scroll offset.
|
|
404
|
+
* The default value is `{x: 0, y: 0}`.
|
|
405
|
+
*/
|
|
406
|
+
contentOffset?: ?PointProp,
|
|
398
407
|
/**
|
|
399
408
|
* When true, the scroll view stops on the next index (in relation to scroll
|
|
400
409
|
* position at release) regardless of how fast the gesture is. This can be
|
|
@@ -412,7 +421,21 @@ export type Props = $ReadOnly<{|
|
|
|
412
421
|
* - `'normal'`: 0.998 on iOS, 0.985 on Android (the default)
|
|
413
422
|
* - `'fast'`: 0.99 on iOS, 0.9 on Android
|
|
414
423
|
*/
|
|
415
|
-
decelerationRate?: ?
|
|
424
|
+
decelerationRate?: ?DecelerationRateType,
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* *Experimental, iOS Only*. The API is experimental and will change in future releases.
|
|
428
|
+
*
|
|
429
|
+
* Controls how much distance is travelled after user stops scrolling.
|
|
430
|
+
* Value greater than 1 will increase the distance travelled.
|
|
431
|
+
* Value less than 1 will decrease the distance travelled.
|
|
432
|
+
*
|
|
433
|
+
* @deprecated
|
|
434
|
+
*
|
|
435
|
+
* The default value is 1.
|
|
436
|
+
*/
|
|
437
|
+
experimental_endDraggingSensitivityMultiplier?: ?number,
|
|
438
|
+
|
|
416
439
|
/**
|
|
417
440
|
* When true, the scroll view's children are arranged horizontally in a row
|
|
418
441
|
* instead of vertically in a column. The default value is false.
|
|
@@ -438,10 +461,8 @@ export type Props = $ReadOnly<{|
|
|
|
438
461
|
* On android this is not supported and it will have the same behavior as 'none'.
|
|
439
462
|
*/
|
|
440
463
|
keyboardDismissMode?: ?// default
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
| 'interactive'
|
|
444
|
-
), // ios only
|
|
464
|
+
// cross-platform
|
|
465
|
+
('none' | 'on-drag' | 'interactive'), // ios only
|
|
445
466
|
/**
|
|
446
467
|
* Determines when the keyboard should stay visible after a tap.
|
|
447
468
|
*
|
|
@@ -455,6 +476,33 @@ export type Props = $ReadOnly<{|
|
|
|
455
476
|
* - `true`, deprecated, use 'always' instead
|
|
456
477
|
*/
|
|
457
478
|
keyboardShouldPersistTaps?: ?('always' | 'never' | 'handled' | true | false),
|
|
479
|
+
/**
|
|
480
|
+
* When set, the scroll view will adjust the scroll position so that the first child that is
|
|
481
|
+
* partially or fully visible and at or beyond `minIndexForVisible` will not change position.
|
|
482
|
+
* This is useful for lists that are loading content in both directions, e.g. a chat thread,
|
|
483
|
+
* where new messages coming in might otherwise cause the scroll position to jump. A value of 0
|
|
484
|
+
* is common, but other values such as 1 can be used to skip loading spinners or other content
|
|
485
|
+
* that should not maintain position.
|
|
486
|
+
*
|
|
487
|
+
* The optional `autoscrollToTopThreshold` can be used to make the content automatically scroll
|
|
488
|
+
* to the top after making the adjustment if the user was within the threshold of the top before
|
|
489
|
+
* the adjustment was made. This is also useful for chat-like applications where you want to see
|
|
490
|
+
* new messages scroll into place, but not if the user has scrolled up a ways and it would be
|
|
491
|
+
* disruptive to scroll a bunch.
|
|
492
|
+
*
|
|
493
|
+
* Caveat 1: Reordering elements in the scrollview with this enabled will probably cause
|
|
494
|
+
* jumpiness and jank. It can be fixed, but there are currently no plans to do so. For now,
|
|
495
|
+
* don't re-order the content of any ScrollViews or Lists that use this feature.
|
|
496
|
+
*
|
|
497
|
+
* Caveat 2: This simply uses `contentOffset` and `frame.origin` in native code to compute
|
|
498
|
+
* visibility. Occlusion, transforms, and other complexity won't be taken into account as to
|
|
499
|
+
* whether content is "visible" or not.
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
502
|
+
maintainVisibleContentPosition?: ?$ReadOnly<{|
|
|
503
|
+
minIndexForVisible: number,
|
|
504
|
+
autoscrollToTopThreshold?: ?number,
|
|
505
|
+
|}>,
|
|
458
506
|
/**
|
|
459
507
|
* Called when the momentum scroll starts (scroll which occurs as the ScrollView glides to a stop).
|
|
460
508
|
*/
|
|
@@ -465,8 +513,7 @@ export type Props = $ReadOnly<{|
|
|
|
465
513
|
onMomentumScrollEnd?: ?(event: ScrollEvent) => void,
|
|
466
514
|
|
|
467
515
|
/**
|
|
468
|
-
* Fires at most once per frame during scrolling.
|
|
469
|
-
* events can be controlled using the `scrollEventThrottle` prop.
|
|
516
|
+
* Fires at most once per frame during scrolling.
|
|
470
517
|
*/
|
|
471
518
|
onScroll?: ?(event: ScrollEvent) => void,
|
|
472
519
|
/**
|
|
@@ -488,16 +535,16 @@ export type Props = $ReadOnly<{|
|
|
|
488
535
|
* which this ScrollView renders.
|
|
489
536
|
*/
|
|
490
537
|
onContentSizeChange?: (contentWidth: number, contentHeight: number) => void,
|
|
491
|
-
onKeyboardDidShow?: (event:
|
|
538
|
+
onKeyboardDidShow?: (event: KeyboardEvent) => void,
|
|
539
|
+
onKeyboardDidHide?: (event: KeyboardEvent) => void,
|
|
540
|
+
onKeyboardWillShow?: (event: KeyboardEvent) => void,
|
|
541
|
+
onKeyboardWillHide?: (event: KeyboardEvent) => void,
|
|
492
542
|
/**
|
|
493
543
|
* When true, the scroll view stops on multiples of the scroll view's size
|
|
494
544
|
* when scrolling. This can be used for horizontal pagination. The default
|
|
495
545
|
* value is false.
|
|
496
|
-
*
|
|
497
|
-
* Note: Vertical pagination is not supported on Android.
|
|
498
546
|
*/
|
|
499
547
|
pagingEnabled?: ?boolean,
|
|
500
|
-
|
|
501
548
|
/**
|
|
502
549
|
* When false, the view cannot be scrolled via touch interaction.
|
|
503
550
|
* The default value is true.
|
|
@@ -505,11 +552,23 @@ export type Props = $ReadOnly<{|
|
|
|
505
552
|
* Note that the view can always be scrolled by calling `scrollTo`.
|
|
506
553
|
*/
|
|
507
554
|
scrollEnabled?: ?boolean,
|
|
555
|
+
/**
|
|
556
|
+
* Limits how often scroll events will be fired while scrolling, specified as
|
|
557
|
+
* a time interval in ms. This may be useful when expensive work is performed
|
|
558
|
+
* in response to scrolling. Values <= `16` will disable throttling,
|
|
559
|
+
* regardless of the refresh rate of the device.
|
|
560
|
+
*/
|
|
561
|
+
scrollEventThrottle?: ?number,
|
|
508
562
|
/**
|
|
509
563
|
* When true, shows a vertical scroll indicator.
|
|
510
564
|
* The default value is true.
|
|
511
565
|
*/
|
|
512
566
|
showsVerticalScrollIndicator?: ?boolean,
|
|
567
|
+
/**
|
|
568
|
+
* When true, Sticky header is hidden when scrolling down, and dock at the top
|
|
569
|
+
* when scrolling up
|
|
570
|
+
*/
|
|
571
|
+
stickyHeaderHiddenOnScroll?: ?boolean,
|
|
513
572
|
/**
|
|
514
573
|
* An array of child indices determining which children get docked to the
|
|
515
574
|
* top of the screen when scrolling. For example, passing
|
|
@@ -525,6 +584,15 @@ export type Props = $ReadOnly<{|
|
|
|
525
584
|
* for example when you want your list to have an animated hidable header.
|
|
526
585
|
*/
|
|
527
586
|
StickyHeaderComponent?: StickyHeaderComponentType,
|
|
587
|
+
/**
|
|
588
|
+
* When `snapToInterval` is set, `snapToAlignment` will define the relationship
|
|
589
|
+
* of the snapping to the scroll view.
|
|
590
|
+
*
|
|
591
|
+
* - `'start'` (the default) will align the snap at the left (horizontal) or top (vertical)
|
|
592
|
+
* - `'center'` will align the snap in the center
|
|
593
|
+
* - `'end'` will align the snap at the right (horizontal) or bottom (vertical)
|
|
594
|
+
*/
|
|
595
|
+
snapToAlignment?: ?('start' | 'center' | 'end'),
|
|
528
596
|
/**
|
|
529
597
|
* When set, causes the scroll view to stop at multiples of the value of
|
|
530
598
|
* `snapToInterval`. This can be used for paginating through children
|
|
@@ -573,41 +641,32 @@ export type Props = $ReadOnly<{|
|
|
|
573
641
|
*
|
|
574
642
|
* See [RefreshControl](docs/refreshcontrol.html).
|
|
575
643
|
*/
|
|
576
|
-
|
|
577
|
-
|
|
644
|
+
/* $FlowFixMe[unclear-type] - how to handle generic type without existential
|
|
645
|
+
* operator? */
|
|
646
|
+
refreshControl?: ?ExactReactElement_DEPRECATED<any>,
|
|
578
647
|
children?: React.Node,
|
|
579
648
|
/**
|
|
580
649
|
* A ref to the inner View element of the ScrollView. This should be used
|
|
581
650
|
* instead of calling `getInnerViewRef`.
|
|
582
651
|
*/
|
|
583
|
-
innerViewRef?: React.
|
|
652
|
+
innerViewRef?: React.RefSetter<InnerViewInstance>,
|
|
653
|
+
/**
|
|
654
|
+
* A ref to the Native ScrollView component. This ref can be used to call
|
|
655
|
+
* all of ScrollView's public methods, in addition to native methods like
|
|
656
|
+
* measure, measureLayout, etc.
|
|
657
|
+
*/
|
|
658
|
+
scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
|
|
584
659
|
|}>;
|
|
585
660
|
|
|
586
661
|
type State = {|
|
|
587
662
|
layoutHeight: ?number,
|
|
588
|
-
...ScrollResponderState,
|
|
589
663
|
|};
|
|
590
664
|
|
|
591
|
-
|
|
592
|
-
node: React.ElementRef<typeof ScrollView>,
|
|
593
|
-
): typeof ScrollResponder.Mixin {
|
|
594
|
-
const scrollResponder = {...ScrollResponder.Mixin};
|
|
595
|
-
|
|
596
|
-
for (const key in scrollResponder) {
|
|
597
|
-
if (typeof scrollResponder[key] === 'function') {
|
|
598
|
-
scrollResponder[key] = scrollResponder[key].bind(node);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
return scrollResponder;
|
|
603
|
-
}
|
|
665
|
+
const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
|
|
604
666
|
|
|
605
|
-
type
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
horizontal: true,
|
|
609
|
-
});
|
|
610
|
-
const standardVerticalContext: ContextType = Object.freeze({horizontal: false});
|
|
667
|
+
export type ScrollViewComponentStatics = $ReadOnly<{|
|
|
668
|
+
Context: typeof ScrollViewContext,
|
|
669
|
+
|}>;
|
|
611
670
|
|
|
612
671
|
/**
|
|
613
672
|
* Component that wraps platform ScrollView while providing
|
|
@@ -625,7 +684,7 @@ const standardVerticalContext: ContextType = Object.freeze({horizontal: false});
|
|
|
625
684
|
* view from becoming the responder.
|
|
626
685
|
*
|
|
627
686
|
*
|
|
628
|
-
* `<ScrollView>` vs [`<FlatList>`](https://reactnative.dev/docs/flatlist
|
|
687
|
+
* `<ScrollView>` vs [`<FlatList>`](https://reactnative.dev/docs/flatlist) - which one to use?
|
|
629
688
|
*
|
|
630
689
|
* `ScrollView` simply renders all its react child components at once. That
|
|
631
690
|
* makes it very easy to understand and use.
|
|
@@ -645,115 +704,121 @@ const standardVerticalContext: ContextType = Object.freeze({horizontal: false});
|
|
|
645
704
|
* supports out of the box.
|
|
646
705
|
*/
|
|
647
706
|
class ScrollView extends React.Component<Props, State> {
|
|
648
|
-
static Context:
|
|
649
|
-
/**
|
|
650
|
-
* Part 1: Removing ScrollResponder.Mixin:
|
|
651
|
-
*
|
|
652
|
-
* 1. Mixin methods should be flow typed. That's why we create a
|
|
653
|
-
* copy of ScrollResponder.Mixin and attach it to this._scrollResponder.
|
|
654
|
-
* Otherwise, we'd have to manually declare each method on the component
|
|
655
|
-
* class and assign it a flow type.
|
|
656
|
-
* 2. Mixin methods can call component methods, and access the component's
|
|
657
|
-
* props and state. So, we need to bind all mixin methods to the
|
|
658
|
-
* component instance.
|
|
659
|
-
* 3. Continued...
|
|
660
|
-
*/
|
|
661
|
-
_scrollResponder: typeof ScrollResponder.Mixin = createScrollResponder(this);
|
|
707
|
+
static Context: typeof ScrollViewContext = ScrollViewContext;
|
|
662
708
|
|
|
663
709
|
constructor(props: Props) {
|
|
664
710
|
super(props);
|
|
665
711
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
* this. Since mixin methods are bound to the component instance, we need
|
|
671
|
-
* to copy all mixin methods to the component instance. This is also
|
|
672
|
-
* necessary because getScrollResponder() is a public method that returns
|
|
673
|
-
* an object that can be used to execute all scrollResponder methods.
|
|
674
|
-
* Since the object returned from that method is the ScrollView instance,
|
|
675
|
-
* we need to bind all mixin methods to the ScrollView instance.
|
|
676
|
-
*/
|
|
677
|
-
for (const key in ScrollResponder.Mixin) {
|
|
678
|
-
if (
|
|
679
|
-
typeof ScrollResponder.Mixin[key] === 'function' &&
|
|
680
|
-
key.startsWith('scrollResponder')
|
|
681
|
-
) {
|
|
682
|
-
// $FlowFixMe - dynamically adding properties to a class
|
|
683
|
-
(this: any)[key] = ScrollResponder.Mixin[key].bind(this);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Part 3: Removing ScrollResponder.Mixin
|
|
689
|
-
*
|
|
690
|
-
* 4. Mixins can initialize properties and use properties on the component
|
|
691
|
-
* instance.
|
|
692
|
-
*/
|
|
693
|
-
Object.keys(ScrollResponder.Mixin)
|
|
694
|
-
.filter(key => typeof ScrollResponder.Mixin[key] !== 'function')
|
|
695
|
-
.forEach(key => {
|
|
696
|
-
// $FlowFixMe - dynamically adding properties to a class
|
|
697
|
-
(this: any)[key] = ScrollResponder.Mixin[key];
|
|
698
|
-
});
|
|
712
|
+
this._scrollAnimatedValue = new AnimatedImplementation.Value(
|
|
713
|
+
this.props.contentOffset?.y ?? 0,
|
|
714
|
+
);
|
|
715
|
+
this._scrollAnimatedValue.setOffset(this.props.contentInset?.top ?? 0);
|
|
699
716
|
}
|
|
700
717
|
|
|
701
|
-
_scrollAnimatedValue: AnimatedImplementation.Value
|
|
702
|
-
0,
|
|
703
|
-
);
|
|
718
|
+
_scrollAnimatedValue: AnimatedImplementation.Value;
|
|
704
719
|
_scrollAnimatedValueAttachment: ?{detach: () => void, ...} = null;
|
|
705
|
-
_stickyHeaderRefs: Map<
|
|
706
|
-
|
|
707
|
-
React.ElementRef<StickyHeaderComponentType>,
|
|
708
|
-
> = new Map();
|
|
720
|
+
_stickyHeaderRefs: Map<string, React.ElementRef<StickyHeaderComponentType>> =
|
|
721
|
+
new Map();
|
|
709
722
|
_headerLayoutYs: Map<string, number> = new Map();
|
|
710
723
|
|
|
724
|
+
_keyboardMetrics: ?KeyboardMetrics = null;
|
|
725
|
+
_additionalScrollOffset: number = 0;
|
|
726
|
+
_isTouching: boolean = false;
|
|
727
|
+
_lastMomentumScrollBeginTime: number = 0;
|
|
728
|
+
_lastMomentumScrollEndTime: number = 0;
|
|
729
|
+
|
|
730
|
+
// Reset to false every time becomes responder. This is used to:
|
|
731
|
+
// - Determine if the scroll view has been scrolled and therefore should
|
|
732
|
+
// refuse to give up its responder lock.
|
|
733
|
+
// - Determine if releasing should dismiss the keyboard when we are in
|
|
734
|
+
// tap-to-dismiss mode (this.props.keyboardShouldPersistTaps !== 'always').
|
|
735
|
+
_observedScrollSinceBecomingResponder: boolean = false;
|
|
736
|
+
_becameResponderWhileAnimating: boolean = false;
|
|
737
|
+
_preventNegativeScrollOffset: ?boolean = null;
|
|
738
|
+
|
|
739
|
+
_animated: ?boolean = null;
|
|
740
|
+
|
|
741
|
+
_subscriptionKeyboardWillShow: ?EventSubscription = null;
|
|
742
|
+
_subscriptionKeyboardWillHide: ?EventSubscription = null;
|
|
743
|
+
_subscriptionKeyboardDidShow: ?EventSubscription = null;
|
|
744
|
+
_subscriptionKeyboardDidHide: ?EventSubscription = null;
|
|
745
|
+
|
|
746
|
+
#onScrollEmitter: ?EventEmitter<{
|
|
747
|
+
scroll: [{x: number, y: number}],
|
|
748
|
+
}> = null;
|
|
749
|
+
|
|
711
750
|
state: State = {
|
|
712
751
|
layoutHeight: null,
|
|
713
|
-
...ScrollResponder.Mixin.scrollResponderMixinGetInitialState(),
|
|
714
752
|
};
|
|
715
753
|
|
|
716
|
-
|
|
717
|
-
this.
|
|
718
|
-
|
|
719
|
-
|
|
754
|
+
componentDidMount() {
|
|
755
|
+
if (typeof this.props.keyboardShouldPersistTaps === 'boolean') {
|
|
756
|
+
console.warn(
|
|
757
|
+
`'keyboardShouldPersistTaps={${
|
|
758
|
+
this.props.keyboardShouldPersistTaps === true ? 'true' : 'false'
|
|
759
|
+
}}' is deprecated. ` +
|
|
760
|
+
`Use 'keyboardShouldPersistTaps="${
|
|
761
|
+
this.props.keyboardShouldPersistTaps ? 'always' : 'never'
|
|
762
|
+
}"' instead`,
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
this._keyboardMetrics = Keyboard.metrics();
|
|
767
|
+
this._additionalScrollOffset = 0;
|
|
768
|
+
|
|
769
|
+
this._subscriptionKeyboardWillShow = Keyboard.addListener(
|
|
770
|
+
'keyboardWillShow',
|
|
771
|
+
this.scrollResponderKeyboardWillShow,
|
|
772
|
+
);
|
|
773
|
+
this._subscriptionKeyboardWillHide = Keyboard.addListener(
|
|
774
|
+
'keyboardWillHide',
|
|
775
|
+
this.scrollResponderKeyboardWillHide,
|
|
720
776
|
);
|
|
721
|
-
this.
|
|
722
|
-
|
|
777
|
+
this._subscriptionKeyboardDidShow = Keyboard.addListener(
|
|
778
|
+
'keyboardDidShow',
|
|
779
|
+
this.scrollResponderKeyboardDidShow,
|
|
723
780
|
);
|
|
724
|
-
this.
|
|
725
|
-
|
|
781
|
+
this._subscriptionKeyboardDidHide = Keyboard.addListener(
|
|
782
|
+
'keyboardDidHide',
|
|
783
|
+
this.scrollResponderKeyboardDidHide,
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
this._updateAnimatedNodeAttachment();
|
|
726
787
|
}
|
|
727
788
|
|
|
728
|
-
|
|
729
|
-
const
|
|
730
|
-
?
|
|
789
|
+
componentDidUpdate(prevProps: Props) {
|
|
790
|
+
const prevContentInsetTop = prevProps.contentInset
|
|
791
|
+
? prevProps.contentInset.top
|
|
731
792
|
: 0;
|
|
732
|
-
const
|
|
733
|
-
?
|
|
793
|
+
const newContentInsetTop = this.props.contentInset
|
|
794
|
+
? this.props.contentInset.top
|
|
734
795
|
: 0;
|
|
735
|
-
if (
|
|
736
|
-
this._scrollAnimatedValue.setOffset(
|
|
796
|
+
if (prevContentInsetTop !== newContentInsetTop) {
|
|
797
|
+
this._scrollAnimatedValue.setOffset(newContentInsetTop || 0);
|
|
737
798
|
}
|
|
738
|
-
}
|
|
739
799
|
|
|
740
|
-
componentDidMount() {
|
|
741
|
-
this._updateAnimatedNodeAttachment();
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
componentDidUpdate() {
|
|
745
800
|
this._updateAnimatedNodeAttachment();
|
|
746
801
|
}
|
|
747
802
|
|
|
748
803
|
componentWillUnmount() {
|
|
749
|
-
this.
|
|
804
|
+
if (this._subscriptionKeyboardWillShow != null) {
|
|
805
|
+
this._subscriptionKeyboardWillShow.remove();
|
|
806
|
+
}
|
|
807
|
+
if (this._subscriptionKeyboardWillHide != null) {
|
|
808
|
+
this._subscriptionKeyboardWillHide.remove();
|
|
809
|
+
}
|
|
810
|
+
if (this._subscriptionKeyboardDidShow != null) {
|
|
811
|
+
this._subscriptionKeyboardDidShow.remove();
|
|
812
|
+
}
|
|
813
|
+
if (this._subscriptionKeyboardDidHide != null) {
|
|
814
|
+
this._subscriptionKeyboardDidHide.remove();
|
|
815
|
+
}
|
|
816
|
+
|
|
750
817
|
if (this._scrollAnimatedValueAttachment) {
|
|
751
818
|
this._scrollAnimatedValueAttachment.detach();
|
|
752
819
|
}
|
|
753
|
-
}
|
|
754
820
|
|
|
755
|
-
|
|
756
|
-
this._scrollViewRef && this._scrollViewRef.setNativeProps(props);
|
|
821
|
+
this.#onScrollEmitter?.removeAllListeners();
|
|
757
822
|
}
|
|
758
823
|
|
|
759
824
|
/**
|
|
@@ -762,34 +827,27 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
762
827
|
* implement this method so that they can be composed while providing access
|
|
763
828
|
* to the underlying scroll responder's methods.
|
|
764
829
|
*/
|
|
765
|
-
getScrollResponder()
|
|
766
|
-
// $FlowFixMe
|
|
830
|
+
getScrollResponder: () => ScrollResponderType = () => {
|
|
831
|
+
// $FlowFixMe[unclear-type]
|
|
767
832
|
return ((this: any): ScrollResponderType);
|
|
768
|
-
}
|
|
833
|
+
};
|
|
769
834
|
|
|
770
|
-
getScrollableNode()
|
|
771
|
-
return
|
|
772
|
-
}
|
|
835
|
+
getScrollableNode: () => ?number = () => {
|
|
836
|
+
return findNodeHandle(this.getNativeScrollRef());
|
|
837
|
+
};
|
|
773
838
|
|
|
774
|
-
getInnerViewNode()
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
'Use <ScrollView innerViewRef={myRef} /> instead.',
|
|
778
|
-
);
|
|
779
|
-
return ReactNative.findNodeHandle(this._innerViewRef);
|
|
780
|
-
}
|
|
839
|
+
getInnerViewNode: () => ?number = () => {
|
|
840
|
+
return findNodeHandle(this._innerView.nativeInstance);
|
|
841
|
+
};
|
|
781
842
|
|
|
782
|
-
getInnerViewRef()
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
'Use <ScrollView innerViewRef={myRef} /> instead.',
|
|
786
|
-
);
|
|
787
|
-
return this._innerViewRef;
|
|
788
|
-
}
|
|
843
|
+
getInnerViewRef: () => InnerViewInstance | null = () => {
|
|
844
|
+
return this._innerView.nativeInstance;
|
|
845
|
+
};
|
|
789
846
|
|
|
790
|
-
getNativeScrollRef()
|
|
791
|
-
|
|
792
|
-
|
|
847
|
+
getNativeScrollRef: () => TScrollViewNativeComponentInstance | null = () => {
|
|
848
|
+
const {nativeInstance} = this._scrollView;
|
|
849
|
+
return nativeInstance == null ? null : nativeInstance.componentRef.current;
|
|
850
|
+
};
|
|
793
851
|
|
|
794
852
|
/**
|
|
795
853
|
* Scrolls to a given x, y offset, either immediately or with a smooth animation.
|
|
@@ -802,7 +860,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
802
860
|
* the function also accepts separate arguments as an alternative to the options object.
|
|
803
861
|
* This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
|
|
804
862
|
*/
|
|
805
|
-
scrollTo(
|
|
863
|
+
scrollTo: (
|
|
806
864
|
options?:
|
|
807
865
|
| {
|
|
808
866
|
x?: number,
|
|
@@ -813,7 +871,18 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
813
871
|
| number,
|
|
814
872
|
deprecatedX?: number,
|
|
815
873
|
deprecatedAnimated?: boolean,
|
|
816
|
-
)
|
|
874
|
+
) => void = (
|
|
875
|
+
options?:
|
|
876
|
+
| {
|
|
877
|
+
x?: number,
|
|
878
|
+
y?: number,
|
|
879
|
+
animated?: boolean,
|
|
880
|
+
...
|
|
881
|
+
}
|
|
882
|
+
| number,
|
|
883
|
+
deprecatedX?: number,
|
|
884
|
+
deprecatedAnimated?: boolean,
|
|
885
|
+
) => {
|
|
817
886
|
let x, y, animated;
|
|
818
887
|
if (typeof options === 'number') {
|
|
819
888
|
console.warn(
|
|
@@ -828,12 +897,12 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
828
897
|
x = options.x;
|
|
829
898
|
animated = options.animated;
|
|
830
899
|
}
|
|
831
|
-
this.
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
900
|
+
const component = this.getNativeScrollRef();
|
|
901
|
+
if (component == null) {
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
Commands.scrollTo(component, x || 0, y || 0, animated !== false);
|
|
905
|
+
};
|
|
837
906
|
|
|
838
907
|
/**
|
|
839
908
|
* If this is a vertical ScrollView scrolls to the bottom.
|
|
@@ -843,24 +912,187 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
843
912
|
* `scrollToEnd({animated: false})` for immediate scrolling.
|
|
844
913
|
* If no options are passed, `animated` defaults to true.
|
|
845
914
|
*/
|
|
846
|
-
scrollToEnd(options?: ?{animated?: boolean, ...})
|
|
915
|
+
scrollToEnd: (options?: ?{animated?: boolean, ...}) => void = (
|
|
916
|
+
options?: ?{animated?: boolean, ...},
|
|
917
|
+
) => {
|
|
847
918
|
// Default to true
|
|
848
919
|
const animated = (options && options.animated) !== false;
|
|
849
|
-
this.
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
920
|
+
const component = this.getNativeScrollRef();
|
|
921
|
+
if (component == null) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
Commands.scrollToEnd(component, animated);
|
|
925
|
+
};
|
|
853
926
|
|
|
854
927
|
/**
|
|
855
928
|
* Displays the scroll indicators momentarily.
|
|
856
929
|
*
|
|
857
930
|
* @platform ios
|
|
858
931
|
*/
|
|
859
|
-
flashScrollIndicators() {
|
|
860
|
-
this.
|
|
932
|
+
flashScrollIndicators: () => void = () => {
|
|
933
|
+
const component = this.getNativeScrollRef();
|
|
934
|
+
if (component == null) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
Commands.flashScrollIndicators(component);
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
_subscribeToOnScroll: (
|
|
941
|
+
callback: ({x: number, y: number}) => void,
|
|
942
|
+
) => EventSubscription = callback => {
|
|
943
|
+
let onScrollEmitter = this.#onScrollEmitter;
|
|
944
|
+
if (onScrollEmitter == null) {
|
|
945
|
+
onScrollEmitter = new EventEmitter();
|
|
946
|
+
this.#onScrollEmitter = onScrollEmitter;
|
|
947
|
+
// This is the first subscription, so make sure the native component is
|
|
948
|
+
// also configured to output synchronous scroll events.
|
|
949
|
+
this._scrollView.nativeInstance?.unstable_setEnableSyncOnScroll(true);
|
|
950
|
+
}
|
|
951
|
+
return onScrollEmitter.addListener('scroll', callback);
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* This method should be used as the callback to onFocus in a TextInputs'
|
|
956
|
+
* parent view. Note that any module using this mixin needs to return
|
|
957
|
+
* the parent view's ref in getScrollViewRef() in order to use this method.
|
|
958
|
+
* @param {number} nodeHandle The TextInput node handle
|
|
959
|
+
* @param {number} additionalOffset The scroll view's bottom "contentInset".
|
|
960
|
+
* Default is 0.
|
|
961
|
+
* @param {bool} preventNegativeScrolling Whether to allow pulling the content
|
|
962
|
+
* down to make it meet the keyboard's top. Default is false.
|
|
963
|
+
*/
|
|
964
|
+
scrollResponderScrollNativeHandleToKeyboard: (
|
|
965
|
+
nodeHandle: number | HostInstance,
|
|
966
|
+
additionalOffset?: number,
|
|
967
|
+
preventNegativeScrollOffset?: boolean,
|
|
968
|
+
) => void = (
|
|
969
|
+
nodeHandle: number | HostInstance,
|
|
970
|
+
additionalOffset?: number,
|
|
971
|
+
preventNegativeScrollOffset?: boolean,
|
|
972
|
+
) => {
|
|
973
|
+
this._additionalScrollOffset = additionalOffset || 0;
|
|
974
|
+
this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
|
|
975
|
+
|
|
976
|
+
if (this._innerView.nativeInstance == null) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
if (typeof nodeHandle === 'number') {
|
|
981
|
+
UIManager.measureLayout(
|
|
982
|
+
nodeHandle,
|
|
983
|
+
nullthrows(findNodeHandle(this)),
|
|
984
|
+
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
985
|
+
this._textInputFocusError,
|
|
986
|
+
this._inputMeasureAndScrollToKeyboard,
|
|
987
|
+
);
|
|
988
|
+
} else {
|
|
989
|
+
nodeHandle.measureLayout(
|
|
990
|
+
this._innerView.nativeInstance,
|
|
991
|
+
this._inputMeasureAndScrollToKeyboard,
|
|
992
|
+
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
993
|
+
this._textInputFocusError,
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* A helper function to zoom to a specific rect in the scrollview. The argument has the shape
|
|
1000
|
+
* {x: number; y: number; width: number; height: number; animated: boolean = true}
|
|
1001
|
+
*
|
|
1002
|
+
* @platform ios
|
|
1003
|
+
*/
|
|
1004
|
+
scrollResponderZoomTo: (
|
|
1005
|
+
rect: {|
|
|
1006
|
+
x: number,
|
|
1007
|
+
y: number,
|
|
1008
|
+
width: number,
|
|
1009
|
+
height: number,
|
|
1010
|
+
animated?: boolean,
|
|
1011
|
+
|},
|
|
1012
|
+
animated?: boolean, // deprecated, put this inside the rect argument instead
|
|
1013
|
+
) => void = (
|
|
1014
|
+
rect: {|
|
|
1015
|
+
x: number,
|
|
1016
|
+
y: number,
|
|
1017
|
+
width: number,
|
|
1018
|
+
height: number,
|
|
1019
|
+
animated?: boolean,
|
|
1020
|
+
|},
|
|
1021
|
+
animated?: boolean, // deprecated, put this inside the rect argument instead
|
|
1022
|
+
) => {
|
|
1023
|
+
invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
|
|
1024
|
+
if ('animated' in rect) {
|
|
1025
|
+
this._animated = rect.animated;
|
|
1026
|
+
delete rect.animated;
|
|
1027
|
+
} else if (typeof animated !== 'undefined') {
|
|
1028
|
+
console.warn(
|
|
1029
|
+
'`scrollResponderZoomTo` `animated` argument is deprecated. Use `options.animated` instead',
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
const component = this.getNativeScrollRef();
|
|
1034
|
+
if (component == null) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
Commands.zoomToRect(component, rect, animated !== false);
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
_textInputFocusError() {
|
|
1041
|
+
console.warn('Error measuring text field.');
|
|
861
1042
|
}
|
|
862
1043
|
|
|
863
|
-
|
|
1044
|
+
/**
|
|
1045
|
+
* The calculations performed here assume the scroll view takes up the entire
|
|
1046
|
+
* screen - even if has some content inset. We then measure the offsets of the
|
|
1047
|
+
* keyboard, and compensate both for the scroll view's "contentInset".
|
|
1048
|
+
*
|
|
1049
|
+
* @param {number} left Position of input w.r.t. table view.
|
|
1050
|
+
* @param {number} top Position of input w.r.t. table view.
|
|
1051
|
+
* @param {number} width Width of the text input.
|
|
1052
|
+
* @param {number} height Height of the text input.
|
|
1053
|
+
*/
|
|
1054
|
+
_inputMeasureAndScrollToKeyboard: (
|
|
1055
|
+
left: number,
|
|
1056
|
+
top: number,
|
|
1057
|
+
width: number,
|
|
1058
|
+
height: number,
|
|
1059
|
+
) => void = (left: number, top: number, width: number, height: number) => {
|
|
1060
|
+
let keyboardScreenY = Dimensions.get('window').height;
|
|
1061
|
+
|
|
1062
|
+
const scrollTextInputIntoVisibleRect = () => {
|
|
1063
|
+
if (this._keyboardMetrics != null) {
|
|
1064
|
+
keyboardScreenY = this._keyboardMetrics.screenY;
|
|
1065
|
+
}
|
|
1066
|
+
let scrollOffsetY =
|
|
1067
|
+
top - keyboardScreenY + height + this._additionalScrollOffset;
|
|
1068
|
+
|
|
1069
|
+
// By default, this can scroll with negative offset, pulling the content
|
|
1070
|
+
// down so that the target component's bottom meets the keyboard's top.
|
|
1071
|
+
// If requested otherwise, cap the offset at 0 minimum to avoid content
|
|
1072
|
+
// shifting down.
|
|
1073
|
+
if (this._preventNegativeScrollOffset === true) {
|
|
1074
|
+
scrollOffsetY = Math.max(0, scrollOffsetY);
|
|
1075
|
+
}
|
|
1076
|
+
this.scrollTo({x: 0, y: scrollOffsetY, animated: true});
|
|
1077
|
+
|
|
1078
|
+
this._additionalScrollOffset = 0;
|
|
1079
|
+
this._preventNegativeScrollOffset = false;
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
if (this._keyboardMetrics == null) {
|
|
1083
|
+
// `_keyboardMetrics` is set inside `scrollResponderKeyboardWillShow` which
|
|
1084
|
+
// is not guaranteed to be called before `_inputMeasureAndScrollToKeyboard` but native has already scheduled it.
|
|
1085
|
+
// In case it was not called before `_inputMeasureAndScrollToKeyboard`, we postpone scrolling to
|
|
1086
|
+
// text input.
|
|
1087
|
+
setTimeout(() => {
|
|
1088
|
+
scrollTextInputIntoVisibleRect();
|
|
1089
|
+
}, 0);
|
|
1090
|
+
} else {
|
|
1091
|
+
scrollTextInputIntoVisibleRect();
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
_getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe): $FlowFixMe {
|
|
864
1096
|
const child = childArray[index];
|
|
865
1097
|
return child && child.key;
|
|
866
1098
|
}
|
|
@@ -873,11 +1105,12 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
873
1105
|
this.props.stickyHeaderIndices &&
|
|
874
1106
|
this.props.stickyHeaderIndices.length > 0
|
|
875
1107
|
) {
|
|
876
|
-
this._scrollAnimatedValueAttachment =
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1108
|
+
this._scrollAnimatedValueAttachment =
|
|
1109
|
+
AnimatedImplementation.attachNativeEvent(
|
|
1110
|
+
this.getNativeScrollRef(),
|
|
1111
|
+
'onScroll',
|
|
1112
|
+
[{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}],
|
|
1113
|
+
);
|
|
881
1114
|
}
|
|
882
1115
|
}
|
|
883
1116
|
|
|
@@ -892,12 +1125,12 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
892
1125
|
}
|
|
893
1126
|
}
|
|
894
1127
|
|
|
895
|
-
_onStickyHeaderLayout(index, event, key) {
|
|
1128
|
+
_onStickyHeaderLayout(index: $FlowFixMe, event: $FlowFixMe, key: $FlowFixMe) {
|
|
896
1129
|
const {stickyHeaderIndices} = this.props;
|
|
897
1130
|
if (!stickyHeaderIndices) {
|
|
898
1131
|
return;
|
|
899
1132
|
}
|
|
900
|
-
const childArray = React.Children.toArray(this.props.children);
|
|
1133
|
+
const childArray = React.Children.toArray<$FlowFixMe>(this.props.children);
|
|
901
1134
|
if (key !== this._getKeyForIndex(index, childArray)) {
|
|
902
1135
|
// ignore stale layout update
|
|
903
1136
|
return;
|
|
@@ -919,30 +1152,13 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
919
1152
|
}
|
|
920
1153
|
|
|
921
1154
|
_handleScroll = (e: ScrollEvent) => {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
'You specified `onScroll` on a <ScrollView> but not ' +
|
|
930
|
-
'`scrollEventThrottle`. You will only receive one event. ' +
|
|
931
|
-
'Using `16` you get all the events but be aware that it may ' +
|
|
932
|
-
"cause frame drops, use a bigger number if you don't need as " +
|
|
933
|
-
'much precision.',
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
if (Platform.OS === 'android') {
|
|
938
|
-
if (
|
|
939
|
-
this.props.keyboardDismissMode === 'on-drag' &&
|
|
940
|
-
this.state.isTouching
|
|
941
|
-
) {
|
|
942
|
-
dismissKeyboard();
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
this._scrollResponder.scrollResponderHandleScroll(e);
|
|
1155
|
+
this._observedScrollSinceBecomingResponder = true;
|
|
1156
|
+
this.props.onScroll && this.props.onScroll(e);
|
|
1157
|
+
|
|
1158
|
+
this.#onScrollEmitter?.emit('scroll', {
|
|
1159
|
+
x: e.nativeEvent.contentOffset.x,
|
|
1160
|
+
y: e.nativeEvent.contentOffset.y,
|
|
1161
|
+
});
|
|
946
1162
|
};
|
|
947
1163
|
|
|
948
1164
|
_handleLayout = (e: LayoutEvent) => {
|
|
@@ -960,52 +1176,498 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
960
1176
|
this.props.onContentSizeChange(width, height);
|
|
961
1177
|
};
|
|
962
1178
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1179
|
+
_innerView: RefForwarder<InnerViewInstance, InnerViewInstance> =
|
|
1180
|
+
createRefForwarder(
|
|
1181
|
+
(instance: InnerViewInstance): InnerViewInstance => instance,
|
|
1182
|
+
);
|
|
1183
|
+
|
|
1184
|
+
_scrollView: RefForwarder<
|
|
1185
|
+
TScrollViewNativeImperativeHandle,
|
|
1186
|
+
PublicScrollViewInstance | null,
|
|
1187
|
+
> = createRefForwarder(nativeImperativeHandle => {
|
|
1188
|
+
const nativeInstance = nativeImperativeHandle.componentRef.current;
|
|
1189
|
+
if (nativeInstance == null) {
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// This is a hack. Ideally we would forwardRef to the underlying
|
|
1194
|
+
// host component. However, since ScrollView has it's own methods that can be
|
|
1195
|
+
// called as well, if we used the standard forwardRef then these
|
|
1196
|
+
// methods wouldn't be accessible and thus be a breaking change.
|
|
1197
|
+
//
|
|
1198
|
+
// Therefore we edit ref to include ScrollView's public methods so that
|
|
1199
|
+
// they are callable from the ref.
|
|
1200
|
+
|
|
1201
|
+
// $FlowFixMe[prop-missing] - Known issue with appending custom methods.
|
|
1202
|
+
const publicInstance: PublicScrollViewInstance = Object.assign(
|
|
1203
|
+
nativeInstance,
|
|
1204
|
+
{
|
|
1205
|
+
getScrollResponder: this.getScrollResponder,
|
|
1206
|
+
getScrollableNode: this.getScrollableNode,
|
|
1207
|
+
getInnerViewNode: this.getInnerViewNode,
|
|
1208
|
+
getInnerViewRef: this.getInnerViewRef,
|
|
1209
|
+
getNativeScrollRef: this.getNativeScrollRef,
|
|
1210
|
+
scrollTo: this.scrollTo,
|
|
1211
|
+
scrollToEnd: this.scrollToEnd,
|
|
1212
|
+
flashScrollIndicators: this.flashScrollIndicators,
|
|
1213
|
+
scrollResponderZoomTo: this.scrollResponderZoomTo,
|
|
1214
|
+
// TODO: Replace unstable_subscribeToOnScroll once scrollView.addEventListener('scroll', (e: ScrollEvent) => {}, {passive: false});
|
|
1215
|
+
unstable_subscribeToOnScroll: this._subscribeToOnScroll,
|
|
1216
|
+
scrollResponderScrollNativeHandleToKeyboard:
|
|
1217
|
+
this.scrollResponderScrollNativeHandleToKeyboard,
|
|
1218
|
+
},
|
|
1219
|
+
);
|
|
967
1220
|
|
|
968
|
-
|
|
969
|
-
_setInnerViewRef = setAndForwardRef({
|
|
970
|
-
getForwardedRef: () => this.props.innerViewRef,
|
|
971
|
-
setLocalRef: ref => {
|
|
972
|
-
this._innerViewRef = ref;
|
|
973
|
-
},
|
|
1221
|
+
return publicInstance;
|
|
974
1222
|
});
|
|
975
1223
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1224
|
+
/**
|
|
1225
|
+
* Warning, this may be called several times for a single keyboard opening.
|
|
1226
|
+
* It's best to store the information in this method and then take any action
|
|
1227
|
+
* at a later point (either in `keyboardDidShow` or other).
|
|
1228
|
+
*
|
|
1229
|
+
* Here's the order that events occur in:
|
|
1230
|
+
* - focus
|
|
1231
|
+
* - willShow {startCoordinates, endCoordinates} several times
|
|
1232
|
+
* - didShow several times
|
|
1233
|
+
* - blur
|
|
1234
|
+
* - willHide {startCoordinates, endCoordinates} several times
|
|
1235
|
+
* - didHide several times
|
|
1236
|
+
*
|
|
1237
|
+
* The `ScrollResponder` module callbacks for each of these events.
|
|
1238
|
+
* Even though any user could have easily listened to keyboard events
|
|
1239
|
+
* themselves, using these `props` callbacks ensures that ordering of events
|
|
1240
|
+
* is consistent - and not dependent on the order that the keyboard events are
|
|
1241
|
+
* subscribed to. This matters when telling the scroll view to scroll to where
|
|
1242
|
+
* the keyboard is headed - the scroll responder better have been notified of
|
|
1243
|
+
* the keyboard destination before being instructed to scroll to where the
|
|
1244
|
+
* keyboard will be. Stick to the `ScrollResponder` callbacks, and everything
|
|
1245
|
+
* will work.
|
|
1246
|
+
*
|
|
1247
|
+
* WARNING: These callbacks will fire even if a keyboard is displayed in a
|
|
1248
|
+
* different navigation pane. Filter out the events to determine if they are
|
|
1249
|
+
* relevant to you. (For example, only if you receive these callbacks after
|
|
1250
|
+
* you had explicitly focused a node etc).
|
|
1251
|
+
*/
|
|
1252
|
+
|
|
1253
|
+
scrollResponderKeyboardWillShow: (e: KeyboardEvent) => void = (
|
|
1254
|
+
e: KeyboardEvent,
|
|
1255
|
+
) => {
|
|
1256
|
+
this._keyboardMetrics = e.endCoordinates;
|
|
1257
|
+
this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e);
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
scrollResponderKeyboardWillHide: (e: KeyboardEvent) => void = (
|
|
1261
|
+
e: KeyboardEvent,
|
|
1262
|
+
) => {
|
|
1263
|
+
this._keyboardMetrics = null;
|
|
1264
|
+
this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e);
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
scrollResponderKeyboardDidShow: (e: KeyboardEvent) => void = (
|
|
1268
|
+
e: KeyboardEvent,
|
|
1269
|
+
) => {
|
|
1270
|
+
this._keyboardMetrics = e.endCoordinates;
|
|
1271
|
+
this.props.onKeyboardDidShow && this.props.onKeyboardDidShow(e);
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
scrollResponderKeyboardDidHide: (e: KeyboardEvent) => void = (
|
|
1275
|
+
e: KeyboardEvent,
|
|
1276
|
+
) => {
|
|
1277
|
+
this._keyboardMetrics = null;
|
|
1278
|
+
this.props.onKeyboardDidHide && this.props.onKeyboardDidHide(e);
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* Invoke this from an `onMomentumScrollBegin` event.
|
|
1283
|
+
*/
|
|
1284
|
+
_handleMomentumScrollBegin: (e: ScrollEvent) => void = (e: ScrollEvent) => {
|
|
1285
|
+
this._lastMomentumScrollBeginTime = global.performance.now();
|
|
1286
|
+
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* Invoke this from an `onMomentumScrollEnd` event.
|
|
1291
|
+
*/
|
|
1292
|
+
_handleMomentumScrollEnd: (e: ScrollEvent) => void = (e: ScrollEvent) => {
|
|
1293
|
+
FrameRateLogger.endScroll();
|
|
1294
|
+
this._lastMomentumScrollEndTime = global.performance.now();
|
|
1295
|
+
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Unfortunately, `onScrollBeginDrag` also fires when *stopping* the scroll
|
|
1300
|
+
* animation, and there's not an easy way to distinguish a drag vs. stopping
|
|
1301
|
+
* momentum.
|
|
1302
|
+
*
|
|
1303
|
+
* Invoke this from an `onScrollBeginDrag` event.
|
|
1304
|
+
*/
|
|
1305
|
+
_handleScrollBeginDrag: (e: ScrollEvent) => void = (e: ScrollEvent) => {
|
|
1306
|
+
FrameRateLogger.beginScroll(); // TODO: track all scrolls after implementing onScrollEndAnimation
|
|
1307
|
+
|
|
1308
|
+
if (
|
|
1309
|
+
Platform.OS === 'android' &&
|
|
1310
|
+
this.props.keyboardDismissMode === 'on-drag'
|
|
1311
|
+
) {
|
|
1312
|
+
dismissKeyboard();
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Invoke this from an `onScrollEndDrag` event.
|
|
1320
|
+
*/
|
|
1321
|
+
_handleScrollEndDrag: (e: ScrollEvent) => void = (e: ScrollEvent) => {
|
|
1322
|
+
const {velocity} = e.nativeEvent;
|
|
1323
|
+
// - If we are animating, then this is a "drag" that is stopping the scrollview and momentum end
|
|
1324
|
+
// will fire.
|
|
1325
|
+
// - If velocity is non-zero, then the interaction will stop when momentum scroll ends or
|
|
1326
|
+
// another drag starts and ends.
|
|
1327
|
+
// - If we don't get velocity, better to stop the interaction twice than not stop it.
|
|
1328
|
+
if (
|
|
1329
|
+
!this._isAnimating() &&
|
|
1330
|
+
(!velocity || (velocity.x === 0 && velocity.y === 0))
|
|
1331
|
+
) {
|
|
1332
|
+
FrameRateLogger.endScroll();
|
|
1333
|
+
}
|
|
1334
|
+
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* A helper function for this class that lets us quickly determine if the
|
|
1339
|
+
* view is currently animating. This is particularly useful to know when
|
|
1340
|
+
* a touch has just started or ended.
|
|
1341
|
+
*/
|
|
1342
|
+
_isAnimating: () => boolean = () => {
|
|
1343
|
+
const now = global.performance.now();
|
|
1344
|
+
const timeSinceLastMomentumScrollEnd =
|
|
1345
|
+
now - this._lastMomentumScrollEndTime;
|
|
1346
|
+
const isAnimating =
|
|
1347
|
+
timeSinceLastMomentumScrollEnd < IS_ANIMATING_TOUCH_START_THRESHOLD_MS ||
|
|
1348
|
+
this._lastMomentumScrollEndTime < this._lastMomentumScrollBeginTime;
|
|
1349
|
+
return isAnimating;
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Invoke this from an `onResponderGrant` event.
|
|
1354
|
+
*/
|
|
1355
|
+
_handleResponderGrant: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1356
|
+
this._observedScrollSinceBecomingResponder = false;
|
|
1357
|
+
this.props.onResponderGrant && this.props.onResponderGrant(e);
|
|
1358
|
+
this._becameResponderWhileAnimating = this._isAnimating();
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Invoke this from an `onResponderReject` event.
|
|
1363
|
+
*
|
|
1364
|
+
* Some other element is not yielding its role as responder. Normally, we'd
|
|
1365
|
+
* just disable the `UIScrollView`, but a touch has already began on it, the
|
|
1366
|
+
* `UIScrollView` will not accept being disabled after that. The easiest
|
|
1367
|
+
* solution for now is to accept the limitation of disallowing this
|
|
1368
|
+
* altogether. To improve this, find a way to disable the `UIScrollView` after
|
|
1369
|
+
* a touch has already started.
|
|
1370
|
+
*/
|
|
1371
|
+
_handleResponderReject: () => void = () => {};
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Invoke this from an `onResponderRelease` event.
|
|
1375
|
+
*/
|
|
1376
|
+
_handleResponderRelease: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1377
|
+
this._isTouching = e.nativeEvent.touches.length !== 0;
|
|
1378
|
+
this.props.onResponderRelease && this.props.onResponderRelease(e);
|
|
1379
|
+
|
|
1380
|
+
if (typeof e.target === 'number') {
|
|
1381
|
+
if (__DEV__) {
|
|
1382
|
+
console.error(
|
|
1383
|
+
'Did not expect event target to be a number. Should have been a native component',
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// By default scroll views will unfocus a textField
|
|
1391
|
+
// if another touch occurs outside of it
|
|
1392
|
+
const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
|
|
1393
|
+
if (
|
|
1394
|
+
currentlyFocusedTextInput != null &&
|
|
1395
|
+
this.props.keyboardShouldPersistTaps !== true &&
|
|
1396
|
+
this.props.keyboardShouldPersistTaps !== 'always' &&
|
|
1397
|
+
this._keyboardIsDismissible() &&
|
|
1398
|
+
e.target !== currentlyFocusedTextInput &&
|
|
1399
|
+
!this._observedScrollSinceBecomingResponder &&
|
|
1400
|
+
!this._becameResponderWhileAnimating
|
|
1401
|
+
) {
|
|
1402
|
+
TextInputState.blurTextInput(currentlyFocusedTextInput);
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* We will allow the scroll view to give up its lock iff it acquired the lock
|
|
1408
|
+
* during an animation. This is a very useful default that happens to satisfy
|
|
1409
|
+
* many common user experiences.
|
|
1410
|
+
*
|
|
1411
|
+
* - Stop a scroll on the left edge, then turn that into an outer view's
|
|
1412
|
+
* backswipe.
|
|
1413
|
+
* - Stop a scroll mid-bounce at the top, continue pulling to have the outer
|
|
1414
|
+
* view dismiss.
|
|
1415
|
+
* - However, without catching the scroll view mid-bounce (while it is
|
|
1416
|
+
* motionless), if you drag far enough for the scroll view to become
|
|
1417
|
+
* responder (and therefore drag the scroll view a bit), any backswipe
|
|
1418
|
+
* navigation of a swipe gesture higher in the view hierarchy, should be
|
|
1419
|
+
* rejected.
|
|
1420
|
+
*/
|
|
1421
|
+
_handleResponderTerminationRequest: () => boolean = () => {
|
|
1422
|
+
return !this._observedScrollSinceBecomingResponder;
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* Invoke this from an `onScroll` event.
|
|
1427
|
+
*/
|
|
1428
|
+
_handleScrollShouldSetResponder: () => boolean = () => {
|
|
1429
|
+
// Allow any event touch pass through if the default pan responder is disabled
|
|
1430
|
+
if (this.props.disableScrollViewPanResponder === true) {
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1433
|
+
return this._isTouching;
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
/**
|
|
1437
|
+
* Merely touch starting is not sufficient for a scroll view to become the
|
|
1438
|
+
* responder. Being the "responder" means that the very next touch move/end
|
|
1439
|
+
* event will result in an action/movement.
|
|
1440
|
+
*
|
|
1441
|
+
* Invoke this from an `onStartShouldSetResponder` event.
|
|
1442
|
+
*
|
|
1443
|
+
* `onStartShouldSetResponder` is used when the next move/end will trigger
|
|
1444
|
+
* some UI movement/action, but when you want to yield priority to views
|
|
1445
|
+
* nested inside of the view.
|
|
1446
|
+
*
|
|
1447
|
+
* There may be some cases where scroll views actually should return `true`
|
|
1448
|
+
* from `onStartShouldSetResponder`: Any time we are detecting a standard tap
|
|
1449
|
+
* that gives priority to nested views.
|
|
1450
|
+
*
|
|
1451
|
+
* - If a single tap on the scroll view triggers an action such as
|
|
1452
|
+
* recentering a map style view yet wants to give priority to interaction
|
|
1453
|
+
* views inside (such as dropped pins or labels), then we would return true
|
|
1454
|
+
* from this method when there is a single touch.
|
|
1455
|
+
*
|
|
1456
|
+
* - Similar to the previous case, if a two finger "tap" should trigger a
|
|
1457
|
+
* zoom, we would check the `touches` count, and if `>= 2`, we would return
|
|
1458
|
+
* true.
|
|
1459
|
+
*
|
|
1460
|
+
*/
|
|
1461
|
+
_handleStartShouldSetResponder: (e: PressEvent) => boolean = (
|
|
1462
|
+
e: PressEvent,
|
|
1463
|
+
) => {
|
|
1464
|
+
// Allow any event touch pass through if the default pan responder is disabled
|
|
1465
|
+
if (this.props.disableScrollViewPanResponder === true) {
|
|
1466
|
+
return false;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
const currentlyFocusedInput = TextInputState.currentlyFocusedInput();
|
|
1470
|
+
if (
|
|
1471
|
+
this.props.keyboardShouldPersistTaps === 'handled' &&
|
|
1472
|
+
this._keyboardIsDismissible() &&
|
|
1473
|
+
e.target !== currentlyFocusedInput
|
|
1474
|
+
) {
|
|
1475
|
+
return true;
|
|
1476
|
+
}
|
|
1477
|
+
return false;
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* There are times when the scroll view wants to become the responder
|
|
1482
|
+
* (meaning respond to the next immediate `touchStart/touchEnd`), in a way
|
|
1483
|
+
* that *doesn't* give priority to nested views (hence the capture phase):
|
|
1484
|
+
*
|
|
1485
|
+
* - Currently animating.
|
|
1486
|
+
* - Tapping anywhere that is not a text input, while the keyboard is
|
|
1487
|
+
* up (which should dismiss the keyboard).
|
|
1488
|
+
*
|
|
1489
|
+
* Invoke this from an `onStartShouldSetResponderCapture` event.
|
|
1490
|
+
*/
|
|
1491
|
+
_handleStartShouldSetResponderCapture: (e: PressEvent) => boolean = (
|
|
1492
|
+
e: PressEvent,
|
|
1493
|
+
) => {
|
|
1494
|
+
// The scroll view should receive taps instead of its descendants if:
|
|
1495
|
+
// * it is already animating/decelerating
|
|
1496
|
+
if (this._isAnimating()) {
|
|
1497
|
+
return true;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// Allow any event touch pass through if the default pan responder is disabled
|
|
1501
|
+
if (this.props.disableScrollViewPanResponder === true) {
|
|
1502
|
+
return false;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
// * the keyboard is up, keyboardShouldPersistTaps is 'never' (the default),
|
|
1506
|
+
// and a new touch starts with a non-textinput target (in which case the
|
|
1507
|
+
// first tap should be sent to the scroll view and dismiss the keyboard,
|
|
1508
|
+
// then the second tap goes to the actual interior view)
|
|
1509
|
+
const {keyboardShouldPersistTaps} = this.props;
|
|
1510
|
+
const keyboardNeverPersistTaps =
|
|
1511
|
+
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
|
1512
|
+
|
|
1513
|
+
if (typeof e.target === 'number') {
|
|
1514
|
+
if (__DEV__) {
|
|
1515
|
+
console.error(
|
|
1516
|
+
'Did not expect event target to be a number. Should have been a native component',
|
|
1517
|
+
);
|
|
986
1518
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
ScrollContentContainerViewClass = RCTScrollContentView;
|
|
1519
|
+
|
|
1520
|
+
return false;
|
|
990
1521
|
}
|
|
991
1522
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1523
|
+
// Let presses through if the soft keyboard is detached from the viewport
|
|
1524
|
+
if (this._softKeyboardIsDetached()) {
|
|
1525
|
+
return false;
|
|
1526
|
+
}
|
|
996
1527
|
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1528
|
+
if (
|
|
1529
|
+
keyboardNeverPersistTaps &&
|
|
1530
|
+
this._keyboardIsDismissible() &&
|
|
1531
|
+
e.target != null &&
|
|
1532
|
+
// $FlowFixMe[incompatible-call]
|
|
1533
|
+
!TextInputState.isTextInput(e.target)
|
|
1534
|
+
) {
|
|
1535
|
+
return true;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
return false;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Do we consider there to be a dismissible soft-keyboard open?
|
|
1543
|
+
*/
|
|
1544
|
+
_keyboardIsDismissible: () => boolean = () => {
|
|
1545
|
+
const currentlyFocusedInput = TextInputState.currentlyFocusedInput();
|
|
1546
|
+
|
|
1547
|
+
// We cannot dismiss the keyboard without an input to blur, even if a soft
|
|
1548
|
+
// keyboard is open (e.g. when keyboard is open due to a native component
|
|
1549
|
+
// not participating in TextInputState). It's also possible that the
|
|
1550
|
+
// currently focused input isn't a TextInput (such as by calling ref.focus
|
|
1551
|
+
// on a non-TextInput).
|
|
1552
|
+
const hasFocusedTextInput =
|
|
1553
|
+
currentlyFocusedInput != null &&
|
|
1554
|
+
TextInputState.isTextInput(currentlyFocusedInput);
|
|
1555
|
+
|
|
1556
|
+
// Even if an input is focused, we may not have a keyboard to dismiss. E.g
|
|
1557
|
+
// when using a physical keyboard. Ensure we have an event for an opened
|
|
1558
|
+
// keyboard.
|
|
1559
|
+
const softKeyboardMayBeOpen =
|
|
1560
|
+
this._keyboardMetrics != null || this._keyboardEventsAreUnreliable();
|
|
1561
|
+
|
|
1562
|
+
return hasFocusedTextInput && softKeyboardMayBeOpen;
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* Whether an open soft keyboard is present which does not overlap the
|
|
1567
|
+
* viewport. E.g. for a VR soft-keyboard which is detached from the app
|
|
1568
|
+
* viewport.
|
|
1569
|
+
*/
|
|
1570
|
+
_softKeyboardIsDetached: () => boolean = () => {
|
|
1571
|
+
return this._keyboardMetrics != null && this._keyboardMetrics.height === 0;
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
_keyboardEventsAreUnreliable: () => boolean = () => {
|
|
1575
|
+
// Android versions prior to API 30 rely on observing layout changes when
|
|
1576
|
+
// `android:windowSoftInputMode` is set to `adjustResize` or `adjustPan`.
|
|
1577
|
+
return Platform.OS === 'android' && Platform.Version < 30;
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Invoke this from an `onTouchEnd` event.
|
|
1582
|
+
*
|
|
1583
|
+
* @param {PressEvent} e Event.
|
|
1584
|
+
*/
|
|
1585
|
+
_handleTouchEnd: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1586
|
+
const nativeEvent = e.nativeEvent;
|
|
1587
|
+
this._isTouching = nativeEvent.touches.length !== 0;
|
|
1588
|
+
|
|
1589
|
+
const {keyboardShouldPersistTaps} = this.props;
|
|
1590
|
+
const keyboardNeverPersistsTaps =
|
|
1591
|
+
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
|
1592
|
+
|
|
1593
|
+
// Dismiss the keyboard now if we didn't become responder in capture phase
|
|
1594
|
+
// to eat presses, but still want to dismiss on interaction.
|
|
1595
|
+
// Don't do anything if the target of the touch event is the current input.
|
|
1596
|
+
const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
|
|
1597
|
+
if (
|
|
1598
|
+
currentlyFocusedTextInput != null &&
|
|
1599
|
+
e.target !== currentlyFocusedTextInput &&
|
|
1600
|
+
this._softKeyboardIsDetached() &&
|
|
1601
|
+
this._keyboardIsDismissible() &&
|
|
1602
|
+
keyboardNeverPersistsTaps
|
|
1603
|
+
) {
|
|
1604
|
+
TextInputState.blurTextInput(currentlyFocusedTextInput);
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
this.props.onTouchEnd && this.props.onTouchEnd(e);
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Invoke this from an `onTouchCancel` event.
|
|
1612
|
+
*
|
|
1613
|
+
* @param {PressEvent} e Event.
|
|
1614
|
+
*/
|
|
1615
|
+
_handleTouchCancel: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1616
|
+
this._isTouching = false;
|
|
1617
|
+
this.props.onTouchCancel && this.props.onTouchCancel(e);
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Invoke this from an `onTouchStart` event.
|
|
1622
|
+
*
|
|
1623
|
+
* Since we know that the `SimpleEventPlugin` occurs later in the plugin
|
|
1624
|
+
* order, after `ResponderEventPlugin`, we can detect that we were *not*
|
|
1625
|
+
* permitted to be the responder (presumably because a contained view became
|
|
1626
|
+
* responder). The `onResponderReject` won't fire in that case - it only
|
|
1627
|
+
* fires when a *current* responder rejects our request.
|
|
1628
|
+
*
|
|
1629
|
+
* @param {PressEvent} e Touch Start event.
|
|
1630
|
+
*/
|
|
1631
|
+
_handleTouchStart: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1632
|
+
this._isTouching = true;
|
|
1633
|
+
this.props.onTouchStart && this.props.onTouchStart(e);
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Invoke this from an `onTouchMove` event.
|
|
1638
|
+
*
|
|
1639
|
+
* Since we know that the `SimpleEventPlugin` occurs later in the plugin
|
|
1640
|
+
* order, after `ResponderEventPlugin`, we can detect that we were *not*
|
|
1641
|
+
* permitted to be the responder (presumably because a contained view became
|
|
1642
|
+
* responder). The `onResponderReject` won't fire in that case - it only
|
|
1643
|
+
* fires when a *current* responder rejects our request.
|
|
1644
|
+
*
|
|
1645
|
+
* @param {PressEvent} e Touch Start event.
|
|
1646
|
+
*/
|
|
1647
|
+
_handleTouchMove: (e: PressEvent) => void = (e: PressEvent) => {
|
|
1648
|
+
this.props.onTouchMove && this.props.onTouchMove(e);
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
render(): React.Node {
|
|
1652
|
+
const horizontal = this.props.horizontal === true;
|
|
1653
|
+
|
|
1654
|
+
const NativeScrollView = horizontal
|
|
1655
|
+
? HScrollViewNativeComponent
|
|
1656
|
+
: VScrollViewNativeComponent;
|
|
1657
|
+
|
|
1658
|
+
const NativeScrollContentView = horizontal
|
|
1659
|
+
? HScrollContentViewNativeComponent
|
|
1660
|
+
: VScrollContentViewNativeComponent;
|
|
1001
1661
|
|
|
1002
1662
|
const contentContainerStyle = [
|
|
1003
|
-
|
|
1663
|
+
horizontal && styles.contentContainerHorizontal,
|
|
1004
1664
|
this.props.contentContainerStyle,
|
|
1005
1665
|
];
|
|
1006
1666
|
if (__DEV__ && this.props.style !== undefined) {
|
|
1667
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
1007
1668
|
const style = flattenStyle(this.props.style);
|
|
1008
1669
|
const childLayoutProps = ['alignItems', 'justifyContent'].filter(
|
|
1670
|
+
// $FlowFixMe[incompatible-use]
|
|
1009
1671
|
prop => style && style[prop] !== undefined,
|
|
1010
1672
|
);
|
|
1011
1673
|
invariant(
|
|
@@ -1016,20 +1678,23 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1016
1678
|
);
|
|
1017
1679
|
}
|
|
1018
1680
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1681
|
+
const contentSizeChangeProps =
|
|
1682
|
+
this.props.onContentSizeChange == null
|
|
1683
|
+
? null
|
|
1684
|
+
: {
|
|
1685
|
+
onLayout: this._handleContentOnLayout,
|
|
1686
|
+
};
|
|
1025
1687
|
|
|
1026
1688
|
const {stickyHeaderIndices} = this.props;
|
|
1027
1689
|
let children = this.props.children;
|
|
1690
|
+
/**
|
|
1691
|
+
* This function can cause unnecessary remount when nested in conditionals as it causes remap of children keys.
|
|
1692
|
+
* https://react.dev/reference/react/Children#children-toarray-caveats
|
|
1693
|
+
*/
|
|
1694
|
+
children = React.Children.toArray<$FlowFixMe>(children);
|
|
1028
1695
|
|
|
1029
1696
|
if (stickyHeaderIndices != null && stickyHeaderIndices.length > 0) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
children = childArray.map((child, index) => {
|
|
1697
|
+
children = children.map((child, index) => {
|
|
1033
1698
|
const indexOfIndex = child ? stickyHeaderIndices.indexOf(index) : -1;
|
|
1034
1699
|
if (indexOfIndex > -1) {
|
|
1035
1700
|
const key = child.key;
|
|
@@ -1041,11 +1706,12 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1041
1706
|
key={key}
|
|
1042
1707
|
ref={ref => this._setStickyHeaderRef(key, ref)}
|
|
1043
1708
|
nextHeaderLayoutY={this._headerLayoutYs.get(
|
|
1044
|
-
this._getKeyForIndex(nextIndex,
|
|
1709
|
+
this._getKeyForIndex(nextIndex, children),
|
|
1045
1710
|
)}
|
|
1046
1711
|
onLayout={event => this._onStickyHeaderLayout(index, event, key)}
|
|
1047
1712
|
scrollAnimatedValue={this._scrollAnimatedValue}
|
|
1048
1713
|
inverted={this.props.invertStickyHeaders}
|
|
1714
|
+
hiddenOnScroll={this.props.stickyHeaderHiddenOnScroll}
|
|
1049
1715
|
scrollViewHeight={this.state.layoutHeight}>
|
|
1050
1716
|
{child}
|
|
1051
1717
|
</StickyHeaderComponent>
|
|
@@ -1056,26 +1722,25 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1056
1722
|
});
|
|
1057
1723
|
}
|
|
1058
1724
|
children = (
|
|
1059
|
-
<
|
|
1060
|
-
value={
|
|
1061
|
-
this.props.horizontal === true
|
|
1062
|
-
? standardHorizontalContext
|
|
1063
|
-
: standardVerticalContext
|
|
1064
|
-
}>
|
|
1725
|
+
<ScrollViewContext.Provider value={horizontal ? HORIZONTAL : VERTICAL}>
|
|
1065
1726
|
{children}
|
|
1066
|
-
</
|
|
1727
|
+
</ScrollViewContext.Provider>
|
|
1067
1728
|
);
|
|
1068
1729
|
|
|
1069
1730
|
const hasStickyHeaders =
|
|
1070
1731
|
Array.isArray(stickyHeaderIndices) && stickyHeaderIndices.length > 0;
|
|
1071
1732
|
|
|
1733
|
+
// Some ScrollView native component behaviors rely on using the metrics
|
|
1734
|
+
// of mounted views for anchoring. Make sure not to flatten children if
|
|
1735
|
+
// this is the case.
|
|
1736
|
+
const preserveChildren =
|
|
1737
|
+
this.props.maintainVisibleContentPosition != null ||
|
|
1738
|
+
(Platform.OS === 'android' && this.props.snapToAlignment != null);
|
|
1739
|
+
|
|
1072
1740
|
const contentContainer = (
|
|
1073
|
-
|
|
1074
|
-
* error found when Flow v0.112 was deployed. To see the error, delete
|
|
1075
|
-
* this comment and run Flow. */
|
|
1076
|
-
<ScrollContentContainerViewClass
|
|
1741
|
+
<NativeScrollContentView
|
|
1077
1742
|
{...contentSizeChangeProps}
|
|
1078
|
-
ref={this.
|
|
1743
|
+
ref={this._innerView.getForwardingRef(this.props.innerViewRef)}
|
|
1079
1744
|
style={contentContainerStyle}
|
|
1080
1745
|
removeClippedSubviews={
|
|
1081
1746
|
// Subview clipping causes issues with sticky headers on Android and
|
|
@@ -1084,9 +1749,10 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1084
1749
|
? false
|
|
1085
1750
|
: this.props.removeClippedSubviews
|
|
1086
1751
|
}
|
|
1087
|
-
collapsable={false}
|
|
1752
|
+
collapsable={false}
|
|
1753
|
+
collapsableChildren={!preserveChildren}>
|
|
1088
1754
|
{children}
|
|
1089
|
-
</
|
|
1755
|
+
</NativeScrollContentView>
|
|
1090
1756
|
);
|
|
1091
1757
|
|
|
1092
1758
|
const alwaysBounceHorizontal =
|
|
@@ -1099,49 +1765,38 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1099
1765
|
? this.props.alwaysBounceVertical
|
|
1100
1766
|
: !this.props.horizontal;
|
|
1101
1767
|
|
|
1102
|
-
const
|
|
1103
|
-
.DEPRECATED_sendUpdatedChildFrames;
|
|
1768
|
+
const baseStyle = horizontal ? styles.baseHorizontal : styles.baseVertical;
|
|
1104
1769
|
|
|
1105
|
-
const
|
|
1106
|
-
this.props
|
|
1107
|
-
? styles.baseHorizontal
|
|
1108
|
-
: styles.baseVertical;
|
|
1770
|
+
const {experimental_endDraggingSensitivityMultiplier, ...otherProps} =
|
|
1771
|
+
this.props;
|
|
1109
1772
|
const props = {
|
|
1110
|
-
...
|
|
1773
|
+
...otherProps,
|
|
1111
1774
|
alwaysBounceHorizontal,
|
|
1112
1775
|
alwaysBounceVertical,
|
|
1113
|
-
style:
|
|
1776
|
+
style: StyleSheet.compose(baseStyle, this.props.style),
|
|
1114
1777
|
// Override the onContentSizeChange from props, since this event can
|
|
1115
1778
|
// bubble up from TextInputs
|
|
1116
1779
|
onContentSizeChange: null,
|
|
1117
1780
|
onLayout: this._handleLayout,
|
|
1118
|
-
onMomentumScrollBegin: this.
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
.
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
.scrollResponderHandleScrollShouldSetResponder,
|
|
1135
|
-
onStartShouldSetResponder: this._scrollResponder
|
|
1136
|
-
.scrollResponderHandleStartShouldSetResponder,
|
|
1137
|
-
onStartShouldSetResponderCapture: this._scrollResponder
|
|
1138
|
-
.scrollResponderHandleStartShouldSetResponderCapture,
|
|
1139
|
-
onTouchEnd: this._scrollResponder.scrollResponderHandleTouchEnd,
|
|
1140
|
-
onTouchMove: this._scrollResponder.scrollResponderHandleTouchMove,
|
|
1141
|
-
onTouchStart: this._scrollResponder.scrollResponderHandleTouchStart,
|
|
1142
|
-
onTouchCancel: this._scrollResponder.scrollResponderHandleTouchCancel,
|
|
1781
|
+
onMomentumScrollBegin: this._handleMomentumScrollBegin,
|
|
1782
|
+
onMomentumScrollEnd: this._handleMomentumScrollEnd,
|
|
1783
|
+
onResponderGrant: this._handleResponderGrant,
|
|
1784
|
+
onResponderReject: this._handleResponderReject,
|
|
1785
|
+
onResponderRelease: this._handleResponderRelease,
|
|
1786
|
+
onResponderTerminationRequest: this._handleResponderTerminationRequest,
|
|
1787
|
+
onScrollBeginDrag: this._handleScrollBeginDrag,
|
|
1788
|
+
onScrollEndDrag: this._handleScrollEndDrag,
|
|
1789
|
+
onScrollShouldSetResponder: this._handleScrollShouldSetResponder,
|
|
1790
|
+
onStartShouldSetResponder: this._handleStartShouldSetResponder,
|
|
1791
|
+
onStartShouldSetResponderCapture:
|
|
1792
|
+
this._handleStartShouldSetResponderCapture,
|
|
1793
|
+
onTouchEnd: this._handleTouchEnd,
|
|
1794
|
+
onTouchMove: this._handleTouchMove,
|
|
1795
|
+
onTouchStart: this._handleTouchStart,
|
|
1796
|
+
onTouchCancel: this._handleTouchCancel,
|
|
1143
1797
|
onScroll: this._handleScroll,
|
|
1144
|
-
|
|
1798
|
+
endDraggingSensitivityMultiplier:
|
|
1799
|
+
experimental_endDraggingSensitivityMultiplier,
|
|
1145
1800
|
scrollEventThrottle: hasStickyHeaders
|
|
1146
1801
|
? 1
|
|
1147
1802
|
: this.props.scrollEventThrottle,
|
|
@@ -1149,7 +1804,6 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1149
1804
|
this.props.onMomentumScrollBegin || this.props.onMomentumScrollEnd
|
|
1150
1805
|
? true
|
|
1151
1806
|
: false,
|
|
1152
|
-
DEPRECATED_sendUpdatedChildFrames,
|
|
1153
1807
|
// default to true
|
|
1154
1808
|
snapToStart: this.props.snapToStart !== false,
|
|
1155
1809
|
// default to true
|
|
@@ -1175,19 +1829,18 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1175
1829
|
}
|
|
1176
1830
|
|
|
1177
1831
|
const refreshControl = this.props.refreshControl;
|
|
1832
|
+
const scrollViewRef: React.RefSetter<TScrollViewNativeImperativeHandle | null> =
|
|
1833
|
+
this._scrollView.getForwardingRef(this.props.scrollViewRef);
|
|
1178
1834
|
|
|
1179
1835
|
if (refreshControl) {
|
|
1180
1836
|
if (Platform.OS === 'ios') {
|
|
1181
1837
|
// On iOS the RefreshControl is a child of the ScrollView.
|
|
1182
|
-
// tvOS lacks native support for RefreshControl, so don't include it in that case
|
|
1183
1838
|
return (
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
|
|
1188
|
-
{Platform.isTV ? null : refreshControl}
|
|
1839
|
+
// $FlowFixMe[incompatible-type] - Flow only knows element refs.
|
|
1840
|
+
<NativeScrollView {...props} ref={scrollViewRef}>
|
|
1841
|
+
{refreshControl}
|
|
1189
1842
|
{contentContainer}
|
|
1190
|
-
</
|
|
1843
|
+
</NativeScrollView>
|
|
1191
1844
|
);
|
|
1192
1845
|
} else if (Platform.OS === 'android') {
|
|
1193
1846
|
// On Android wrap the ScrollView with a AndroidSwipeRefreshLayout.
|
|
@@ -1195,23 +1848,27 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1195
1848
|
// AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView.
|
|
1196
1849
|
// Note: we should split props.style on the inner and outer props
|
|
1197
1850
|
// however, the ScrollView still needs the baseStyle to be scrollable
|
|
1851
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
1852
|
+
// $FlowFixMe[incompatible-call]
|
|
1198
1853
|
const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
|
|
1199
1854
|
return React.cloneElement(
|
|
1200
1855
|
refreshControl,
|
|
1201
|
-
{style:
|
|
1202
|
-
<
|
|
1856
|
+
{style: StyleSheet.compose(baseStyle, outer)},
|
|
1857
|
+
<NativeScrollView
|
|
1203
1858
|
{...props}
|
|
1204
|
-
style={
|
|
1205
|
-
|
|
1859
|
+
style={StyleSheet.compose(baseStyle, inner)}
|
|
1860
|
+
// $FlowFixMe[incompatible-type] - Flow only knows element refs.
|
|
1861
|
+
ref={scrollViewRef}>
|
|
1206
1862
|
{contentContainer}
|
|
1207
|
-
</
|
|
1863
|
+
</NativeScrollView>,
|
|
1208
1864
|
);
|
|
1209
1865
|
}
|
|
1210
1866
|
}
|
|
1211
1867
|
return (
|
|
1212
|
-
|
|
1868
|
+
// $FlowFixMe[incompatible-type] - Flow only knows element refs.
|
|
1869
|
+
<NativeScrollView {...props} ref={scrollViewRef}>
|
|
1213
1870
|
{contentContainer}
|
|
1214
|
-
</
|
|
1871
|
+
</NativeScrollView>
|
|
1215
1872
|
);
|
|
1216
1873
|
}
|
|
1217
1874
|
}
|
|
@@ -1234,4 +1891,66 @@ const styles = StyleSheet.create({
|
|
|
1234
1891
|
},
|
|
1235
1892
|
});
|
|
1236
1893
|
|
|
1237
|
-
|
|
1894
|
+
type RefForwarder<TNativeInstance, TPublicInstance> = {
|
|
1895
|
+
getForwardingRef: (
|
|
1896
|
+
?React.RefSetter<TPublicInstance>,
|
|
1897
|
+
) => (TNativeInstance | null) => void,
|
|
1898
|
+
nativeInstance: TNativeInstance | null,
|
|
1899
|
+
publicInstance: TPublicInstance | null,
|
|
1900
|
+
};
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* Helper function that should be replaced with `useCallback` and `useMergeRefs`
|
|
1904
|
+
* once `ScrollView` is reimplemented as a functional component.
|
|
1905
|
+
*/
|
|
1906
|
+
function createRefForwarder<TNativeInstance, TPublicInstance>(
|
|
1907
|
+
mutator: TNativeInstance => TPublicInstance,
|
|
1908
|
+
): RefForwarder<TNativeInstance, TPublicInstance> {
|
|
1909
|
+
const state: RefForwarder<TNativeInstance, TPublicInstance> = {
|
|
1910
|
+
getForwardingRef: memoize(forwardedRef => {
|
|
1911
|
+
return (nativeInstance: TNativeInstance | null): void => {
|
|
1912
|
+
const publicInstance =
|
|
1913
|
+
nativeInstance == null ? null : mutator(nativeInstance);
|
|
1914
|
+
|
|
1915
|
+
state.nativeInstance = nativeInstance;
|
|
1916
|
+
state.publicInstance = publicInstance;
|
|
1917
|
+
|
|
1918
|
+
if (forwardedRef != null) {
|
|
1919
|
+
if (typeof forwardedRef === 'function') {
|
|
1920
|
+
forwardedRef(publicInstance);
|
|
1921
|
+
} else {
|
|
1922
|
+
forwardedRef.current = publicInstance;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
}),
|
|
1927
|
+
nativeInstance: null,
|
|
1928
|
+
publicInstance: null,
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
return state;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
// TODO: After upgrading to React 19, remove `forwardRef` from this component.
|
|
1935
|
+
// NOTE: This wrapper component is necessary because `ScrollView` is a class
|
|
1936
|
+
// component and we need to map `ref` to a differently named prop. This can be
|
|
1937
|
+
// removed when `ScrollView` is a functional component.
|
|
1938
|
+
const Wrapper = React.forwardRef(function Wrapper(
|
|
1939
|
+
props: Props,
|
|
1940
|
+
ref: ?React.RefSetter<PublicScrollViewInstance>,
|
|
1941
|
+
): React.Node {
|
|
1942
|
+
return ref == null ? (
|
|
1943
|
+
<ScrollView {...props} />
|
|
1944
|
+
) : (
|
|
1945
|
+
<ScrollView {...props} scrollViewRef={ref} />
|
|
1946
|
+
);
|
|
1947
|
+
});
|
|
1948
|
+
Wrapper.displayName = 'ScrollView';
|
|
1949
|
+
// $FlowExpectedError[prop-missing]
|
|
1950
|
+
Wrapper.Context = ScrollViewContext;
|
|
1951
|
+
|
|
1952
|
+
module.exports = ((Wrapper: $FlowFixMe): React.AbstractComponent<
|
|
1953
|
+
React.ElementConfig<typeof ScrollView>,
|
|
1954
|
+
PublicScrollViewInstance,
|
|
1955
|
+
> &
|
|
1956
|
+
ScrollViewComponentStatics);
|