@office-iss/react-native-win32 0.79.1 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +10 -3
- package/CHANGELOG.json +117 -24
- package/CHANGELOG.md +49 -14
- package/IntegrationTests/ImageCachePolicyTest.js +1 -1
- package/IntegrationTests/LayoutEventsTest.js +1 -4
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/Animated.js.flow +1 -3
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js +2 -2
- package/Libraries/Animated/AnimatedExports.js.flow +140 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -123
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/animations/Animation.js +8 -4
- package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
- package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
- package/Libraries/Animated/createAnimatedComponent.js +105 -57
- package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
- package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/AppState/AppState.js +7 -2
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Blob/URL.js +37 -12
- package/Libraries/Blob/URLSearchParams.js +106 -31
- package/Libraries/Blob/URLSearchParams.js.flow +12 -7
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -3
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Pressable/Pressable.js +20 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +20 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
- package/Libraries/Components/ScrollView/ScrollView.js +132 -122
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/Switch/Switch.d.ts +3 -0
- package/Libraries/Components/Switch/Switch.js +8 -4
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
- package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +1208 -0
- package/Libraries/Components/TextInput/TextInput.js +88 -1027
- package/Libraries/Components/TextInput/TextInput.win32.js +89 -1059
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
- package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +6 -6
- package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
- package/Libraries/Components/View/View.js +18 -21
- package/Libraries/Components/View/View.win32.js +21 -24
- package/Libraries/Components/View/ViewAccessibility.js +25 -1
- package/Libraries/Components/View/ViewAccessibility.win32.js +9 -1
- package/Libraries/Components/View/ViewPropTypes.js +49 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +49 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +5 -5
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
- package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
- package/Libraries/Image/AssetSourceResolver.js +17 -4
- package/Libraries/Image/Image.d.ts +26 -10
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +5 -5
- package/Libraries/Image/ImageBackground.js +2 -0
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +22 -17
- package/Libraries/Image/ImageSource.js +3 -1
- package/Libraries/Image/ImageSourceUtils.js +4 -2
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Interaction/InteractionManager.d.ts +13 -0
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +3 -3
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -2
- package/Libraries/Lists/FlatList.js +8 -11
- package/Libraries/Lists/SectionList.js +39 -42
- package/Libraries/Lists/SectionListModern.js +25 -34
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +1 -0
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
- package/Libraries/Modal/Modal.js +33 -7
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +5 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +10 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +10 -5
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
- package/Libraries/ReactNative/renderApplication.js +9 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
- package/Libraries/Settings/Settings.ios.js +1 -0
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/Settings.win32.js +19 -20
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js +31 -200
- package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
- package/Libraries/StyleSheet/flattenStyle.js +14 -4
- package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
- package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
- package/Libraries/Text/Text.d.ts +2 -5
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.win32.js +3 -3
- package/Libraries/Text/TextNativeComponent.js +0 -4
- package/Libraries/Text/TextNativeComponent.win32.js +0 -4
- package/Libraries/Text/TextProps.js +5 -33
- package/Libraries/Text/TextProps.win32.js +5 -30
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
- package/Libraries/Types/CoreEventTypes.d.ts +6 -1
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/DeviceInfo.js +2 -0
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/Dimensions.win32.js +1 -1
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +11 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/Libraries/vendor/core/ErrorUtils.js +28 -2
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/index.js +51 -331
- package/index.win32.js +71 -352
- package/interface.js +0 -4
- package/jest/resolver.js +31 -0
- package/overrides.json +45 -47
- package/package.json +25 -25
- package/src/private/animated/NativeAnimatedHelper.js +21 -8
- package/src/private/animated/NativeAnimatedHelper.win32.js +21 -8
- package/src/private/animated/createAnimatedPropsHook.js +11 -16
- package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
- package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
- package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
- package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.win32.js +1 -1
- package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
- package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
- package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
- package/src/private/styles/composeStyles.js +12 -5
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +67 -1
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/performance/Performance.js +1 -3
- package/src/private/webapis/performance/PerformanceEntry.js +6 -1
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
- package/src/types/globals.d.ts +42 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/src-win/Libraries/Text/Text.d.ts +2 -5
- package/types/index.d.ts +6 -3
- package/types/public/ReactNativeTypes.d.ts +2 -2
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
- package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
- package/Libraries/NewAppScreen/components/Header.js +0 -77
- package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
- package/Libraries/NewAppScreen/components/logo.png +0 -0
- package/Libraries/NewAppScreen/index.js +0 -25
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
- package/Libraries/Utilities/DeviceInfo.win32.js +0 -19
- package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
- package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
- package/flow/jest.js +0 -1287
- package/jest/__tests__/setup-test.js +0 -18
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/private/utilities/ensureInstance.js +0 -21
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
- package/types/modules/LaunchScreen.d.ts +0 -18
- /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
- /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
|
@@ -540,9 +540,9 @@ function unforkEvent(
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
-
const event = function (
|
|
543
|
+
const event = function <T>(
|
|
544
544
|
argMapping: $ReadOnlyArray<?Mapping>,
|
|
545
|
-
config: EventConfig
|
|
545
|
+
config: EventConfig<T>,
|
|
546
546
|
): any {
|
|
547
547
|
const animatedEvent = new AnimatedEvent(argMapping, config);
|
|
548
548
|
if (animatedEvent.__isNative) {
|
|
@@ -606,144 +606,23 @@ export default {
|
|
|
606
606
|
* See https://reactnative.dev/docs/animated#node
|
|
607
607
|
*/
|
|
608
608
|
Node: AnimatedNode,
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* Animates a value from an initial velocity to zero based on a decay
|
|
612
|
-
* coefficient.
|
|
613
|
-
*
|
|
614
|
-
* See https://reactnative.dev/docs/animated#decay
|
|
615
|
-
*/
|
|
616
609
|
decay,
|
|
617
|
-
/**
|
|
618
|
-
* Animates a value along a timed easing curve. The Easing module has tons of
|
|
619
|
-
* predefined curves, or you can use your own function.
|
|
620
|
-
*
|
|
621
|
-
* See https://reactnative.dev/docs/animated#timing
|
|
622
|
-
*/
|
|
623
610
|
timing,
|
|
624
|
-
/**
|
|
625
|
-
* Animates a value according to an analytical spring model based on
|
|
626
|
-
* damped harmonic oscillation.
|
|
627
|
-
*
|
|
628
|
-
* See https://reactnative.dev/docs/animated#spring
|
|
629
|
-
*/
|
|
630
611
|
spring,
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Creates a new Animated value composed from two Animated values added
|
|
634
|
-
* together.
|
|
635
|
-
*
|
|
636
|
-
* See https://reactnative.dev/docs/animated#add
|
|
637
|
-
*/
|
|
638
612
|
add,
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* Creates a new Animated value composed by subtracting the second Animated
|
|
642
|
-
* value from the first Animated value.
|
|
643
|
-
*
|
|
644
|
-
* See https://reactnative.dev/docs/animated#subtract
|
|
645
|
-
*/
|
|
646
613
|
subtract,
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Creates a new Animated value composed by dividing the first Animated value
|
|
650
|
-
* by the second Animated value.
|
|
651
|
-
*
|
|
652
|
-
* See https://reactnative.dev/docs/animated#divide
|
|
653
|
-
*/
|
|
654
614
|
divide,
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* Creates a new Animated value composed from two Animated values multiplied
|
|
658
|
-
* together.
|
|
659
|
-
*
|
|
660
|
-
* See https://reactnative.dev/docs/animated#multiply
|
|
661
|
-
*/
|
|
662
615
|
multiply,
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Creates a new Animated value that is the (non-negative) modulo of the
|
|
666
|
-
* provided Animated value.
|
|
667
|
-
*
|
|
668
|
-
* See https://reactnative.dev/docs/animated#modulo
|
|
669
|
-
*/
|
|
670
616
|
modulo,
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Create a new Animated value that is limited between 2 values. It uses the
|
|
674
|
-
* difference between the last value so even if the value is far from the
|
|
675
|
-
* bounds it will start changing when the value starts getting closer again.
|
|
676
|
-
*
|
|
677
|
-
* See https://reactnative.dev/docs/animated#diffclamp
|
|
678
|
-
*/
|
|
679
617
|
diffClamp,
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Starts an animation after the given delay.
|
|
683
|
-
*
|
|
684
|
-
* See https://reactnative.dev/docs/animated#delay
|
|
685
|
-
*/
|
|
686
618
|
delay,
|
|
687
|
-
/**
|
|
688
|
-
* Starts an array of animations in order, waiting for each to complete
|
|
689
|
-
* before starting the next. If the current running animation is stopped, no
|
|
690
|
-
* following animations will be started.
|
|
691
|
-
*
|
|
692
|
-
* See https://reactnative.dev/docs/animated#sequence
|
|
693
|
-
*/
|
|
694
619
|
sequence,
|
|
695
|
-
/**
|
|
696
|
-
* Starts an array of animations all at the same time. By default, if one
|
|
697
|
-
* of the animations is stopped, they will all be stopped. You can override
|
|
698
|
-
* this with the `stopTogether` flag.
|
|
699
|
-
*
|
|
700
|
-
* See https://reactnative.dev/docs/animated#parallel
|
|
701
|
-
*/
|
|
702
620
|
parallel,
|
|
703
|
-
/**
|
|
704
|
-
* Array of animations may run in parallel (overlap), but are started in
|
|
705
|
-
* sequence with successive delays. Nice for doing trailing effects.
|
|
706
|
-
*
|
|
707
|
-
* See https://reactnative.dev/docs/animated#stagger
|
|
708
|
-
*/
|
|
709
621
|
stagger,
|
|
710
|
-
/**
|
|
711
|
-
* Loops a given animation continuously, so that each time it reaches the
|
|
712
|
-
* end, it resets and begins again from the start.
|
|
713
|
-
*
|
|
714
|
-
* See https://reactnative.dev/docs/animated#loop
|
|
715
|
-
*/
|
|
716
622
|
loop,
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* Takes an array of mappings and extracts values from each arg accordingly,
|
|
720
|
-
* then calls `setValue` on the mapped outputs.
|
|
721
|
-
*
|
|
722
|
-
* See https://reactnative.dev/docs/animated#event
|
|
723
|
-
*/
|
|
724
623
|
event,
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Make any React component Animatable. Used to create `Animated.View`, etc.
|
|
728
|
-
*
|
|
729
|
-
* See https://reactnative.dev/docs/animated#createanimatedcomponent
|
|
730
|
-
*/
|
|
731
624
|
createAnimatedComponent,
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Imperative API to attach an animated value to an event on a view. Prefer
|
|
735
|
-
* using `Animated.event` with `useNativeDrive: true` if possible.
|
|
736
|
-
*
|
|
737
|
-
* See https://reactnative.dev/docs/animated#attachnativeevent
|
|
738
|
-
*/
|
|
739
625
|
attachNativeEvent,
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* Advanced imperative API for snooping on animated events that are passed in
|
|
743
|
-
* through props. Use values directly where possible.
|
|
744
|
-
*
|
|
745
|
-
* See https://reactnative.dev/docs/animated#forkevent
|
|
746
|
-
*/
|
|
747
626
|
forkEvent,
|
|
748
627
|
unforkEvent,
|
|
749
628
|
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
let ease;
|
|
14
14
|
|
|
15
|
+
export type EasingFunction = (t: number) => number;
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* The `Easing` module implements common easing functions. This module is used
|
|
17
19
|
* by [Animate.timing()](docs/animate.html#timing) to convey physically
|
|
@@ -57,7 +59,7 @@ let ease;
|
|
|
57
59
|
* - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
|
|
58
60
|
* - [`out`](docs/easing.html#out) runs an easing function backwards
|
|
59
61
|
*/
|
|
60
|
-
const
|
|
62
|
+
const EasingStatic = {
|
|
61
63
|
/**
|
|
62
64
|
* A stepping function, returns 1 for any positive value of `n`.
|
|
63
65
|
*/
|
|
@@ -90,7 +92,7 @@ const Easing = {
|
|
|
90
92
|
*/
|
|
91
93
|
ease(t: number): number {
|
|
92
94
|
if (!ease) {
|
|
93
|
-
ease =
|
|
95
|
+
ease = EasingStatic.bezier(0.42, 0, 1, 1);
|
|
94
96
|
}
|
|
95
97
|
return ease(t);
|
|
96
98
|
},
|
|
@@ -121,7 +123,7 @@ const Easing = {
|
|
|
121
123
|
* n = 4: http://easings.net/#easeInQuart
|
|
122
124
|
* n = 5: http://easings.net/#easeInQuint
|
|
123
125
|
*/
|
|
124
|
-
poly(n: number):
|
|
126
|
+
poly(n: number): EasingFunction {
|
|
125
127
|
return (t: number) => Math.pow(t, n);
|
|
126
128
|
},
|
|
127
129
|
|
|
@@ -162,7 +164,7 @@ const Easing = {
|
|
|
162
164
|
*
|
|
163
165
|
* http://easings.net/#easeInElastic
|
|
164
166
|
*/
|
|
165
|
-
elastic(bounciness: number = 1):
|
|
167
|
+
elastic(bounciness: number = 1): EasingFunction {
|
|
166
168
|
const p = bounciness * Math.PI;
|
|
167
169
|
return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
|
|
168
170
|
},
|
|
@@ -173,7 +175,7 @@ const Easing = {
|
|
|
173
175
|
*
|
|
174
176
|
* https://easings.net/#easeInBack
|
|
175
177
|
*/
|
|
176
|
-
back(s: number = 1.70158):
|
|
178
|
+
back(s: number = 1.70158): EasingFunction {
|
|
177
179
|
return t => t * t * ((s + 1) * t - s);
|
|
178
180
|
},
|
|
179
181
|
|
|
@@ -208,12 +210,7 @@ const Easing = {
|
|
|
208
210
|
* A useful tool to visualize cubic bezier curves can be found at
|
|
209
211
|
* http://cubic-bezier.com/
|
|
210
212
|
*/
|
|
211
|
-
bezier(
|
|
212
|
-
x1: number,
|
|
213
|
-
y1: number,
|
|
214
|
-
x2: number,
|
|
215
|
-
y2: number,
|
|
216
|
-
): (t: number) => number {
|
|
213
|
+
bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction {
|
|
217
214
|
const _bezier = require('./bezier').default;
|
|
218
215
|
return _bezier(x1, y1, x2, y2);
|
|
219
216
|
},
|
|
@@ -221,14 +218,14 @@ const Easing = {
|
|
|
221
218
|
/**
|
|
222
219
|
* Runs an easing function forwards.
|
|
223
220
|
*/
|
|
224
|
-
in(easing:
|
|
221
|
+
in(easing: EasingFunction): EasingFunction {
|
|
225
222
|
return easing;
|
|
226
223
|
},
|
|
227
224
|
|
|
228
225
|
/**
|
|
229
226
|
* Runs an easing function backwards.
|
|
230
227
|
*/
|
|
231
|
-
out(easing:
|
|
228
|
+
out(easing: EasingFunction): EasingFunction {
|
|
232
229
|
return t => 1 - easing(1 - t);
|
|
233
230
|
},
|
|
234
231
|
|
|
@@ -237,7 +234,7 @@ const Easing = {
|
|
|
237
234
|
* forwards for half of the duration, then backwards for the rest of the
|
|
238
235
|
* duration.
|
|
239
236
|
*/
|
|
240
|
-
inOut(easing:
|
|
237
|
+
inOut(easing: EasingFunction): EasingFunction {
|
|
241
238
|
return t => {
|
|
242
239
|
if (t < 0.5) {
|
|
243
240
|
return easing(t * 2) / 2;
|
|
@@ -247,4 +244,5 @@ const Easing = {
|
|
|
247
244
|
},
|
|
248
245
|
};
|
|
249
246
|
|
|
250
|
-
export
|
|
247
|
+
export type Easing = typeof EasingStatic;
|
|
248
|
+
export default EasingStatic;
|
|
@@ -13,10 +13,14 @@ import type AnimatedNode from '../nodes/AnimatedNode';
|
|
|
13
13
|
import type AnimatedValue from '../nodes/AnimatedValue';
|
|
14
14
|
|
|
15
15
|
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
|
16
|
-
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
17
16
|
import AnimatedProps from '../nodes/AnimatedProps';
|
|
18
17
|
|
|
19
|
-
export type EndResult = {
|
|
18
|
+
export type EndResult = {
|
|
19
|
+
finished: boolean,
|
|
20
|
+
value?: number,
|
|
21
|
+
offset?: number,
|
|
22
|
+
...
|
|
23
|
+
};
|
|
20
24
|
export type EndCallback = (result: EndResult) => void;
|
|
21
25
|
|
|
22
26
|
export type AnimationConfig = $ReadOnly<{
|
|
@@ -141,9 +145,9 @@ export default class Animation {
|
|
|
141
145
|
// When using natively driven animations, once the animation completes,
|
|
142
146
|
// we need to ensure that the JS side nodes are synced with the updated
|
|
143
147
|
// values.
|
|
144
|
-
const {value} = result;
|
|
148
|
+
const {value, offset} = result;
|
|
145
149
|
if (value != null) {
|
|
146
|
-
animatedValue.__onAnimatedValueUpdateReceived(value);
|
|
150
|
+
animatedValue.__onAnimatedValueUpdateReceived(value, offset);
|
|
147
151
|
|
|
148
152
|
if (this.__isLooping === true) {
|
|
149
153
|
return;
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {AnimatedProps} from '../createAnimatedComponent';
|
|
12
12
|
|
|
13
|
-
import FlatList from '../../Lists/FlatList';
|
|
13
|
+
import FlatList, {type FlatListProps} from '../../Lists/FlatList';
|
|
14
14
|
import createAnimatedComponent from '../createAnimatedComponent';
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
FlatList<
|
|
20
|
-
|
|
17
|
+
// $FlowExpectedError[unclear-type]
|
|
18
|
+
export default (createAnimatedComponent(FlatList): component<ItemT = any>(
|
|
19
|
+
ref?: React.RefSetter<FlatList<ItemT>>,
|
|
20
|
+
...props: AnimatedProps<FlatListProps<ItemT>>
|
|
21
|
+
));
|
|
@@ -23,48 +23,51 @@ import useAnimatedProps from '../useAnimatedProps';
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import {useMemo} from 'react';
|
|
25
25
|
|
|
26
|
-
type
|
|
27
|
-
type
|
|
26
|
+
type AnimatedScrollViewProps = React.ElementConfig<typeof ScrollView>;
|
|
27
|
+
type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* @see https://github.com/facebook/react-native/commit/b8c8562
|
|
31
31
|
*/
|
|
32
|
-
const AnimatedScrollView: AnimatedComponentType<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const AnimatedScrollView: AnimatedComponentType<
|
|
33
|
+
AnimatedScrollViewProps,
|
|
34
|
+
AnimatedScrollViewInstance,
|
|
35
|
+
> = React.forwardRef(
|
|
36
|
+
function AnimatedScrollViewWithOrWithoutInvertedRefreshControl(
|
|
37
|
+
props,
|
|
38
|
+
forwardedRef,
|
|
39
|
+
) {
|
|
40
|
+
// (Android only) When a ScrollView has a RefreshControl and
|
|
41
|
+
// any `style` property set with an Animated.Value, the CSS
|
|
42
|
+
// gets incorrectly applied twice. This is because ScrollView
|
|
43
|
+
// swaps the parent/child relationship of itself and the
|
|
44
|
+
// RefreshControl component (see ScrollView.js for more details).
|
|
45
|
+
if (
|
|
46
|
+
Platform.OS === 'android' &&
|
|
47
|
+
props.refreshControl != null &&
|
|
48
|
+
props.style != null
|
|
37
49
|
) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<AnimatedScrollViewWithoutInvertedRefreshControl
|
|
60
|
-
scrollEventThrottle={0.0001}
|
|
61
|
-
{...props}
|
|
62
|
-
ref={forwardedRef}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
);
|
|
50
|
+
return (
|
|
51
|
+
// $FlowFixMe - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
|
|
52
|
+
<AnimatedScrollViewWithInvertedRefreshControl
|
|
53
|
+
scrollEventThrottle={0.0001}
|
|
54
|
+
{...props}
|
|
55
|
+
ref={forwardedRef}
|
|
56
|
+
// $FlowFixMe[incompatible-type]
|
|
57
|
+
refreshControl={props.refreshControl}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
} else {
|
|
61
|
+
return (
|
|
62
|
+
<AnimatedScrollViewWithoutInvertedRefreshControl
|
|
63
|
+
scrollEventThrottle={0.0001}
|
|
64
|
+
{...props}
|
|
65
|
+
ref={forwardedRef}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
);
|
|
68
71
|
|
|
69
72
|
const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
|
|
70
73
|
// $FlowFixMe[incompatible-call]
|
|
@@ -75,8 +78,8 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
|
|
|
75
78
|
refreshControl: ExactReactElement_DEPRECATED<any>,
|
|
76
79
|
},
|
|
77
80
|
forwardedRef:
|
|
78
|
-
| {current:
|
|
79
|
-
| ((
|
|
81
|
+
| {current: AnimatedScrollViewInstance | null, ...}
|
|
82
|
+
| ((AnimatedScrollViewInstance | null) => mixed),
|
|
80
83
|
) {
|
|
81
84
|
// Split `props` into the animate-able props for the parent (RefreshControl)
|
|
82
85
|
// and child (ScrollView).
|
|
@@ -106,10 +109,13 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
|
|
|
106
109
|
|
|
107
110
|
// Handle animated props on `NativeDirectionalScrollView`.
|
|
108
111
|
const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
AnimatedScrollViewProps,
|
|
113
|
+
AnimatedScrollViewInstance,
|
|
111
114
|
>(intermediatePropsForScrollView);
|
|
112
|
-
const ref = useMergeRefs<
|
|
115
|
+
const ref = useMergeRefs<AnimatedScrollViewInstance>(
|
|
116
|
+
scrollViewRef,
|
|
117
|
+
forwardedRef,
|
|
118
|
+
);
|
|
113
119
|
|
|
114
120
|
return (
|
|
115
121
|
// $FlowFixMe[incompatible-use] Investigate useAnimatedProps return value
|
|
@@ -8,15 +8,19 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
import type {AnimatedComponentType} from '../createAnimatedComponent';
|
|
11
|
+
import type {AnimatedProps} from '../createAnimatedComponent';
|
|
13
12
|
|
|
14
|
-
import SectionList from '../../Lists/SectionList';
|
|
13
|
+
import SectionList, {type SectionListProps} from '../../Lists/SectionList';
|
|
15
14
|
import createAnimatedComponent from '../createAnimatedComponent';
|
|
16
15
|
import * as React from 'react';
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// $FlowFixMe
|
|
18
|
+
export default (createAnimatedComponent(SectionList): component<
|
|
20
19
|
// $FlowExpectedError[unclear-type]
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
ItemT = any,
|
|
21
|
+
// $FlowExpectedError[unclear-type]
|
|
22
|
+
SectionT = any,
|
|
23
|
+
>(
|
|
24
|
+
ref?: React.RefSetter<SectionList<ItemT, SectionT>>,
|
|
25
|
+
...props: AnimatedProps<SectionListProps<ItemT, SectionT>>
|
|
26
|
+
));
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type AnimatedAddition from './nodes/AnimatedAddition';
|
|
12
|
+
import type AnimatedDiffClamp from './nodes/AnimatedDiffClamp';
|
|
13
|
+
import type AnimatedDivision from './nodes/AnimatedDivision';
|
|
14
|
+
import type AnimatedInterpolation from './nodes/AnimatedInterpolation';
|
|
15
|
+
import type AnimatedModulo from './nodes/AnimatedModulo';
|
|
16
|
+
import type AnimatedMultiplication from './nodes/AnimatedMultiplication';
|
|
17
|
+
import type AnimatedNode from './nodes/AnimatedNode';
|
|
11
18
|
import type {AnimatedPropsAllowlist} from './nodes/AnimatedProps';
|
|
19
|
+
import type AnimatedSubtraction from './nodes/AnimatedSubtraction';
|
|
20
|
+
import type AnimatedValue from './nodes/AnimatedValue';
|
|
12
21
|
|
|
13
22
|
import createAnimatedPropsHook from '../../src/private/animated/createAnimatedPropsHook';
|
|
14
23
|
import composeStyles from '../../src/private/styles/composeStyles';
|
|
@@ -17,81 +26,120 @@ import useMergeRefs from '../Utilities/useMergeRefs';
|
|
|
17
26
|
import * as React from 'react';
|
|
18
27
|
import {useMemo} from 'react';
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
type Nullable = void | null;
|
|
30
|
+
type Primitive = string | number | boolean | symbol | void;
|
|
31
|
+
type Builtin = (...$ReadOnlyArray<empty>) => mixed | Date | Error | RegExp;
|
|
32
|
+
|
|
33
|
+
export type WithAnimatedValue<+T> = T extends Builtin | Nullable
|
|
34
|
+
? T
|
|
35
|
+
: T extends Primitive
|
|
36
|
+
?
|
|
37
|
+
| T
|
|
38
|
+
| AnimatedNode
|
|
39
|
+
| AnimatedAddition
|
|
40
|
+
| AnimatedSubtraction
|
|
41
|
+
| AnimatedDivision
|
|
42
|
+
| AnimatedMultiplication
|
|
43
|
+
| AnimatedModulo
|
|
44
|
+
| AnimatedDiffClamp
|
|
45
|
+
| AnimatedValue
|
|
46
|
+
| AnimatedInterpolation<number | string>
|
|
47
|
+
| AnimatedInterpolation<number>
|
|
48
|
+
| AnimatedInterpolation<string>
|
|
49
|
+
: T extends $ReadOnlyArray<infer P>
|
|
50
|
+
? $ReadOnlyArray<WithAnimatedValue<P>>
|
|
51
|
+
: T extends {...}
|
|
52
|
+
? {+[K in keyof T]: WithAnimatedValue<T[K]>}
|
|
53
|
+
: T;
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
type NonAnimatedProps =
|
|
56
|
+
| 'ref'
|
|
57
|
+
| 'innerViewRef'
|
|
58
|
+
| 'scrollViewRef'
|
|
59
|
+
| 'testID'
|
|
60
|
+
| 'disabled'
|
|
61
|
+
| 'accessibilityLabel';
|
|
62
|
+
type PassThroughProps = $ReadOnly<{
|
|
63
|
+
passthroughAnimatedPropExplicitValues?: React.ElementConfig<
|
|
64
|
+
typeof View,
|
|
65
|
+
> | null,
|
|
36
66
|
}>;
|
|
37
67
|
|
|
68
|
+
export type AnimatedProps<Props: {...}> = {
|
|
69
|
+
[K in keyof Props]: K extends NonAnimatedProps
|
|
70
|
+
? Props[K]
|
|
71
|
+
: WithAnimatedValue<Props[K]>,
|
|
72
|
+
} & PassThroughProps;
|
|
73
|
+
|
|
74
|
+
export type AnimatedBaseProps<Props: {...}> = {
|
|
75
|
+
[K in keyof Props]: K extends NonAnimatedProps
|
|
76
|
+
? Props[K]
|
|
77
|
+
: WithAnimatedValue<Props[K]>,
|
|
78
|
+
};
|
|
79
|
+
|
|
38
80
|
export type AnimatedComponentType<Props: {...}, +Instance = mixed> = component(
|
|
39
|
-
ref
|
|
81
|
+
ref?: React.RefSetter<Instance>,
|
|
40
82
|
...AnimatedProps<Props>
|
|
41
83
|
);
|
|
42
84
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
85
|
+
export default function createAnimatedComponent<
|
|
86
|
+
TInstance: React.ComponentType<any>,
|
|
87
|
+
>(
|
|
88
|
+
Component: TInstance,
|
|
89
|
+
): AnimatedComponentType<
|
|
90
|
+
$ReadOnly<React.ElementProps<TInstance>>,
|
|
91
|
+
React.ElementRef<TInstance>,
|
|
92
|
+
> {
|
|
51
93
|
return unstable_createAnimatedComponentWithAllowlist(Component, null);
|
|
52
94
|
}
|
|
53
95
|
|
|
54
96
|
export function unstable_createAnimatedComponentWithAllowlist<
|
|
55
97
|
TProps: {...},
|
|
56
|
-
TInstance
|
|
98
|
+
TInstance: React.ComponentType<TProps>,
|
|
57
99
|
>(
|
|
58
|
-
Component:
|
|
100
|
+
Component: TInstance,
|
|
59
101
|
allowlist: ?AnimatedPropsAllowlist,
|
|
60
|
-
):
|
|
102
|
+
): AnimatedComponentType<TProps, React.ElementRef<TInstance>> {
|
|
61
103
|
const useAnimatedProps = createAnimatedPropsHook(allowlist);
|
|
62
104
|
|
|
63
|
-
const AnimatedComponent
|
|
64
|
-
|
|
65
|
-
TInstance
|
|
66
|
-
>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
105
|
+
const AnimatedComponent: AnimatedComponentType<
|
|
106
|
+
TProps,
|
|
107
|
+
React.ElementRef<TInstance>,
|
|
108
|
+
> = React.forwardRef<AnimatedProps<TProps>, React.ElementRef<TInstance>>(
|
|
109
|
+
(props, forwardedRef) => {
|
|
110
|
+
const [reducedProps, callbackRef] = useAnimatedProps<
|
|
111
|
+
TProps,
|
|
112
|
+
React.ElementRef<TInstance>,
|
|
113
|
+
>(props);
|
|
114
|
+
const ref = useMergeRefs<React.ElementRef<TInstance>>(
|
|
115
|
+
callbackRef,
|
|
116
|
+
forwardedRef,
|
|
117
|
+
);
|
|
71
118
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
119
|
+
// Some components require explicit passthrough values for animation
|
|
120
|
+
// to work properly. For example, if an animated component is
|
|
121
|
+
// transformed and Pressable, onPress will not work after transform
|
|
122
|
+
// without these passthrough values.
|
|
123
|
+
// $FlowFixMe[prop-missing]
|
|
124
|
+
const {passthroughAnimatedPropExplicitValues, style} = reducedProps;
|
|
125
|
+
const passthroughStyle = passthroughAnimatedPropExplicitValues?.style;
|
|
126
|
+
const mergedStyle = useMemo(
|
|
127
|
+
() => composeStyles(style, passthroughStyle),
|
|
128
|
+
[passthroughStyle, style],
|
|
129
|
+
);
|
|
83
130
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
131
|
+
// NOTE: It is important that `passthroughAnimatedPropExplicitValues` is
|
|
132
|
+
// spread after `reducedProps` but before `style`.
|
|
133
|
+
return (
|
|
134
|
+
<Component
|
|
135
|
+
{...reducedProps}
|
|
136
|
+
{...passthroughAnimatedPropExplicitValues}
|
|
137
|
+
style={mergedStyle}
|
|
138
|
+
ref={ref}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
95
143
|
|
|
96
144
|
AnimatedComponent.displayName = `Animated(${
|
|
97
145
|
Component.displayName || 'Anonymous'
|
|
@@ -28,7 +28,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export default class AnimatedNode {
|
|
31
|
-
#listeners: Map<string, ValueListenerCallback
|
|
31
|
+
#listeners: Map<string, ValueListenerCallback>;
|
|
32
32
|
|
|
33
33
|
_platformConfig: ?PlatformConfig = undefined;
|
|
34
34
|
|
|
@@ -38,6 +38,7 @@ export default class AnimatedNode {
|
|
|
38
38
|
...
|
|
39
39
|
}>,
|
|
40
40
|
) {
|
|
41
|
+
this.#listeners = new Map();
|
|
41
42
|
if (__DEV__) {
|
|
42
43
|
this.__debugID = config?.debugID;
|
|
43
44
|
}
|
|
@@ -111,8 +112,8 @@ export default class AnimatedNode {
|
|
|
111
112
|
return this.#listeners.size > 0;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
__onAnimatedValueUpdateReceived(value: number): void {
|
|
115
|
-
this.__callListeners(value);
|
|
115
|
+
__onAnimatedValueUpdateReceived(value: number, offset: number): void {
|
|
116
|
+
this.__callListeners(value + offset);
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
__callListeners(value: number): void {
|