react-native-reanimated 3.0.0-rc.2 → 3.0.0-rc.4
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/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +3 -0
- package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +0 -0
- package/Common/cpp/Fabric/FabricUtils.cpp +1 -1
- package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +0 -0
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +2 -0
- package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +0 -0
- package/Common/cpp/{headers/Fabric → Fabric}/ShadowTreeCloner.h +1 -1
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +2 -0
- package/Common/cpp/{headers/LayoutAnimations → LayoutAnimations}/LayoutAnimationsProxy.h +0 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +6 -1
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +5 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -0
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +1 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +93 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +125 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +50 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +27 -0
- package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
- package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
- package/Common/cpp/Registries/MapperRegistry.cpp +3 -1
- package/Common/cpp/{headers/Registries → Registries}/MapperRegistry.h +0 -0
- package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
- package/Common/cpp/Registries/WorkletsCache.cpp +8 -1
- package/Common/cpp/{headers/Registries → Registries}/WorkletsCache.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/FrozenObject.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/HostFunctionHandler.h +0 -0
- package/Common/cpp/SharedItems/MutableValue.cpp +2 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValue.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValueSetterProxy.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RemoteObject.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +0 -0
- package/Common/cpp/SharedItems/ShareableValue.cpp +6 -2
- package/Common/cpp/{headers/SharedItems → SharedItems}/ShareableValue.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/ValueWrapper.h +0 -0
- package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +2 -2
- package/Common/cpp/{headers/Tools → Tools}/JSIStoreValueUser.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/Mapper.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
- package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
- package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
- package/RNReanimated.podspec +21 -85
- package/android/CMakeLists.txt +62 -58
- package/android/build.gradle +421 -114
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +10 -8
- package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
- package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
- package/android/src/main/cpp/AndroidLogger.cpp +4 -1
- package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
- package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
- package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
- package/android/src/main/cpp/{headers/LayoutAnimations.h → LayoutAnimations.h} +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +12 -28
- package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +3 -1
- package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThreadBase.java +72 -0
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +2 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +7 -7
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/UIImplementation/64/com/swmansion/reanimated}/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/{main/java → reactNativeVersionPatch/UIImplementation/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/latest/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated}/layoutReanimation/ReanimatedNativeHierarchyManager.java +0 -0
- package/android/src/{main/java → reactNativeVersionPatch/nativeHierarchyManager/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +0 -0
- package/ios/REAModule.mm +29 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +1 -1
- package/ios/native/NativeProxy.mm +12 -19
- package/ios/native/REAInitializer.h +2 -2
- package/ios/native/REAInitializer.mm +2 -2
- package/ios/native/REAMessageThread.h +22 -0
- package/ios/native/REAMessageThread.mm +38 -0
- package/ios/native/UIResponder+Reanimated.mm +1 -1
- package/lib/commonjs/createAnimatedComponent.js +2 -5
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeMethods.js +67 -31
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -12
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +0 -24
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +0 -12
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +8 -0
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +33 -0
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/commonjs/reanimated2/utils.js +12 -3
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +2 -5
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/NativeMethods.js +68 -30
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -10
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +0 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +0 -10
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js +1 -0
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +21 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/module/reanimated2/utils.js +13 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/package.json +10 -6
- package/plugin.js +105 -47
- package/react-native-reanimated.d.ts +13 -9
- package/scripts/reanimated_utils.rb +77 -0
- package/src/createAnimatedComponent.tsx +2 -3
- package/src/reanimated2/NativeMethods.ts +91 -44
- package/src/reanimated2/animation/delay.ts +0 -12
- package/src/reanimated2/animation/repeat.ts +0 -25
- package/src/reanimated2/animation/sequence.ts +0 -13
- package/src/reanimated2/commonTypes.ts +9 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +6 -9
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +78 -27
- package/src/reanimated2/globals.d.ts +56 -14
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
- package/src/reanimated2/hook/useFrameCallback.ts +2 -1
- package/src/reanimated2/hook/useScrollViewOffset.ts +37 -0
- package/src/reanimated2/utils.ts +12 -5
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dummyListener","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","value","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","shouldBeUseWeb","enableLayoutAnimations","DefaultLayout","DefaultEntering","DefaultExiting","build","config","sv","runOnUI","global","LayoutAnimationRepository","registerConfig","_component","isJest","animatedStyle","makeMutable","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n runOnUI,\n enableLayoutAnimations,\n} from './reanimated2/core';\nimport {\n DefaultEntering,\n DefaultExiting,\n DefaultLayout,\n} from './reanimated2/layoutReanimation/defaultAnimations/Default';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n if (\n (this.props.layout || this.props.entering || this.props.exiting) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n let layout = this.props.layout ? this.props.layout : DefaultLayout;\n let entering = this.props.entering\n ? this.props.entering\n : DefaultEntering;\n let exiting = this.props.exiting\n ? this.props.exiting\n : DefaultExiting;\n\n if (has('build', layout)) {\n layout = layout.build();\n }\n\n if (has('build', entering)) {\n entering = entering.build() as EntryExitAnimationFunction;\n }\n\n if (has('build', exiting)) {\n exiting = exiting.build() as EntryExitAnimationFunction;\n }\n\n const config = {\n layout,\n entering,\n exiting,\n sv: this.sv,\n };\n runOnUI(() => {\n 'worklet';\n global.LayoutAnimationRepository.registerConfig(tag, config);\n })();\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n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GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
1
|
+
{"version":3,"names":["dummyListener","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","value","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","shouldBeUseWeb","layout","entering","exiting","enableLayoutAnimations","DefaultLayout","DefaultEntering","DefaultExiting","build","config","sv","runOnUI","global","LayoutAnimationRepository","registerConfig","_component","isJest","animatedStyle","makeMutable","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/LayoutAnimationRepository';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n makeMutable,\n runOnUI,\n enableLayoutAnimations,\n} from './reanimated2/core';\nimport {\n DefaultEntering,\n DefaultExiting,\n DefaultLayout,\n} from './reanimated2/layoutReanimation/defaultAnimations/Default';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n sv: SharedValue<null | Record<string, unknown>> | null;\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n this.sv = makeMutable({});\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this.sv = null;\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n if (\n !shouldBeUseWeb() &&\n (this.props.layout || this.props.entering || this.props.exiting) &&\n tag != null\n ) {\n enableLayoutAnimations(true, false);\n let layout = this.props.layout ? this.props.layout : DefaultLayout;\n let entering = this.props.entering\n ? this.props.entering\n : DefaultEntering;\n let exiting = this.props.exiting\n ? this.props.exiting\n : DefaultExiting;\n\n if (has('build', layout)) {\n layout = layout.build();\n }\n\n if (has('build', entering)) {\n entering = entering.build() as EntryExitAnimationFunction;\n }\n\n if (has('build', exiting)) {\n exiting = exiting.build() as EntryExitAnimationFunction;\n }\n\n const config = {\n layout,\n entering,\n exiting,\n sv: this.sv,\n };\n runOnUI(() => {\n 'worklet';\n global.LayoutAnimationRepository.registerConfig(tag, config);\n })();\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAKA;;AAeA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAGD,SAASC,YAAT,CAAyBC,KAAzB,EAAqD;EACnD,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd,CAAL,EAA2B;IACzB,OAAO,CAACA,KAAD,CAAP;EACD;;EACD,MAAMG,SAAc,GAAG,EAAvB;;EAEA,MAAMC,aAAa,GAAIC,GAAD,IAAiC;IACrDA,GAAG,CAACC,OAAJ,CAAaC,IAAD,IAAU;MACpB,IAAIN,KAAK,CAACC,OAAN,CAAcK,IAAd,CAAJ,EAAyB;QACvBH,aAAa,CAACG,IAAD,CAAb;MACD,CAFD,MAEO;QACLJ,SAAS,CAACK,IAAV,CAAeD,IAAf;MACD;IACF,CAND;EAOD,CARD;;EASAH,aAAa,CAACJ,K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EAAyB;QACvB,KAAKA,cAAL,GAAsB,KAAtB;MACD;;MAED,MAAMc,aAAa,GAAGxD,qBAAA,CAASyD,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;;MAIA,oBACE,6BAAC,SAAD,eAAepG,KAAf;QAAsB,GAAG,EAAE,KAAKqG;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EAtXD;;EAV4D,gBAQxDnG,iBARwD;;EAmY9DA,iBAAiB,CAACyG,WAAlB,GAAiC,qBAC/B9G,SAAS,CAAC8G,WAAV,IAAyB9G,SAAS,CAACkF,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO5E,cAAA,CAAMyG,UAAN,CAA4B,CAACvG,KAAD,EAAQM,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACMN,KADN,EAEOM,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dispatchCommand = dispatchCommand;
|
|
7
7
|
exports.getTag = getTag;
|
|
8
|
-
exports.measure =
|
|
9
|
-
exports.scrollTo = void 0;
|
|
8
|
+
exports.scrollTo = exports.measure = void 0;
|
|
10
9
|
exports.setGestureState = setGestureState;
|
|
11
10
|
|
|
12
11
|
var _reactNative = require("react-native");
|
|
@@ -14,48 +13,70 @@ var _reactNative = require("react-native");
|
|
|
14
13
|
var _PlatformChecker = require("./PlatformChecker");
|
|
15
14
|
|
|
16
15
|
/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
-
// @ts-nocheck
|
|
19
16
|
function getTag(view) {
|
|
20
17
|
return (0, _reactNative.findNodeHandle)(view);
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
const
|
|
20
|
+
const isNative = !(0, _PlatformChecker.shouldBeUseWeb)();
|
|
21
|
+
let measure;
|
|
22
|
+
exports.measure = measure;
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if ((0, _PlatformChecker.isWeb)()) {
|
|
25
|
+
exports.measure = measure = animatedRef => {
|
|
26
|
+
const element = animatedRef(); // TODO: fix typing of animated refs on web
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
console.warn('[reanimated.measure] method cannot be used for web or Chrome Debugger');
|
|
28
|
+
const viewportOffset = element.getBoundingClientRect();
|
|
30
29
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
pageX:
|
|
36
|
-
pageY:
|
|
30
|
+
width: element.offsetWidth,
|
|
31
|
+
height: element.offsetHeight,
|
|
32
|
+
x: element.offsetLeft,
|
|
33
|
+
y: element.offsetTop,
|
|
34
|
+
pageX: viewportOffset.left,
|
|
35
|
+
pageY: viewportOffset.top
|
|
37
36
|
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
};
|
|
38
|
+
} else if ((0, _PlatformChecker.isChromeDebugger)()) {
|
|
39
|
+
exports.measure = measure = _animatedRef => {
|
|
40
|
+
console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
exports.measure = measure = animatedRef => {
|
|
45
|
+
'worklet';
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
if (!_WORKLET) {
|
|
48
|
+
console.warn('[Reanimated] measure() was called from the main JS context. Measure is ' + 'only available in the UI runtime. This may also happen if measure() ' + 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' + 'calls the given worklet on the JS runtime during render. If you want to ' + 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' + 'only be called on the UI runtime after the render has been completed.');
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
throw new Error(`The view with tag ${viewTag} could not be measured`);
|
|
46
|
-
}
|
|
52
|
+
const viewTag = animatedRef();
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
if (viewTag === -1) {
|
|
55
|
+
console.warn(`[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
const measured = _measure(viewTag);
|
|
60
|
+
|
|
61
|
+
if (measured === null) {
|
|
62
|
+
console.warn(`[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \`LayoutMetrics\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`);
|
|
63
|
+
return null;
|
|
64
|
+
} else if (measured.x === -1234567) {
|
|
65
|
+
console.warn(`[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`);
|
|
66
|
+
return null;
|
|
67
|
+
} else if (isNaN(measured.x)) {
|
|
68
|
+
console.warn(`[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \`collapsable={false}\` on this component.`);
|
|
69
|
+
return null;
|
|
70
|
+
} else {
|
|
71
|
+
return measured;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
function dispatchCommand(animatedRef, commandName, args) {
|
|
56
77
|
'worklet';
|
|
57
78
|
|
|
58
|
-
if (!_WORKLET ||
|
|
79
|
+
if (!_WORKLET || !isNative) {
|
|
59
80
|
return;
|
|
60
81
|
}
|
|
61
82
|
|
|
@@ -67,17 +88,29 @@ function dispatchCommand(animatedRef, commandName, args) {
|
|
|
67
88
|
let scrollTo;
|
|
68
89
|
exports.scrollTo = scrollTo;
|
|
69
90
|
|
|
70
|
-
if (
|
|
91
|
+
if ((0, _PlatformChecker.isWeb)()) {
|
|
92
|
+
exports.scrollTo = scrollTo = (animatedRef, x, y, animated) => {
|
|
93
|
+
'worklet';
|
|
94
|
+
|
|
95
|
+
const element = animatedRef(); // @ts-ignore same call as in react-native-web
|
|
96
|
+
|
|
97
|
+
element.scrollTo({
|
|
98
|
+
x,
|
|
99
|
+
y,
|
|
100
|
+
animated
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
} else if (isNative && global._IS_FABRIC) {
|
|
71
104
|
exports.scrollTo = scrollTo = (animatedRef, x, y, animated) => {
|
|
72
105
|
'worklet';
|
|
73
106
|
|
|
74
107
|
dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);
|
|
75
108
|
};
|
|
76
|
-
} else {
|
|
109
|
+
} else if (isNative) {
|
|
77
110
|
exports.scrollTo = scrollTo = (animatedRef, x, y, animated) => {
|
|
78
111
|
'worklet';
|
|
79
112
|
|
|
80
|
-
if (!_WORKLET
|
|
113
|
+
if (!_WORKLET) {
|
|
81
114
|
return;
|
|
82
115
|
}
|
|
83
116
|
|
|
@@ -85,12 +118,15 @@ if (global._IS_FABRIC) {
|
|
|
85
118
|
|
|
86
119
|
_scrollTo(viewTag, x, y, animated);
|
|
87
120
|
};
|
|
121
|
+
} else {
|
|
122
|
+
exports.scrollTo = scrollTo = (_animatedRef, _x, _y) => {// no-op
|
|
123
|
+
};
|
|
88
124
|
}
|
|
89
125
|
|
|
90
126
|
function setGestureState(handlerTag, newState) {
|
|
91
127
|
'worklet';
|
|
92
128
|
|
|
93
|
-
if (!_WORKLET ||
|
|
129
|
+
if (!_WORKLET || !isNative) {
|
|
94
130
|
console.warn('[Reanimated] You can not use setGestureState in non-worklet function.');
|
|
95
131
|
return;
|
|
96
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getTag","view","findNodeHandle","
|
|
1
|
+
{"version":3,"names":["getTag","view","findNodeHandle","isNative","shouldBeUseWeb","measure","isWeb","animatedRef","element","viewportOffset","getBoundingClientRect","width","offsetWidth","height","offsetHeight","x","offsetLeft","y","offsetTop","pageX","left","pageY","top","isChromeDebugger","_animatedRef","console","warn","_WORKLET","viewTag","measured","_measure","isNaN","dispatchCommand","commandName","args","shadowNodeWrapper","_dispatchCommand","scrollTo","animated","global","_IS_FABRIC","_scrollTo","_x","_y","setGestureState","handlerTag","newState","_setGestureState"],"sources":["NativeMethods.ts"],"sourcesContent":["/* global _WORKLET _measure _scrollTo _dispatchCommand _setGestureState */\nimport { Component } from 'react';\nimport { findNodeHandle } from 'react-native';\nimport { MeasuredDimensions } from './commonTypes';\nimport { RefObjectFunction } from './hook/commonTypes';\nimport { isChromeDebugger, isWeb, shouldBeUseWeb } from './PlatformChecker';\n\nexport function getTag(\n view: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number {\n return findNodeHandle(view);\n}\n\nconst isNative = !shouldBeUseWeb();\n\nexport let measure: (\n animatedRef: RefObjectFunction<Component>\n) => MeasuredDimensions | null;\n\nif (isWeb()) {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n const element = animatedRef() as unknown as HTMLElement; // TODO: fix typing of animated refs on web\n const viewportOffset = element.getBoundingClientRect();\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: element.offsetLeft,\n y: element.offsetTop,\n pageX: viewportOffset.left,\n pageY: viewportOffset.top,\n };\n };\n} else if (isChromeDebugger()) {\n measure = (_animatedRef: RefObjectFunction<Component>) => {\n console.warn('[Reanimated] measure() cannot be used with Chrome Debugger.');\n return null;\n };\n} else {\n measure = (animatedRef: RefObjectFunction<Component>) => {\n 'worklet';\n if (!_WORKLET) {\n console.warn(\n '[Reanimated] measure() was called from the main JS context. Measure is ' +\n 'only available in the UI runtime. This may also happen if measure() ' +\n 'was called by a worklet in the useAnimatedStyle hook, because useAnimatedStyle ' +\n 'calls the given worklet on the JS runtime during render. If you want to ' +\n 'prevent this warning then wrap the call with `if (_WORKLET)`. Then it will ' +\n 'only be called on the UI runtime after the render has been completed.'\n );\n return null;\n }\n\n const viewTag = animatedRef();\n if (viewTag === -1) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} is not a valid argument for measure(). This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n }\n\n const measured = _measure(viewTag);\n if (measured === null) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} has some undefined, not-yet-computed or meaningless value of \\`LayoutMetrics\\` type. This may be because the view is not currently rendered, which may not be a bug (e.g. an off-screen FlatList item).`\n );\n return null;\n } else if (measured.x === -1234567) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} returned an invalid measurement response.`\n );\n return null;\n } else if (isNaN(measured.x)) {\n console.warn(\n `[Reanimated] The view with tag ${viewTag} gets view-flattened on Android. To disable view-flattening, set \\`collapsable={false}\\` on this component.`\n );\n return null;\n } else {\n return measured;\n }\n };\n}\n\nexport function dispatchCommand(\n animatedRef: RefObjectFunction<Component>,\n commandName: string,\n args: Array<unknown>\n): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n return;\n }\n const shadowNodeWrapper = animatedRef();\n _dispatchCommand(shadowNodeWrapper, commandName, args);\n}\n\nexport let scrollTo: (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n) => void;\n\nif (isWeb()) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n const element = animatedRef() as unknown as HTMLElement;\n // @ts-ignore same call as in react-native-web\n element.scrollTo({ x, y, animated });\n };\n} else if (isNative && global._IS_FABRIC) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n dispatchCommand(animatedRef, 'scrollTo', [x, y, animated]);\n };\n} else if (isNative) {\n scrollTo = (\n animatedRef: RefObjectFunction<Component>,\n x: number,\n y: number,\n animated: boolean\n ) => {\n 'worklet';\n if (!_WORKLET) {\n return;\n }\n const viewTag = animatedRef();\n _scrollTo(viewTag, x, y, animated);\n };\n} else {\n scrollTo = (\n _animatedRef: RefObjectFunction<Component>,\n _x: number,\n _y: number\n ) => {\n // no-op\n };\n}\n\nexport function setGestureState(handlerTag: number, newState: number): void {\n 'worklet';\n if (!_WORKLET || !isNative) {\n console.warn(\n '[Reanimated] You can not use setGestureState in non-worklet function.'\n );\n return;\n }\n _setGestureState(handlerTag, newState);\n}\n"],"mappings":";;;;;;;;;;AAEA;;AAGA;;AALA;AAOO,SAASA,MAAT,CACLC,IADK,EAEU;EACf,OAAO,IAAAC,2BAAA,EAAeD,IAAf,CAAP;AACD;;AAED,MAAME,QAAQ,GAAG,CAAC,IAAAC,+BAAA,GAAlB;AAEO,IAAIC,OAAJ;;;AAIP,IAAI,IAAAC,sBAAA,GAAJ,EAAa;EACX,kBAAAD,OAAO,GAAIE,WAAD,IAA+C;IACvD,MAAMC,OAAO,GAAGD,WAAW,EAA3B,CADuD,CACE;;IACzD,MAAME,cAAc,GAAGD,OAAO,CAACE,qBAAR,EAAvB;IACA,OAAO;MACLC,KAAK,EAAEH,OAAO,CAACI,WADV;MAELC,MAAM,EAAEL,OAAO,CAACM,YAFX;MAGLC,CAAC,EAAEP,OAAO,CAACQ,UAHN;MAILC,CAAC,EAAET,OAAO,CAACU,SAJN;MAKLC,KAAK,EAAEV,cAAc,CAACW,IALjB;MAMLC,KAAK,EAAEZ,cAAc,CAACa;IANjB,CAAP;EAQD,CAXD;AAYD,CAbD,MAaO,IAAI,IAAAC,iCAAA,GAAJ,EAAwB;EAC7B,kBAAAlB,OAAO,GAAImB,YAAD,IAAgD;IACxDC,OAAO,CAACC,IAAR,CAAa,6DAAb;IACA,OAAO,IAAP;EACD,CAHD;AAID,CALM,MAKA;EACL,kBAAArB,OAAO,GAAIE,WAAD,IAA+C;IACvD;;IACA,IAAI,CAACoB,QAAL,EAAe;MACbF,OAAO,CAACC,IAAR,CACE,4EACE,sEADF,GAEE,iFAFF,GAGE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,CAAF;MAAKE,CAAL;MAAQqB;IAAR,CAAjB;EACD,CAVD;AAWD,CAZD,MAYO,IAAInC,QAAQ,IAAIoC,MAAM,CAACC,UAAvB,EAAmC;EACxC,mBAAAH,QAAQ,GAAG,CACT9B,WADS,EAETQ,CAFS,EAGTE,CAHS,EAITqB,QAJS,KAKN;IACH;;IACAN,eAAe,CAACzB,WAAD,EAAc,UAAd,EAA0B,CAACQ,CAAD,EAAIE,CAAJ,EAAOqB,QAAP,CAA1B,CAAf;EACD,CARD;AASD,CAVM,MAUA,IAAInC,QAAJ,EAAc;EACnB,mBAAAkC,QAAQ,GAAG,CACT9B,WADS,EAETQ,CAFS,EAGTE,CAHS,EAITqB,QAJS,KAKN;IACH;;IACA,IAAI,CAACX,QAAL,EAAe;MACb;IACD;;IACD,MAAMC,OAAO,GAAGrB,WAAW,EAA3B;;IACAkC,SAAS,CAACb,OAAD,EAAUb,CAAV,EAAaE,CAAb,EAAgBqB,QAAhB,CAAT;EACD,CAZD;AAaD,CAdM,MAcA;EACL,mBAAAD,QAAQ,GAAG,CACTb,YADS,EAETkB,EAFS,EAGTC,EAHS,KAIN,CACH;EACD,CAND;AAOD;;AAEM,SAASC,eAAT,CAAyBC,UAAzB,EAA6CC,QAA7C,EAAqE;EAC1E;;EACA,IAAI,CAACnB,QAAD,IAAa,CAACxB,QAAlB,EAA4B;IAC1BsB,OAAO,CAACC,IAAR,CACE,uEADF;IAGA;EACD;;EACDqB,gBAAgB,CAACF,UAAD,EAAaC,QAAb,CAAhB;AACD"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.delay = delay;
|
|
7
6
|
exports.withDelay = withDelay;
|
|
8
7
|
|
|
9
8
|
var _util = require("./util");
|
|
@@ -75,15 +74,4 @@ function withDelay(delayMs, _nextAnimation) {
|
|
|
75
74
|
};
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Kept for backward compatibility. Will be removed soon.
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function delay(delayMs, _nextAnimation) {
|
|
84
|
-
'worklet';
|
|
85
|
-
|
|
86
|
-
console.warn('Method `delay` is deprecated. Please use `withDelay` instead');
|
|
87
|
-
return withDelay(delayMs, _nextAnimation);
|
|
88
|
-
}
|
|
89
77
|
//# sourceMappingURL=delay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withDelay","delayMs","_nextAnimation","defineAnimation","nextAnimation","delay","animation","now","startTime","started","previousAnimation","onStart","current","finished","onFrame","value","callback","isHigherOrder"
|
|
1
|
+
{"version":3,"names":["withDelay","delayMs","_nextAnimation","defineAnimation","nextAnimation","delay","animation","now","startTime","started","previousAnimation","onStart","current","finished","onFrame","value","callback","isHigherOrder"],"sources":["delay.ts"],"sourcesContent":["import { defineAnimation } from './util';\nimport { Animation, Timestamp, AnimatableValue } from '../commonTypes';\nimport { NextAnimation, DelayAnimation } from './commonTypes';\n\nexport function withDelay(\n delayMs: number,\n _nextAnimation: NextAnimation<DelayAnimation>\n): Animation<DelayAnimation> {\n 'worklet';\n return defineAnimation<DelayAnimation>(_nextAnimation, () => {\n 'worklet';\n const nextAnimation =\n typeof _nextAnimation === 'function' ? _nextAnimation() : _nextAnimation;\n\n function delay(animation: DelayAnimation, now: Timestamp): boolean {\n const { startTime, started, previousAnimation } = animation;\n\n if (now - startTime > delayMs) {\n if (!started) {\n nextAnimation.onStart(\n nextAnimation,\n animation.current,\n now,\n previousAnimation as DelayAnimation\n );\n animation.previousAnimation = null;\n animation.started = true;\n }\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current;\n return finished;\n } else if (previousAnimation) {\n const finished =\n previousAnimation.finished ||\n previousAnimation.onFrame(previousAnimation, now);\n animation.current = previousAnimation.current;\n if (finished) {\n animation.previousAnimation = null;\n }\n }\n return false;\n }\n\n function onStart(\n animation: DelayAnimation,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: DelayAnimation\n ): void {\n animation.startTime = now;\n animation.started = false;\n animation.current = value;\n if (previousAnimation === animation) {\n animation.previousAnimation = previousAnimation.previousAnimation;\n } else {\n animation.previousAnimation = previousAnimation;\n }\n }\n\n const callback = (finished?: boolean): void => {\n if (nextAnimation.callback) {\n nextAnimation.callback(finished);\n }\n };\n\n return {\n isHigherOrder: true,\n onFrame: delay,\n onStart,\n current: nextAnimation.current,\n callback,\n previousAnimation: null,\n startTime: 0,\n started: false,\n };\n });\n}\n"],"mappings":";;;;;;;AAAA;;AAIO,SAASA,SAAT,CACLC,OADK,EAELC,cAFK,EAGsB;EAC3B;;EACA,OAAO,IAAAC,qBAAA,EAAgCD,cAAhC,EAAgD,MAAM;IAC3D;;IACA,MAAME,aAAa,GACjB,OAAOF,cAAP,KAA0B,UAA1B,GAAuCA,cAAc,EAArD,GAA0DA,cAD5D;;IAGA,SAASG,KAAT,CAAeC,SAAf,EAA0CC,GAA1C,EAAmE;MACjE,MAAM;QAAEC,SAAF;QAAaC,OAAb;QAAsBC;MAAtB,IAA4CJ,SAAlD;;MAEA,IAAIC,GAAG,GAAGC,SAAN,GAAkBP,OAAtB,EAA+B;QAC7B,IAAI,CAACQ,OAAL,EAAc;UACZL,aAAa,CAACO,OAAd,CACEP,aADF,EAEEE,SAAS,CAACM,OAFZ,EAGEL,GAHF,EAIEG,iBAJF;UAMAJ,SAAS,CAACI,iBAAV,GAA8B,IAA9B;UACAJ,SAAS,CAACG,OAAV,GAAoB,IAApB;QACD;;QACD,MAAMI,QAAQ,GAAGT,aAAa,CAACU,OAAd,CAAsBV,aAAtB,EAAqCG,GAArC,CAAjB;QACAD,SAAS,CAACM,OAAV,GAAoBR,aAAa,CAACQ,OAAlC;QACA,OAAOC,QAAP;MACD,CAdD,MAcO,IAAIH,iBAAJ,EAAuB;QAC5B,MAAMG,QAAQ,GACZH,iBAAiB,CAACG,QAAlB,IACAH,iBAAiB,CAACI,OAAlB,CAA0BJ,iBAA1B,EAA6CH,GAA7C,CAFF;QAGAD,SAAS,CAACM,OAAV,GAAoBF,iBAAiB,CAACE,OAAtC;;QACA,IAAIC,QAAJ,EAAc;UACZP,SAAS,CAACI,iBAAV,GAA8B,IAA9B;QACD;MACF;;MACD,OAAO,KAAP;IACD;;IAED,SAASC,OAAT,CACEL,SADF,EAEES,KAFF,EAGER,GAHF,EAIEG,iBAJF,EAKQ;MACNJ,SAAS,CAACE,SAAV,GAAsBD,GAAtB;MACAD,SAAS,CAACG,OAAV,GAAoB,KAApB;MACAH,SAAS,CAACM,OAAV,GAAoBG,KAApB;;MACA,IAAIL,iBAAiB,KAAKJ,SAA1B,EAAqC;QACnCA,SAAS,CAACI,iBAAV,GAA8BA,iBAAiB,CAACA,iBAAhD;MACD,CAFD,MAEO;QACLJ,SAAS,CAACI,iBAAV,GAA8BA,iBAA9B;MACD;IACF;;IAED,MAAMM,QAAQ,GAAIH,QAAD,IAA8B;MAC7C,IAAIT,aAAa,CAACY,QAAlB,EAA4B;QAC1BZ,aAAa,CAACY,QAAd,CAAuBH,QAAvB;MACD;IACF,CAJD;;IAMA,OAAO;MACLI,aAAa,EAAE,IADV;MAELH,OAAO,EAAET,KAFJ;MAGLM,OAHK;MAILC,OAAO,EAAER,aAAa,CAACQ,OAJlB;MAKLI,QALK;MAMLN,iBAAiB,EAAE,IANd;MAOLF,SAAS,EAAE,CAPN;MAQLC,OAAO,EAAE;IARJ,CAAP;EAUD,CAlEM,CAAP;AAmED"}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.loop = loop;
|
|
7
|
-
exports.repeat = repeat;
|
|
8
6
|
exports.withRepeat = withRepeat;
|
|
9
7
|
|
|
10
8
|
var _util = require("./util");
|
|
@@ -82,26 +80,4 @@ function withRepeat(_nextAnimation) {
|
|
|
82
80
|
};
|
|
83
81
|
});
|
|
84
82
|
}
|
|
85
|
-
/**
|
|
86
|
-
* @deprecated Kept for backward compatibility. Will be removed soon.
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function repeat(_nextAnimation) {
|
|
91
|
-
'worklet';
|
|
92
|
-
|
|
93
|
-
let numberOfReps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
94
|
-
let reverse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
95
|
-
let callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
96
|
-
console.warn('Method `repeat` is deprecated. Please use `withRepeat` instead');
|
|
97
|
-
return withRepeat(_nextAnimation, numberOfReps, reverse, callback);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function loop(nextAnimation) {
|
|
101
|
-
'worklet';
|
|
102
|
-
|
|
103
|
-
let numberOfLoops = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
104
|
-
console.warn('Method `loop` is deprecated. Please use `withRepeat` instead');
|
|
105
|
-
return repeat(nextAnimation, Math.round(numberOfLoops * 2), true);
|
|
106
|
-
}
|
|
107
83
|
//# sourceMappingURL=repeat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withRepeat","_nextAnimation","numberOfReps","reverse","callback","defineAnimation","nextAnimation","repeat","animation","now","finished","onFrame","current","reps","startValue","toValue","onStart","previousAnimation","repCallback","value","isHigherOrder"
|
|
1
|
+
{"version":3,"names":["withRepeat","_nextAnimation","numberOfReps","reverse","callback","defineAnimation","nextAnimation","repeat","animation","now","finished","onFrame","current","reps","startValue","toValue","onStart","previousAnimation","repCallback","value","isHigherOrder"],"sources":["repeat.ts"],"sourcesContent":["import { defineAnimation } from './util';\nimport {\n Animation,\n AnimationCallback,\n AnimatableValue,\n Timestamp,\n} from '../commonTypes';\nimport { NextAnimation, RepeatAnimation } from './commonTypes';\n\nexport interface InnerRepeatAnimation\n extends Omit<RepeatAnimation, 'toValue' | 'startValue'> {\n toValue: number;\n startValue: number;\n}\n\nexport function withRepeat(\n _nextAnimation: NextAnimation<RepeatAnimation>,\n numberOfReps = 2,\n reverse = false,\n callback?: AnimationCallback\n): Animation<RepeatAnimation> {\n 'worklet';\n\n return defineAnimation<RepeatAnimation>(_nextAnimation, () => {\n 'worklet';\n\n const nextAnimation: RepeatAnimation =\n typeof _nextAnimation === 'function' ? _nextAnimation() : _nextAnimation;\n\n function repeat(animation: InnerRepeatAnimation, now: Timestamp): boolean {\n const finished = nextAnimation.onFrame(nextAnimation, now);\n animation.current = nextAnimation.current;\n if (finished) {\n animation.reps += 1;\n // call inner animation's callback on every repetition\n // as the second argument the animation's current value is passed\n if (nextAnimation.callback) {\n nextAnimation.callback(true /* finished */, animation.current);\n }\n if (numberOfReps > 0 && animation.reps >= numberOfReps) {\n return true;\n }\n\n const startValue = reverse\n ? (nextAnimation.current as number)\n : animation.startValue;\n if (reverse) {\n nextAnimation.toValue = animation.startValue;\n animation.startValue = startValue;\n }\n nextAnimation.onStart(\n nextAnimation,\n startValue,\n now,\n nextAnimation.previousAnimation as RepeatAnimation\n );\n return false;\n }\n return false;\n }\n\n const repCallback = (finished: boolean): void => {\n if (callback) {\n callback(finished);\n }\n // when cancelled call inner animation's callback\n if (!finished && nextAnimation.callback) {\n nextAnimation.callback(false /* finished */);\n }\n };\n\n function onStart(\n animation: RepeatAnimation,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: RepeatAnimation\n ): void {\n animation.startValue = value;\n animation.reps = 0;\n nextAnimation.onStart(nextAnimation, value, now, previousAnimation);\n }\n\n return {\n isHigherOrder: true,\n onFrame: repeat,\n onStart,\n reps: 0,\n current: nextAnimation.current,\n callback: repCallback,\n startValue: 0,\n } as RepeatAnimation;\n });\n}\n"],"mappings":";;;;;;;AAAA;;AAeO,SAASA,UAAT,CACLC,cADK,EAKuB;EAC5B;;EAD4B,IAH5BC,YAG4B,uEAHb,CAGa;EAAA,I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vCE,aAAa,CAACF,QAAd,CAAuB;QAAM;QAA7B;MACD;IACF,CARD;;IAUA,SAASY,OAAT,CACER,SADF,EAEEW,KAFF,EAGEV,GAHF,EAIEQ,iBAJF,EAKQ;MACNT,SAAS,CAACM,UAAV,GAAuBK,KAAvB;MACAX,SAAS,CAACK,IAAV,GAAiB,CAAjB;MACAP,aAAa,CAACU,OAAd,CAAsBV,aAAtB,EAAqCa,KAArC,EAA4CV,GAA5C,EAAiDQ,iBAAjD;IACD;;IAED,OAAO;MACLG,aAAa,EAAE,IADV;MAELT,OAAO,EAAEJ,MAFJ;MAGLS,OAHK;MAILH,IAAI,EAAE,CAJD;MAKLD,OAAO,EAAEN,aAAa,CAACM,OALlB;MAMLR,QAAQ,EAAEc,WANL;MAOLJ,UAAU,EAAE;IAPP,CAAP;EASD,CApEM,CAAP;AAqED"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.sequence = sequence;
|
|
7
6
|
exports.withSequence = withSequence;
|
|
8
7
|
|
|
9
8
|
var _util = require("./util");
|
|
@@ -89,15 +88,4 @@ function withSequence() {
|
|
|
89
88
|
};
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated Kept for backward compatibility. Will be removed soon.
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
function sequence() {
|
|
98
|
-
'worklet';
|
|
99
|
-
|
|
100
|
-
console.warn('Method `sequence` is deprecated. Please use `withSequence` instead');
|
|
101
|
-
return withSequence(...arguments);
|
|
102
|
-
}
|
|
103
91
|
//# sourceMappingURL=sequence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withSequence","_animations","defineAnimation","animations","map","a","result","finished","firstAnimation","callback","forEach","animation","sequence","now","currentAnim","animationIndex","onFrame","current","length","nextAnim","onStart","value","previousAnimation","undefined","isHigherOrder"
|
|
1
|
+
{"version":3,"names":["withSequence","_animations","defineAnimation","animations","map","a","result","finished","firstAnimation","callback","forEach","animation","sequence","now","currentAnim","animationIndex","onFrame","current","length","nextAnim","onStart","value","previousAnimation","undefined","isHigherOrder"],"sources":["sequence.ts"],"sourcesContent":["import { defineAnimation } from './util';\nimport { NextAnimation, SequenceAnimation } from './commonTypes';\nimport {\n Animation,\n AnimatableValue,\n AnimationObject,\n Timestamp,\n} from '../commonTypes';\n\nexport function withSequence(\n ..._animations: NextAnimation<AnimationObject>[]\n): Animation<SequenceAnimation> {\n 'worklet';\n return defineAnimation<SequenceAnimation>(\n _animations[0] as SequenceAnimation,\n () => {\n 'worklet';\n const animations = _animations.map((a) => {\n const result = typeof a === 'function' ? a() : a;\n result.finished = false;\n return result;\n });\n const firstAnimation = animations[0];\n\n const callback = (finished: boolean): void => {\n if (finished) {\n // we want to call the callback after every single animation\n // not after all of them\n return;\n }\n // this is going to be called only if sequence has been cancelled\n animations.forEach((animation) => {\n if (typeof animation.callback === 'function' && !animation.finished) {\n animation.callback(finished);\n }\n });\n };\n\n function sequence(animation: SequenceAnimation, now: Timestamp): boolean {\n const currentAnim = animations[animation.animationIndex];\n const finished = currentAnim.onFrame(currentAnim, now);\n animation.current = currentAnim.current;\n if (finished) {\n // we want to call the callback after every single animation\n if (currentAnim.callback) {\n currentAnim.callback(true /* finished */);\n }\n currentAnim.finished = true;\n animation.animationIndex += 1;\n if (animation.animationIndex < animations.length) {\n const nextAnim = animations[animation.animationIndex];\n nextAnim.onStart(nextAnim, currentAnim.current, now, currentAnim);\n return false;\n }\n return true;\n }\n return false;\n }\n\n function onStart(\n animation: SequenceAnimation,\n value: AnimatableValue,\n now: Timestamp,\n previousAnimation: SequenceAnimation\n ): void {\n animation.animationIndex = 0;\n if (previousAnimation === undefined) {\n previousAnimation = animations[\n animations.length - 1\n ] as SequenceAnimation;\n }\n firstAnimation.onStart(firstAnimation, value, now, previousAnimation);\n }\n\n return {\n isHigherOrder: true,\n onFrame: sequence,\n onStart,\n animationIndex: 0,\n current: firstAnimation.current,\n callback,\n } as SequenceAnimation;\n }\n );\n}\n"],"mappings":";;;;;;;AAAA;;AASO,SAASA,YAAT,GAEyB;EAC9B;;EAD8B,kCAD3BC,WAC2B;IAD3BA,WAC2B;EAAA;;EAE9B,OAAO,IAAAC,qBAAA,EACLD,WAAW,CAAC,CAAD,CADN,EAEL,MAAM;IACJ;;IACA,MAAME,UAAU,GAAGF,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAO;MACxC,MAAMC,MAAM,GAAG,OAAOD,CAAP,KAAa,UAAb,GAA0BA,CAAC,EAA3B,GAAgCA,CAA/C;MACAC,MAAM,CAACC,QAAP,GAAkB,KAAlB;MACA,OAAOD,MAAP;IACD,CAJkB,CAAnB;;IAKA,MAAME,cAAc,GAAGL,UAAU,CAAC,CAAD,CAAjC;;IAEA,MAAMM,QAAQ,GAAIF,QAAD,IAA6B;MAC5C,IAAIA,QAAJ,EAAc;QACZ;QACA;QACA;MACD,CAL2C,CAM5C;;;MACAJ,UAAU,CAACO,OAAX,CAAoBC,SAAD,IAAe;QAChC,IAAI,OAAOA,SAAS,CAACF,QAAjB,KAA8B,UAA9B,IAA4C,CAACE,SAAS,CAACJ,QAA3D,EAAqE;UACnEI,SAAS,CAACF,QAAV,CAAmBF,QAAnB;QACD;MACF,CAJD;IAKD,CAZD;;IAcA,SAASK,QAAT,CAAkBD,SAAlB,EAAgDE,GAAhD,EAAyE;MACvE,MAAMC,WAAW,GAAGX,UAAU,CAACQ,SAAS,CAACI,cAAX,CAA9B;MACA,MAAMR,QAAQ,GAAGO,WAAW,CAACE,OAAZ,CAAoBF,WAApB,EAAiCD,GAAjC,CAAjB;MACAF,SAAS,CAACM,OAAV,GAAoBH,WAAW,CAACG,OAAhC;;MACA,IAAIV,QAAJ,EAAc;QACZ;QACA,IAAIO,WAAW,CAACL,QAAhB,EAA0B;UACxBK,WAAW,CAACL,QAAZ,CAAqB;UAAK;UAA1B;QACD;;QACDK,WAAW,CAACP,QAAZ,GAAuB,IAAvB;QACAI,SAAS,CAACI,cAAV,IAA4B,CAA5B;;QACA,IAAIJ,SAAS,CAACI,cAAV,GAA2BZ,UAAU,CAACe,MAA1C,EAAkD;UAChD,MAAMC,QAAQ,GAAGhB,UAAU,CAACQ,SAAS,CAACI,cAAX,CAA3B;UACAI,QAAQ,CAACC,OAAT,CAAiBD,QAAjB,EAA2BL,WAAW,CAACG,OAAvC,EAAgDJ,GAAhD,EAAqDC,WAArD;UACA,OAAO,KAAP;QACD;;QACD,OAAO,IAAP;MACD;;MACD,OAAO,KAAP;IACD;;IAED,SAASM,OAAT,CACET,SADF,EAEEU,KAFF,EAGER,GAHF,EAIES,iBAJF,EAKQ;MACNX,SAAS,CAACI,cAAV,GAA2B,CAA3B;;MACA,IAAIO,iBAAiB,KAAKC,SAA1B,EAAqC;QACnCD,iBAAiB,GAAGnB,UAAU,CAC5BA,UAAU,CAACe,MAAX,GAAoB,CADQ,CAA9B;MAGD;;MACDV,cAAc,CAACY,OAAf,CAAuBZ,cAAvB,EAAuCa,KAAvC,EAA8CR,GAA9C,EAAmDS,iBAAnD;IACD;;IAED,OAAO;MACLE,aAAa,EAAE,IADV;MAELR,OAAO,EAAEJ,QAFJ;MAGLQ,OAHK;MAILL,cAAc,EAAE,CAJX;MAKLE,OAAO,EAAET,cAAc,CAACS,OALnB;MAMLR;IANK,CAAP;EAQD,CArEI,CAAP;AAuED"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KeyboardState"],"sources":["commonTypes.ts"],"sourcesContent":["import {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n TranslateXTransform,\n TranslateYTransform,\n SkewXTransform,\n SkewYTransform,\n MatrixTransform,\n ViewStyle,\n TextStyle,\n} from 'react-native';\n\nexport type TransformProperty =\n | PerpectiveTransform\n | RotateTransform\n | RotateXTransform\n | RotateYTransform\n | RotateZTransform\n | ScaleTransform\n | ScaleXTransform\n | ScaleYTransform\n | TranslateXTransform\n | TranslateYTransform\n | SkewXTransform\n | SkewYTransform\n | MatrixTransform;\n\nexport interface StyleProps extends ViewStyle, TextStyle {\n originX?: number;\n originY?: number;\n [key: string]: any;\n}\n\nexport interface AnimatedStyle\n extends Record<string, Animation<AnimationObject>> {\n [key: string]: any;\n transform?: Array<Record<string, Animation<AnimationObject>>>;\n}\nexport interface SharedValue<T> {\n value: T;\n}\n\nexport type Context = Record<string, unknown>;\n\nexport interface WorkletFunction {\n _closure?: Context;\n __workletHash?: number;\n __optimalization?: number;\n}\n\nexport interface BasicWorkletFunction<T> extends WorkletFunction {\n (): T;\n}\n\nexport interface BasicWorkletFunctionOptional<T> extends WorkletFunction {\n (): Partial<T>;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T;\n}\nexport interface ComplexWorkletFunction<A extends any[], R>\n extends WorkletFunction {\n (...args: A): R;\n}\n\nexport interface NestedObject<T> {\n [key: string]: NestedObjectValues<T>;\n}\n\nexport type NestedObjectValues<T> =\n | T\n | Array<NestedObjectValues<T>>\n | NestedObject<T>;\n\nexport interface AdapterWorkletFunction extends WorkletFunction {\n (value: NestedObject<string | number | AnimationObject>): void;\n}\n\nexport type AnimatableValue = number | string | Array<number>;\n\nexport interface AnimationObject {\n [key: string]: any;\n callback: AnimationCallback;\n current?: AnimatableValue;\n toValue?: AnimationObject['current'];\n startValue?: AnimationObject['current'];\n finished?: boolean;\n strippedCurrent?: number;\n cancelled?: boolean;\n\n __prefix?: string;\n __suffix?: string;\n onFrame: (animation: any, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: any,\n current: any,\n timestamp: Timestamp,\n previousAnimation: any\n ) => void;\n}\n\nexport interface Animation<T extends AnimationObject> extends AnimationObject {\n onFrame: (animation: T, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: T,\n current: T extends NumericAnimation ? number : AnimatableValue,\n timestamp: Timestamp,\n previousAnimation: T\n ) => void;\n}\n\nexport interface NumericAnimation {\n current?: number;\n}\n\nexport type AnimationCallback = (\n finished?: boolean,\n current?: AnimatableValue\n) => void;\n\nexport type Timestamp = number;\n\nexport type Value3D = {\n x: number;\n y: number;\n z: number;\n};\n\nexport type SensorValue3D = SharedValue<Value3D>;\n\nexport type ValueRotation = {\n qw: number;\n qx: number;\n qy: number;\n qz: number;\n yaw: number;\n pitch: number;\n roll: number;\n};\n\nexport type SensorValueRotation = SharedValue<ValueRotation>;\n\nexport type ShadowNodeWrapper = object;\n\nexport enum KeyboardState {\n UNKNOWN = 0,\n OPENING = 1,\n OPEN = 2,\n CLOSING = 3,\n CLOSED = 4,\n}\n\nexport type AnimatedKeyboardInfo = {\n height: SharedValue<number>;\n state: SharedValue<KeyboardState>;\n};\n"],"mappings":";;;;;;IAuJYA,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}
|
|
1
|
+
{"version":3,"names":["KeyboardState"],"sources":["commonTypes.ts"],"sourcesContent":["import {\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n TranslateXTransform,\n TranslateYTransform,\n SkewXTransform,\n SkewYTransform,\n MatrixTransform,\n ViewStyle,\n TextStyle,\n} from 'react-native';\n\nexport type TransformProperty =\n | PerpectiveTransform\n | RotateTransform\n | RotateXTransform\n | RotateYTransform\n | RotateZTransform\n | ScaleTransform\n | ScaleXTransform\n | ScaleYTransform\n | TranslateXTransform\n | TranslateYTransform\n | SkewXTransform\n | SkewYTransform\n | MatrixTransform;\n\nexport interface StyleProps extends ViewStyle, TextStyle {\n originX?: number;\n originY?: number;\n [key: string]: any;\n}\n\nexport interface AnimatedStyle\n extends Record<string, Animation<AnimationObject>> {\n [key: string]: any;\n transform?: Array<Record<string, Animation<AnimationObject>>>;\n}\nexport interface SharedValue<T> {\n value: T;\n}\n\nexport type Context = Record<string, unknown>;\n\nexport interface WorkletFunction {\n _closure?: Context;\n __workletHash?: number;\n __optimalization?: number;\n}\n\nexport interface BasicWorkletFunction<T> extends WorkletFunction {\n (): T;\n}\n\nexport interface BasicWorkletFunctionOptional<T> extends WorkletFunction {\n (): Partial<T>;\n}\n\nexport interface NativeEvent<T> {\n nativeEvent: T;\n}\nexport interface ComplexWorkletFunction<A extends any[], R>\n extends WorkletFunction {\n (...args: A): R;\n}\n\nexport interface NestedObject<T> {\n [key: string]: NestedObjectValues<T>;\n}\n\nexport type NestedObjectValues<T> =\n | T\n | Array<NestedObjectValues<T>>\n | NestedObject<T>;\n\nexport interface AdapterWorkletFunction extends WorkletFunction {\n (value: NestedObject<string | number | AnimationObject>): void;\n}\n\nexport type AnimatableValue = number | string | Array<number>;\n\nexport interface AnimationObject {\n [key: string]: any;\n callback: AnimationCallback;\n current?: AnimatableValue;\n toValue?: AnimationObject['current'];\n startValue?: AnimationObject['current'];\n finished?: boolean;\n strippedCurrent?: number;\n cancelled?: boolean;\n\n __prefix?: string;\n __suffix?: string;\n onFrame: (animation: any, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: any,\n current: any,\n timestamp: Timestamp,\n previousAnimation: any\n ) => void;\n}\n\nexport interface Animation<T extends AnimationObject> extends AnimationObject {\n onFrame: (animation: T, timestamp: Timestamp) => boolean;\n onStart: (\n nextAnimation: T,\n current: T extends NumericAnimation ? number : AnimatableValue,\n timestamp: Timestamp,\n previousAnimation: T\n ) => void;\n}\n\nexport interface NumericAnimation {\n current?: number;\n}\n\nexport type AnimationCallback = (\n finished?: boolean,\n current?: AnimatableValue\n) => void;\n\nexport type Timestamp = number;\n\nexport type Value3D = {\n x: number;\n y: number;\n z: number;\n};\n\nexport type SensorValue3D = SharedValue<Value3D>;\n\nexport type ValueRotation = {\n qw: number;\n qx: number;\n qy: number;\n qz: number;\n yaw: number;\n pitch: number;\n roll: number;\n};\n\nexport type SensorValueRotation = SharedValue<ValueRotation>;\n\nexport type ShadowNodeWrapper = object;\n\nexport enum KeyboardState {\n UNKNOWN = 0,\n OPENING = 1,\n OPEN = 2,\n CLOSING = 3,\n CLOSED = 4,\n}\n\nexport type AnimatedKeyboardInfo = {\n height: SharedValue<number>;\n state: SharedValue<KeyboardState>;\n};\n\nexport interface MeasuredDimensions {\n x: number;\n y: number;\n width: number;\n height: number;\n pageX: number;\n pageY: number;\n}\n"],"mappings":";;;;;;IAuJYA,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}
|
|
@@ -33,19 +33,19 @@ class FrameCallbackRegistryJS {
|
|
|
33
33
|
return callbackId;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
unregisterFrameCallback(
|
|
36
|
+
unregisterFrameCallback(callbackId) {
|
|
37
37
|
(0, _core.runOnUI)(() => {
|
|
38
38
|
'worklet';
|
|
39
39
|
|
|
40
|
-
global._frameCallbackRegistry.unregisterFrameCallback(
|
|
40
|
+
global._frameCallbackRegistry.unregisterFrameCallback(callbackId);
|
|
41
41
|
})();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
manageStateFrameCallback(
|
|
44
|
+
manageStateFrameCallback(callbackId, state) {
|
|
45
45
|
(0, _core.runOnUI)(() => {
|
|
46
46
|
'worklet';
|
|
47
47
|
|
|
48
|
-
global._frameCallbackRegistry.manageStateFrameCallback(
|
|
48
|
+
global._frameCallbackRegistry.manageStateFrameCallback(callbackId, state);
|
|
49
49
|
})();
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FrameCallbackRegistryJS","constructor","prepareUIRegistry","registerFrameCallback","callback","callbackId","nextCallbackId","runOnUI","global","_frameCallbackRegistry","unregisterFrameCallback","
|
|
1
|
+
{"version":3,"names":["FrameCallbackRegistryJS","constructor","prepareUIRegistry","registerFrameCallback","callback","callbackId","nextCallbackId","runOnUI","global","_frameCallbackRegistry","unregisterFrameCallback","manageStateFrameCallback","state"],"sources":["FrameCallbackRegistryJS.ts"],"sourcesContent":["import { runOnUI } from '../core';\nimport { FrameInfo, prepareUIRegistry } from './FrameCallbackRegistryUI';\n\nexport default class FrameCallbackRegistryJS {\n private nextCallbackId = 0;\n\n constructor() {\n prepareUIRegistry();\n }\n\n registerFrameCallback(callback: (frameInfo: FrameInfo) => void): number {\n if (!callback) {\n return -1;\n }\n\n const callbackId = this.nextCallbackId;\n this.nextCallbackId++;\n\n runOnUI(() => {\n 'worklet';\n global._frameCallbackRegistry.registerFrameCallback(callback, callbackId);\n })();\n\n return callbackId;\n }\n\n unregisterFrameCallback(callbackId: number): void {\n runOnUI(() => {\n 'worklet';\n global._frameCallbackRegistry.unregisterFrameCallback(callbackId);\n })();\n }\n\n manageStateFrameCallback(callbackId: number, state: boolean): void {\n runOnUI(() => {\n 'worklet';\n global._frameCallbackRegistry.manageStateFrameCallback(callbackId, state);\n })();\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEe,MAAMA,uBAAN,CAA8B;EAG3CC,WAAW,GAAG;IAAA,wCAFW,CAEX;;IACZ,IAAAC,0CAAA;EACD;;EAEDC,qBAAqB,CAACC,QAAD,EAAmD;IACtE,IAAI,CAACA,QAAL,EAAe;MACb,OAAO,CAAC,CAAR;IACD;;IAED,MAAMC,UAAU,GAAG,KAAKC,cAAxB;IACA,KAAKA,cAAL;IAEA,IAAAC,aAAA,EAAQ,MAAM;MACZ;;MACAC,MAAM,CAACC,sBAAP,CAA8BN,qBAA9B,CAAoDC,QAApD,EAA8DC,UAA9D;IACD,CAHD;IAKA,OAAOA,UAAP;EACD;;EAEDK,uBAAuB,CAACL,UAAD,EAA2B;IAChD,IAAAE,aAAA,EAAQ,MAAM;MACZ;;MACAC,MAAM,CAACC,sBAAP,CAA8BC,uBAA9B,CAAsDL,UAAtD;IACD,CAHD;EAID;;EAEDM,wBAAwB,CAACN,UAAD,EAAqBO,KAArB,EAA2C;IACjE,IAAAL,aAAA,EAAQ,MAAM;MACZ;;MACAC,MAAM,CAACC,sBAAP,CAA8BE,wBAA9B,CAAuDN,UAAvD,EAAmEO,KAAnE;IACD,CAHD;EAID;;AAnC0C"}
|