react-native-reanimated 3.0.0 → 3.0.1
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/README.md +1 -1
- package/lib/commonjs/createAnimatedComponent.js +12 -0
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +3 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +1 -1
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +5 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +10 -13
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +1 -1
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +12 -0
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +2 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +1 -1
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +5 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -1
- package/lib/module/reanimated2/threads.js +10 -13
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +1 -1
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/mock.js +1 -211
- package/package.json +1 -1
- package/react-native-reanimated.d.ts +4 -413
- package/src/createAnimatedComponent.tsx +9 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +2 -0
- package/src/reanimated2/initializers.ts +1 -1
- package/src/reanimated2/layoutReanimation/animationsManager.ts +3 -0
- package/src/reanimated2/mock.ts +1 -1
- package/src/reanimated2/platform-specific/checkVersion.ts +1 -1
- package/src/reanimated2/threads.ts +10 -13
- package/src/reanimated2/utils.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
### React Native's Animated library reimplemented
|
|
4
4
|
|
|
5
|
-
> Reanimated
|
|
5
|
+
> Reanimated 3 is here! Check out our [documentation page](https://docs.swmansion.com/react-native-reanimated/) for more information
|
|
6
6
|
|
|
7
7
|
React Native Reanimated provides a more comprehensive,
|
|
8
8
|
low level abstraction for the Animated library API to be built
|
|
@@ -106,10 +106,18 @@ const has = (key, x) => {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
function isInlineStyleTransform(transform) {
|
|
109
|
+
if (!transform) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
109
113
|
return transform.some(t => hasInlineStyles(t));
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
function hasInlineStyles(style) {
|
|
117
|
+
if (!style) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
return Object.keys(style).some(key => {
|
|
114
122
|
const styleValue = style[key];
|
|
115
123
|
return (0, _reanimated.isSharedValue)(styleValue) || key === 'transform' && isInlineStyleTransform(styleValue);
|
|
@@ -125,6 +133,10 @@ function extractSharedValuesMapFromProps(props) {
|
|
|
125
133
|
if (key === 'style') {
|
|
126
134
|
const styles = flattenArray(props.style ?? []);
|
|
127
135
|
styles.forEach(style => {
|
|
136
|
+
if (!style) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
128
140
|
for (const [key, styleValue] of Object.entries(style)) {
|
|
129
141
|
if ((0, _reanimated.isSharedValue)(styleValue)) {
|
|
130
142
|
inlineProps[key] = styleValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","isInlineStyleTransform","transform","some","t","hasInlineStyles","Object","keys","styleValue","isSharedValue","extractSharedValuesMapFromProps","props","inlineProps","entries","inlinePropsHasChanged","styles1","styles2","length","getInlinePropsUpdate","update","map","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","sharedTransitionTag","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","LayoutAnimationType","LAYOUT","ENTERING","EXITING","sharedElementTransition","sharedTransitionStyle","DefaultSharedTransition","SHARED_ELEMENT_TRANSITION","_component","isJest","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","_detachInlineProps","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","_attachInlineProps","_getEventViewRef","getScrollableNode","node","viewTag","setNativeProps","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","_getViewInfo","viewName","shadowNodeWrapper","viewConfig","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","uiViewClassName","getShadowNodeWrapperFromRef","prevStyles","prevAnimatedProps","_animatedProps","hasReanimated2Props","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","add","name","initial","newInlineProps","hasChanged","_inlineProps","_inlinePropsViewDescriptors","makeViewDescriptorsSet","sharableViewDescriptors","maybeViewRef","NativeReanimatedModule","native","items","Set","updaterFunction","updateProps","_inlinePropsMapperId","stopMapper","startMapper","values","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","_isFirstRender","initialStyle","initialUpdaterRun","updater","newStyle","StyleSheet","flatten","animatedProp","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/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n startMapper,\n stopMapper,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n DefaultSharedTransition,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n makeViewDescriptorsSet,\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport updateProps from './reanimated2/UpdateProps';\nimport NativeReanimatedModule from './reanimated2/NativeReanimated';\nimport { isSharedValue } from './reanimated2';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\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\nfunction isInlineStyleTransform(transform: any): boolean {\n return transform.some((t: Record<string, any>) => hasInlineStyles(t));\n}\n\nfunction hasInlineStyles(style: StyleProps): boolean {\n return Object.keys(style).some((key) => {\n const styleValue = style[key];\n return (\n isSharedValue(styleValue) ||\n (key === 'transform' && isInlineStyleTransform(styleValue))\n );\n });\n}\n\nfunction extractSharedValuesMapFromProps(\n props: AnimatedComponentProps<InitialComponentProps>\n): Record<string, any> {\n const inlineProps: Record<string, any> = {};\n\n for (const key in props) {\n const value = props[key];\n if (key === 'style') {\n const styles = flattenArray<StyleProps>(props.style ?? []);\n styles.forEach((style) => {\n for (const [key, styleValue] of Object.entries(style)) {\n if (isSharedValue(styleValue)) {\n inlineProps[key] = styleValue;\n } else if (\n key === 'transform' &&\n isInlineStyleTransform(styleValue)\n ) {\n inlineProps[key] = styleValue;\n }\n }\n });\n } else if (isSharedValue(value)) {\n inlineProps[key] = value;\n }\n }\n\n return inlineProps;\n}\n\nfunction inlinePropsHasChanged(styles1: StyleProps, styles2: StyleProps) {\n if (Object.keys(styles1).length !== Object.keys(styles2).length) {\n return true;\n }\n\n for (const key of Object.keys(styles1)) {\n if (styles1[key] !== styles2[key]) return true;\n }\n\n return false;\n}\n\nfunction getInlinePropsUpdate(inlineProps: Record<string, any>) {\n 'worklet';\n const update: Record<string, any> = {};\n for (const [key, styleValue] of Object.entries(inlineProps)) {\n if (key === 'transform') {\n update[key] = styleValue.map((transform: Record<string, any>) => {\n return getInlinePropsUpdate(transform);\n });\n } else if (isSharedValue(styleValue)) {\n update[key] = styleValue.value;\n } else {\n update[key] = styleValue;\n }\n }\n return update;\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 sharedTransitionTag?: string;\n sharedTransitionStyle?: ILayoutAnimationBuilder;\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 _component: ComponentRef | null = null;\n _inlinePropsViewDescriptors: ViewDescriptorsSet | null = null;\n _inlinePropsMapperId: number | null = null;\n _inlineProps: StyleProps = {};\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this._detachInlineProps();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n this._attachInlineProps();\n }\n\n _getEventViewRef() {\n // Make sure to get the scrollable node for components that implement\n // `ScrollResponder.Mixin`.\n return this._component?.getScrollableNode\n ? this._component.getScrollableNode()\n : this._component;\n }\n\n _attachNativeEvents() {\n const node = this._getEventViewRef();\n const viewTag = findNodeHandle(options?.setNativeProps ? this : node);\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 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 viewTag = this._viewTag;\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(viewTag);\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 _getViewInfo() {\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n let viewConfig;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n viewConfig = 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\n viewConfig = hostInstance?.viewConfig;\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n return { viewTag, viewName, shadowNodeWrapper, viewConfig };\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 const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && viewConfig) {\n adaptViewConfig(viewConfig);\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 _attachInlineProps() {\n const newInlineProps: Record<string, any> =\n extractSharedValuesMapFromProps(this.props);\n const hasChanged = inlinePropsHasChanged(\n newInlineProps,\n this._inlineProps\n );\n\n if (hasChanged) {\n if (!this._inlinePropsViewDescriptors) {\n this._inlinePropsViewDescriptors = makeViewDescriptorsSet();\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n if (Object.keys(newInlineProps).length && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._inlinePropsViewDescriptors.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 const sharableViewDescriptors =\n this._inlinePropsViewDescriptors.sharableViewDescriptors;\n\n const maybeViewRef = NativeReanimatedModule.native\n ? undefined\n : ({ items: new Set([this]) } as ViewRefSet<any>); // see makeViewsRefSet\n\n const updaterFunction = () => {\n 'worklet';\n const update = getInlinePropsUpdate(newInlineProps);\n updateProps(sharableViewDescriptors, update, maybeViewRef);\n };\n this._inlineProps = newInlineProps;\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n this._inlinePropsMapperId = null;\n if (Object.keys(newInlineProps).length) {\n this._inlinePropsMapperId = startMapper(\n updaterFunction,\n Object.values(newInlineProps)\n );\n }\n }\n }\n\n _detachInlineProps() {\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n this._attachInlineProps();\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 const { layout, entering, exiting, sharedTransitionTag } = this.props;\n if (\n (layout || entering || exiting || sharedTransitionTag) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.LAYOUT,\n maybeBuild(layout)\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.ENTERING,\n maybeBuild(entering)\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.EXITING,\n maybeBuild(exiting)\n );\n }\n if (sharedTransitionTag) {\n const sharedElementTransition =\n this.props.sharedTransitionStyle ?? DefaultSharedTransition;\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.SHARED_ELEMENT_TRANSITION,\n maybeBuild(sharedElementTransition),\n sharedTransitionTag\n );\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 if (hasInlineStyles(style)) {\n if (this._isFirstRender) {\n return getInlinePropsUpdate(style);\n }\n const newStyle: StyleProps = {};\n for (const [key, styleValue] of Object.entries(style)) {\n if (\n !isSharedValue(styleValue) &&\n !(key === 'transform' && isInlineStyleTransform(styleValue))\n ) {\n newStyle[key] = styleValue;\n }\n }\n return newStyle;\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 (isSharedValue(value)) {\n if (this._isFirstRender) {\n props[key] = (value as SharedValue<any>).value;\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;;AAOA;;AAKA;;AACA;;AAaA;;AAKA;;AACA;;AACA;;AACA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,wBAAD,CAAtB,EAAkD;IAChD,OAAOA,wBAAwB,CAACG,KAAzB,EAAP;EACD,CAFD,MAEO;IACL,OAAOH,wBAAP;EACD;AACF;;AAGD,SAASI,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,GAA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BAAL,CAA6B,KAAKpH,KAAlC,CAAd;;MACA,IAAI,IAAA0C,uBAAA,GAAJ,EAAc;QACZ1C,KAAK,CAAC2C,aAAN,GAAsB,KAAKA,aAA3B;MACD;;MAED,IAAI,KAAK6E,cAAT,EAAyB;QACvB,KAAKA,cAAL,GAAsB,KAAtB;MACD;;MAED,MAAMa,aAAa,GAAGvE,qBAAA,CAASwE,MAAT,CAAgB;QACpCC,GAAG,EAAE,EAD+B;QAEpCC,OAAO,EAAE;UAAEC,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;;MAIA,oBACE,6BAAC,SAAD,eAAezI,KAAf;QAAsB,GAAG,EAAE,KAAK0I;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EAheD;;EAV4D,gBAQxDrH,iBARwD;;EA6e9DA,iBAAiB,CAAC2H,WAAlB,GAAiC,qBAC/BhI,SAAS,CAACgI,WAAV,IAAyBhI,SAAS,CAACqF,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO/E,cAAA,CAAM2H,UAAN,CAA4B,CAAC5I,KAAD,EAAQuB,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACMvB,KADN,EAEOuB,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
1
|
+
{"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","isInlineStyleTransform","transform","some","t","hasInlineStyles","Object","keys","styleValue","isSharedValue","extractSharedValuesMapFromProps","props","inlineProps","entries","inlinePropsHasChanged","styles1","styles2","length","getInlinePropsUpdate","update","map","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","sharedTransitionTag","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","LayoutAnimationType","LAYOUT","ENTERING","EXITING","sharedElementTransition","sharedTransitionStyle","DefaultSharedTransition","SHARED_ELEMENT_TRANSITION","_component","isJest","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","_detachInlineProps","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","_attachInlineProps","_getEventViewRef","getScrollableNode","node","viewTag","setNativeProps","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","_getViewInfo","viewName","shadowNodeWrapper","viewConfig","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","uiViewClassName","getShadowNodeWrapperFromRef","prevStyles","prevAnimatedProps","_animatedProps","hasReanimated2Props","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","add","name","initial","newInlineProps","hasChanged","_inlineProps","_inlinePropsViewDescriptors","makeViewDescriptorsSet","sharableViewDescriptors","maybeViewRef","NativeReanimatedModule","native","items","Set","updaterFunction","updateProps","_inlinePropsMapperId","stopMapper","startMapper","values","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","_isFirstRender","initialStyle","initialUpdaterRun","updater","newStyle","StyleSheet","flatten","animatedProp","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/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n startMapper,\n stopMapper,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n DefaultSharedTransition,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n makeViewDescriptorsSet,\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport updateProps from './reanimated2/UpdateProps';\nimport NativeReanimatedModule from './reanimated2/NativeReanimated';\nimport { isSharedValue } from './reanimated2';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\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\nfunction isInlineStyleTransform(transform: any): boolean {\n if (!transform) {\n return false;\n }\n return transform.some((t: Record<string, any>) => hasInlineStyles(t));\n}\n\nfunction hasInlineStyles(style: StyleProps): boolean {\n if (!style) {\n return false;\n }\n return Object.keys(style).some((key) => {\n const styleValue = style[key];\n return (\n isSharedValue(styleValue) ||\n (key === 'transform' && isInlineStyleTransform(styleValue))\n );\n });\n}\n\nfunction extractSharedValuesMapFromProps(\n props: AnimatedComponentProps<InitialComponentProps>\n): Record<string, any> {\n const inlineProps: Record<string, any> = {};\n\n for (const key in props) {\n const value = props[key];\n if (key === 'style') {\n const styles = flattenArray<StyleProps>(props.style ?? []);\n styles.forEach((style) => {\n if (!style) {\n return;\n }\n for (const [key, styleValue] of Object.entries(style)) {\n if (isSharedValue(styleValue)) {\n inlineProps[key] = styleValue;\n } else if (\n key === 'transform' &&\n isInlineStyleTransform(styleValue)\n ) {\n inlineProps[key] = styleValue;\n }\n }\n });\n } else if (isSharedValue(value)) {\n inlineProps[key] = value;\n }\n }\n\n return inlineProps;\n}\n\nfunction inlinePropsHasChanged(styles1: StyleProps, styles2: StyleProps) {\n if (Object.keys(styles1).length !== Object.keys(styles2).length) {\n return true;\n }\n\n for (const key of Object.keys(styles1)) {\n if (styles1[key] !== styles2[key]) return true;\n }\n\n return false;\n}\n\nfunction getInlinePropsUpdate(inlineProps: Record<string, any>) {\n 'worklet';\n const update: Record<string, any> = {};\n for (const [key, styleValue] of Object.entries(inlineProps)) {\n if (key === 'transform') {\n update[key] = styleValue.map((transform: Record<string, any>) => {\n return getInlinePropsUpdate(transform);\n });\n } else if (isSharedValue(styleValue)) {\n update[key] = styleValue.value;\n } else {\n update[key] = styleValue;\n }\n }\n return update;\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 sharedTransitionTag?: string;\n sharedTransitionStyle?: ILayoutAnimationBuilder;\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 _component: ComponentRef | null = null;\n _inlinePropsViewDescriptors: ViewDescriptorsSet | null = null;\n _inlinePropsMapperId: number | null = null;\n _inlineProps: StyleProps = {};\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this._detachInlineProps();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n this._attachInlineProps();\n }\n\n _getEventViewRef() {\n // Make sure to get the scrollable node for components that implement\n // `ScrollResponder.Mixin`.\n return this._component?.getScrollableNode\n ? this._component.getScrollableNode()\n : this._component;\n }\n\n _attachNativeEvents() {\n const node = this._getEventViewRef();\n const viewTag = findNodeHandle(options?.setNativeProps ? this : node);\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 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 viewTag = this._viewTag;\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(viewTag);\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 _getViewInfo() {\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n let viewConfig;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n viewConfig = 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\n viewConfig = hostInstance?.viewConfig;\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n return { viewTag, viewName, shadowNodeWrapper, viewConfig };\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 const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && viewConfig) {\n adaptViewConfig(viewConfig);\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 _attachInlineProps() {\n const newInlineProps: Record<string, any> =\n extractSharedValuesMapFromProps(this.props);\n const hasChanged = inlinePropsHasChanged(\n newInlineProps,\n this._inlineProps\n );\n\n if (hasChanged) {\n if (!this._inlinePropsViewDescriptors) {\n this._inlinePropsViewDescriptors = makeViewDescriptorsSet();\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n if (Object.keys(newInlineProps).length && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._inlinePropsViewDescriptors.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 const sharableViewDescriptors =\n this._inlinePropsViewDescriptors.sharableViewDescriptors;\n\n const maybeViewRef = NativeReanimatedModule.native\n ? undefined\n : ({ items: new Set([this]) } as ViewRefSet<any>); // see makeViewsRefSet\n\n const updaterFunction = () => {\n 'worklet';\n const update = getInlinePropsUpdate(newInlineProps);\n updateProps(sharableViewDescriptors, update, maybeViewRef);\n };\n this._inlineProps = newInlineProps;\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n this._inlinePropsMapperId = null;\n if (Object.keys(newInlineProps).length) {\n this._inlinePropsMapperId = startMapper(\n updaterFunction,\n Object.values(newInlineProps)\n );\n }\n }\n }\n\n _detachInlineProps() {\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n this._attachInlineProps();\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 const { layout, entering, exiting, sharedTransitionTag } = this.props;\n if (\n (layout || entering || exiting || sharedTransitionTag) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.LAYOUT,\n maybeBuild(layout)\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.ENTERING,\n maybeBuild(entering)\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.EXITING,\n maybeBuild(exiting)\n );\n }\n if (sharedTransitionTag) {\n const sharedElementTransition =\n this.props.sharedTransitionStyle ?? DefaultSharedTransition;\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.SHARED_ELEMENT_TRANSITION,\n maybeBuild(sharedElementTransition),\n sharedTransitionTag\n );\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 if (hasInlineStyles(style)) {\n if (this._isFirstRender) {\n return getInlinePropsUpdate(style);\n }\n const newStyle: StyleProps = {};\n for (const [key, styleValue] of Object.entries(style)) {\n if (\n !isSharedValue(styleValue) &&\n !(key === 'transform' && isInlineStyleTransform(styleValue))\n ) {\n newStyle[key] = styleValue;\n }\n }\n return newStyle;\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 (isSharedValue(value)) {\n if (this._isFirstRender) {\n props[key] = (value as SharedValue<any>).value;\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;;AAOA;;AAKA;;AACA;;AAaA;;AAKA;;AACA;;AACA;;AACA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,wBAAD,CAAtB,EAAkD;IAChD,OAAOA,wBAAwB,CAACG,KAAzB,EAAP;EACD,CAFD,MAEO;IACL,OAAOH,wBAAP;EACD;AACF;;AAGD,SAASI,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,KAAD,CAAb;;EACA,OAAOG,SAAP;AACD;;AAED,SAASM,kBAAT,CAA4BC,MAA5B,EAAkD;EAChD,OAAOA,MAAM,CAACC,MAAP,CAAeC,KAAD,IAAWA,KAAX,aAAWA,KAAX,uBAAWA,KAAK,CAAEC,eAAhC,CAAP;AACD;;AAED,SAASC,mBAAT,CACEC,MADF,EAEEC,MAFF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C,WAAW,EAAE;QAAf;MAF2B,CAAhB,CAAtB;;MAIA,oBACE,6BAAC,SAAD,eAAezI,KAAf;QAAsB,GAAG,EAAE,KAAK0I;MAAhC,GAAsDL,aAAtD,EADF;IAGD;;EAheD;;EAV4D,gBAQxDrH,iBARwD;;EA6e9DA,iBAAiB,CAAC2H,WAAlB,GAAiC,qBAC/BhI,SAAS,CAACgI,WAAV,IAAyBhI,SAAS,CAACqF,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAO/E,cAAA,CAAM2H,UAAN,CAA4B,CAAC5I,KAAD,EAAQuB,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACMvB,KADN,EAEOuB,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
|
|
@@ -11,6 +11,8 @@ var _core = require("../core");
|
|
|
11
11
|
|
|
12
12
|
var _commonTypes = require("../commonTypes");
|
|
13
13
|
|
|
14
|
+
var _threads = require("../threads");
|
|
15
|
+
|
|
14
16
|
function initSensorData(sensorType) {
|
|
15
17
|
if (sensorType === _commonTypes.SensorType.ROTATION) {
|
|
16
18
|
return (0, _core.makeMutable)({
|
|
@@ -134,6 +136,7 @@ function useAnimatedSensor(sensorType, userConfig) {
|
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
sensorData.value = data;
|
|
139
|
+
(0, _threads.flushImmediates)();
|
|
137
140
|
});
|
|
138
141
|
|
|
139
142
|
if (id !== -1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["initSensorData","sensorType","SensorType","ROTATION","makeMutable","qw","qx","qy","qz","yaw","pitch","roll","interfaceOrientation","x","y","z","eulerToQuaternion","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","PI","q","adjustVectorToInterfaceOrientation","useAnimatedSensor","userConfig","ref","useRef","sensor","unregister","isAvailable","config","interval","adjustToInterfaceOrientation","iosReferenceFrame","IOSReferenceFrame","Auto","useEffect","current","sensorData","id","registerSensor","value","unregisterSensor"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { makeMutable, registerSensor, unregisterSensor } from '../core';\nimport {\n SensorType,\n SharedValue,\n Value3D,\n ValueRotation,\n IOSReferenceFrame,\n} from '../commonTypes';\n\nexport type SensorConfig = {\n interval: number | 'auto';\n adjustToInterfaceOrientation: boolean;\n iosReferenceFrame: IOSReferenceFrame;\n};\n\nexport type AnimatedSensor = {\n sensor: SharedValue<Value3D | ValueRotation>;\n unregister: () => void;\n isAvailable: boolean;\n config: SensorConfig;\n};\n\nfunction initSensorData(\n sensorType: SensorType\n): SharedValue<Value3D | ValueRotation> {\n if (sensorType === SensorType.ROTATION) {\n return makeMutable<Value3D | ValueRotation>({\n qw: 0,\n qx: 0,\n qy: 0,\n qz: 0,\n yaw: 0,\n pitch: 0,\n roll: 0,\n interfaceOrientation: 0,\n });\n } else {\n return makeMutable<Value3D | ValueRotation>({\n x: 0,\n y: 0,\n z: 0,\n interfaceOrientation: 0,\n });\n }\n}\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === 90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === 270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === 180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === 90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === 270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === 180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor {\n const ref = useRef<AnimatedSensor>({\n sensor: initSensorData(sensorType),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config: {\n interval: 0,\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n },\n });\n\n useEffect(() => {\n ref.current.config = {\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfig,\n };\n const sensorData = ref.current.sensor!;\n const id = registerSensor(\n sensorType,\n ref.current.config.interval === 'auto' ? -1 : ref.current.config.interval,\n ref.current.config.iosReferenceFrame,\n (data) => {\n 'worklet';\n if (ref.current.config.adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n }\n );\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, userConfig]);\n\n return ref.current;\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"names":["initSensorData","sensorType","SensorType","ROTATION","makeMutable","qw","qx","qy","qz","yaw","pitch","roll","interfaceOrientation","x","y","z","eulerToQuaternion","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","PI","q","adjustVectorToInterfaceOrientation","useAnimatedSensor","userConfig","ref","useRef","sensor","unregister","isAvailable","config","interval","adjustToInterfaceOrientation","iosReferenceFrame","IOSReferenceFrame","Auto","useEffect","current","sensorData","id","registerSensor","value","flushImmediates","unregisterSensor"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { makeMutable, registerSensor, unregisterSensor } from '../core';\nimport {\n SensorType,\n SharedValue,\n Value3D,\n ValueRotation,\n IOSReferenceFrame,\n} from '../commonTypes';\nimport { flushImmediates } from '../threads';\n\nexport type SensorConfig = {\n interval: number | 'auto';\n adjustToInterfaceOrientation: boolean;\n iosReferenceFrame: IOSReferenceFrame;\n};\n\nexport type AnimatedSensor = {\n sensor: SharedValue<Value3D | ValueRotation>;\n unregister: () => void;\n isAvailable: boolean;\n config: SensorConfig;\n};\n\nfunction initSensorData(\n sensorType: SensorType\n): SharedValue<Value3D | ValueRotation> {\n if (sensorType === SensorType.ROTATION) {\n return makeMutable<Value3D | ValueRotation>({\n qw: 0,\n qx: 0,\n qy: 0,\n qz: 0,\n yaw: 0,\n pitch: 0,\n roll: 0,\n interfaceOrientation: 0,\n });\n } else {\n return makeMutable<Value3D | ValueRotation>({\n x: 0,\n y: 0,\n z: 0,\n interfaceOrientation: 0,\n });\n }\n}\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === 90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === 270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === 180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === 90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === 270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === 180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor {\n const ref = useRef<AnimatedSensor>({\n sensor: initSensorData(sensorType),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config: {\n interval: 0,\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n },\n });\n\n useEffect(() => {\n ref.current.config = {\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfig,\n };\n const sensorData = ref.current.sensor!;\n const id = registerSensor(\n sensorType,\n ref.current.config.interval === 'auto' ? -1 : ref.current.config.interval,\n ref.current.config.iosReferenceFrame,\n (data) => {\n 'worklet';\n if (ref.current.config.adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n flushImmediates();\n }\n );\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, userConfig]);\n\n return ref.current;\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAOA;;AAeA,SAASA,cAAT,CACEC,UADF,EAEwC;EACtC,IAAIA,UAAU,KAAKC,uBAAA,CAAWC,QAA9B,EAAwC;IACtC,OAAO,IAAAC,iBAAA,EAAqC;MAC1CC,EAAE,EAAE,CADsC;MAE1CC,EAAE,EAAE,CAFsC;MAG1CC,EAAE,EAAE,CAHsC;MAI1CC,EAAE,EAAE,CAJsC;MAK1CC,GAAG,EAAE,CALqC;MAM1CC,KAAK,EAAE,CANmC;MAO1CC,IAAI,EAAE,CAPoC;MAQ1CC,oBAAoB,EAAE;IARoB,CAArC,CAAP;EAUD,CAXD,MAWO;IACL,OAAO,IAAAR,iBAAA,EAAqC;MAC1CS,CAAC,EAAE,CADuC;MAE1CC,CAAC,EAAE,CAFuC;MAG1CC,CAAC,EAAE,CAHuC;MAI1CH,oBAAoB,EAAE;IAJoB,CAArC,CAAP;EAMD;AACF,C,CAED;AACA;;;AACA,SAASI,iBAAT,CAA2BN,KAA3B,EAA0CC,IAA1C,EAAwDF,GAAxD,EAAqE;EACnE;;EACA,MAAMQ,EAAE,G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AIH,EAAE,KAAK,CAAC,CAAZ,EAAe;MACb;MACAd,GAAG,CAACY,OAAJ,CAAYT,UAAZ,GAAyB,MAAM,IAAAe,sBAAA,EAAiBJ,EAAjB,CAA/B;;MACAd,GAAG,CAACY,OAAJ,CAAYR,WAAZ,GAA0B,IAA1B;IACD,CAJD,MAIO;MACL;MACAJ,GAAG,CAACY,OAAJ,CAAYT,UAAZ,GAAyB,MAAM,CAC7B;MACD,CAFD;;MAGAH,GAAG,CAACY,OAAJ,CAAYR,WAAZ,GAA0B,KAA1B;IACD;;IAED,OAAO,MAAM;MACXJ,GAAG,CAACY,OAAJ,CAAYT,UAAZ;IACD,CAFD;EAGD,CAzCD,EAyCG,CAACnC,UAAD,EAAa+B,UAAb,CAzCH;EA2CA,OAAOC,GAAG,CAACY,OAAX;AACD"}
|
|
@@ -138,7 +138,7 @@ function setupRequestAnimationFrame() {
|
|
|
138
138
|
|
|
139
139
|
global.__frameTimestamp = undefined;
|
|
140
140
|
});
|
|
141
|
-
} // Reanimated currently does not support cancelling
|
|
141
|
+
} // Reanimated currently does not support cancelling callbacks requested with
|
|
142
142
|
// requestAnimationFrame. We return -1 as identifier which isn't in line
|
|
143
143
|
// with the spec but it should give users better clue in case they actually
|
|
144
144
|
// attempt to store the value returned from rAF and use it for cancelling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["callGuardDEV","fn","args","e","global","ErrorUtils","reportFatalError","valueUnpacker","objectToUnpack","category","workletsCache","__workletsCache","handleCache","__handleCache","undefined","Map","WeakMap","workletHash","__workletHash","workletFun","get","initData","__initData","evalWithSourceMap","code","location","sourceMap","evalWithSourceUrl","eval","set","functionInstance","bind","_recur","__init","value","fun","Error","__remoteFunction","setupRequestAnimationFrame","nativeRequestAnimationFrame","requestAnimationFrame","animationFrameCallbacks","lastNativeAnimationFrameTimestamp","__flushAnimationFrame","frameTimestamp","currentCallbacks","forEach","f","flushImmediates","callback","push","length","timestamp","__frameTimestamp","initializeUIRuntime","NativeReanimatedModule","installCoreFunctions","IS_JEST","isJest","setTimeout","performance","now","capturableConsole","console","runOnUIImmediately","error","runOnJS","reportFatalErrorOnJS","message","stack","debug","log","warn","info","setupSetImmediate"],"sources":["initializers.ts"],"sourcesContent":["import { reportFatalErrorOnJS } from './errors';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { isJest } from './PlatformChecker';\nimport {\n runOnJS,\n setupSetImmediate,\n flushImmediates,\n runOnUIImmediately,\n} from './threads';\n\n// callGuard is only used with debug builds\nfunction callGuardDEV<T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n): void {\n 'worklet';\n try {\n fn(...args);\n } catch (e) {\n if (global.ErrorUtils) {\n global.ErrorUtils.reportFatalError(e as Error);\n } else {\n throw e;\n }\n }\n}\n\nfunction valueUnpacker(objectToUnpack: any, category?: string): any {\n 'worklet';\n let workletsCache = global.__workletsCache;\n let handleCache = global.__handleCache;\n if (workletsCache === undefined) {\n // init\n workletsCache = global.__workletsCache = new Map();\n handleCache = global.__handleCache = new WeakMap();\n }\n const workletHash = objectToUnpack.__workletHash;\n if (workletHash !== undefined) {\n let workletFun = workletsCache.get(workletHash);\n if (workletFun === undefined) {\n const initData = objectToUnpack.__initData;\n if (global.evalWithSourceMap) {\n // if the runtime (hermes only for now) supports loading source maps\n // we want to use the proper filename for the location as it guarantees\n // that debugger understands and loads the source code of the file where\n // the worklet is defined.\n workletFun = global.evalWithSourceMap(\n '(' + initData.code + '\\n)',\n initData.location,\n initData.sourceMap\n ) as (...args: any[]) => any;\n } else if (global.evalWithSourceUrl) {\n // if the runtime doesn't support loading source maps, in dev mode we\n // can pass source url when evaluating the worklet. Now, instead of using\n // the actual file location we use worklet hash, as it the allows us to\n // properly symbolicate traces (see errors.ts for details)\n workletFun = global.evalWithSourceUrl(\n '(' + initData.code + '\\n)',\n `worklet_${workletHash}`\n ) as (...args: any[]) => any;\n } else {\n // in release we use the regular eval to save on JSI calls\n // eslint-disable-next-line no-eval\n workletFun = eval('(' + initData.code + '\\n)') as (\n ...args: any[]\n ) => any;\n }\n workletsCache.set(workletHash, workletFun);\n }\n const functionInstance = workletFun.bind(objectToUnpack);\n objectToUnpack._recur = functionInstance;\n return functionInstance;\n } else if (objectToUnpack.__init) {\n let value = handleCache!.get(objectToUnpack);\n if (value === undefined) {\n value = objectToUnpack.__init();\n handleCache!.set(objectToUnpack, value);\n }\n return value;\n } else if (category === 'RemoteFunction') {\n const fun = () => {\n throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.\n\nPossible solutions are:\n a) If you want to synchronously execute this method, mark it as a worklet\n b) If you want to execute this function on the JS thread, wrap it using \\`runOnJS\\``);\n };\n fun.__remoteFunction = objectToUnpack;\n return fun;\n } else {\n throw new Error('data type not recognized by unpack method');\n }\n}\n\nfunction setupRequestAnimationFrame() {\n 'worklet';\n\n // Jest mocks requestAnimationFrame API and it does not like if that mock gets overridden\n // so we avoid doing requestAnimationFrame batching in Jest environment.\n const nativeRequestAnimationFrame = global.requestAnimationFrame;\n\n let animationFrameCallbacks: Array<(timestamp: number) => void> = [];\n let lastNativeAnimationFrameTimestamp = -1;\n\n global.__flushAnimationFrame = (frameTimestamp: number) => {\n const currentCallbacks = animationFrameCallbacks;\n animationFrameCallbacks = [];\n currentCallbacks.forEach((f) => f(frameTimestamp));\n flushImmediates();\n };\n\n global.requestAnimationFrame = (\n callback: (timestamp: number) => void\n ): number => {\n animationFrameCallbacks.push(callback);\n if (animationFrameCallbacks.length === 1) {\n // We schedule native requestAnimationFrame only when the first callback\n // is added and then use it to execute all the enqueued callbacks. Once\n // the callbacks are run, we clear the array.\n nativeRequestAnimationFrame((timestamp) => {\n if (lastNativeAnimationFrameTimestamp >= timestamp) {\n // Make sure we only execute the callbacks once for a given frame\n return;\n }\n lastNativeAnimationFrameTimestamp = timestamp;\n global.__frameTimestamp = timestamp;\n global.__flushAnimationFrame(timestamp);\n global.__frameTimestamp = undefined;\n });\n }\n // Reanimated currently does not support cancelling calbacks requested with\n // requestAnimationFrame. We return -1 as identifier which isn't in line\n // with the spec but it should give users better clue in case they actually\n // attempt to store the value returned from rAF and use it for cancelling.\n return -1;\n };\n}\n\nexport function initializeUIRuntime() {\n NativeReanimatedModule.installCoreFunctions(callGuardDEV, valueUnpacker);\n\n const IS_JEST = isJest();\n\n if (IS_JEST) {\n // requestAnimationFrame react-native jest's setup is incorrect as it polyfills\n // the method directly using setTimeout, therefore the callback doesn't get the\n // expected timestamp as the only argument: https://github.com/facebook/react-native/blob/main/jest/setup.js#L28\n // We override this setup here to make sure that callbacks get the proper timestamps\n // when executed. For non-jest environments we define requestAnimationFrame in setupRequestAnimationFrame\n // @ts-ignore TypeScript uses Node definition for rAF, setTimeout, etc which returns a Timeout object rather than a number\n global.requestAnimationFrame = (callback: (timestamp: number) => void) => {\n return setTimeout(() => callback(performance.now()), 0);\n };\n }\n\n const capturableConsole = console;\n runOnUIImmediately(() => {\n 'worklet';\n // setup error handler\n global.ErrorUtils = {\n reportFatalError: (error: Error) => {\n runOnJS(reportFatalErrorOnJS)({\n message: error.message,\n stack: error.stack,\n });\n },\n };\n\n // setup console\n // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version\n global.console = {\n debug: runOnJS(capturableConsole.debug),\n log: runOnJS(capturableConsole.log),\n warn: runOnJS(capturableConsole.warn),\n error: runOnJS(capturableConsole.error),\n info: runOnJS(capturableConsole.info),\n };\n\n if (!IS_JEST) {\n setupSetImmediate();\n setupRequestAnimationFrame();\n }\n })();\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAOA;AACA,SAASA,YAAT,CACEC,EADF,EAGQ;EACN;;EADM,kCADHC,IACG;IADHA,IACG;EAAA;;EAEN,IAAI;IACFD,EAAE,CAAC,GAAGC,IAAJ,CAAF;EACD,CAFD,CAEE,OAAOC,CAAP,EAAU;IACV,IAAIC,MAAM,CAACC,UAAX,EAAuB;MACrBD,MAAM,CAACC,UAAP,CAAkBC,gBAAlB,C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BAAiB,CAACS,GAA1B,CAFU;MAGfC,IAAI,EAAE,IAAAN,gBAAA,EAAQJ,iBAAiB,CAACU,IAA1B,CAHS;MAIfP,KAAK,EAAE,IAAAC,gBAAA,EAAQJ,iBAAiB,CAACG,KAA1B,CAJQ;MAKfQ,IAAI,EAAE,IAAAP,gBAAA,EAAQJ,iBAAiB,CAACW,IAA1B;IALS,CAAjB;;IAQA,IAAI,CAAChB,OAAL,EAAc;MACZ,IAAAiB,0BAAA;MACApC,0BAA0B;IAC3B;EACF,CA1BD;AA2BD"}
|
|
1
|
+
{"version":3,"names":["callGuardDEV","fn","args","e","global","ErrorUtils","reportFatalError","valueUnpacker","objectToUnpack","category","workletsCache","__workletsCache","handleCache","__handleCache","undefined","Map","WeakMap","workletHash","__workletHash","workletFun","get","initData","__initData","evalWithSourceMap","code","location","sourceMap","evalWithSourceUrl","eval","set","functionInstance","bind","_recur","__init","value","fun","Error","__remoteFunction","setupRequestAnimationFrame","nativeRequestAnimationFrame","requestAnimationFrame","animationFrameCallbacks","lastNativeAnimationFrameTimestamp","__flushAnimationFrame","frameTimestamp","currentCallbacks","forEach","f","flushImmediates","callback","push","length","timestamp","__frameTimestamp","initializeUIRuntime","NativeReanimatedModule","installCoreFunctions","IS_JEST","isJest","setTimeout","performance","now","capturableConsole","console","runOnUIImmediately","error","runOnJS","reportFatalErrorOnJS","message","stack","debug","log","warn","info","setupSetImmediate"],"sources":["initializers.ts"],"sourcesContent":["import { reportFatalErrorOnJS } from './errors';\nimport NativeReanimatedModule from './NativeReanimated';\nimport { isJest } from './PlatformChecker';\nimport {\n runOnJS,\n setupSetImmediate,\n flushImmediates,\n runOnUIImmediately,\n} from './threads';\n\n// callGuard is only used with debug builds\nfunction callGuardDEV<T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n): void {\n 'worklet';\n try {\n fn(...args);\n } catch (e) {\n if (global.ErrorUtils) {\n global.ErrorUtils.reportFatalError(e as Error);\n } else {\n throw e;\n }\n }\n}\n\nfunction valueUnpacker(objectToUnpack: any, category?: string): any {\n 'worklet';\n let workletsCache = global.__workletsCache;\n let handleCache = global.__handleCache;\n if (workletsCache === undefined) {\n // init\n workletsCache = global.__workletsCache = new Map();\n handleCache = global.__handleCache = new WeakMap();\n }\n const workletHash = objectToUnpack.__workletHash;\n if (workletHash !== undefined) {\n let workletFun = workletsCache.get(workletHash);\n if (workletFun === undefined) {\n const initData = objectToUnpack.__initData;\n if (global.evalWithSourceMap) {\n // if the runtime (hermes only for now) supports loading source maps\n // we want to use the proper filename for the location as it guarantees\n // that debugger understands and loads the source code of the file where\n // the worklet is defined.\n workletFun = global.evalWithSourceMap(\n '(' + initData.code + '\\n)',\n initData.location,\n initData.sourceMap\n ) as (...args: any[]) => any;\n } else if (global.evalWithSourceUrl) {\n // if the runtime doesn't support loading source maps, in dev mode we\n // can pass source url when evaluating the worklet. Now, instead of using\n // the actual file location we use worklet hash, as it the allows us to\n // properly symbolicate traces (see errors.ts for details)\n workletFun = global.evalWithSourceUrl(\n '(' + initData.code + '\\n)',\n `worklet_${workletHash}`\n ) as (...args: any[]) => any;\n } else {\n // in release we use the regular eval to save on JSI calls\n // eslint-disable-next-line no-eval\n workletFun = eval('(' + initData.code + '\\n)') as (\n ...args: any[]\n ) => any;\n }\n workletsCache.set(workletHash, workletFun);\n }\n const functionInstance = workletFun.bind(objectToUnpack);\n objectToUnpack._recur = functionInstance;\n return functionInstance;\n } else if (objectToUnpack.__init) {\n let value = handleCache!.get(objectToUnpack);\n if (value === undefined) {\n value = objectToUnpack.__init();\n handleCache!.set(objectToUnpack, value);\n }\n return value;\n } else if (category === 'RemoteFunction') {\n const fun = () => {\n throw new Error(`Tried to synchronously call a non-worklet function on the UI thread.\n\nPossible solutions are:\n a) If you want to synchronously execute this method, mark it as a worklet\n b) If you want to execute this function on the JS thread, wrap it using \\`runOnJS\\``);\n };\n fun.__remoteFunction = objectToUnpack;\n return fun;\n } else {\n throw new Error('data type not recognized by unpack method');\n }\n}\n\nfunction setupRequestAnimationFrame() {\n 'worklet';\n\n // Jest mocks requestAnimationFrame API and it does not like if that mock gets overridden\n // so we avoid doing requestAnimationFrame batching in Jest environment.\n const nativeRequestAnimationFrame = global.requestAnimationFrame;\n\n let animationFrameCallbacks: Array<(timestamp: number) => void> = [];\n let lastNativeAnimationFrameTimestamp = -1;\n\n global.__flushAnimationFrame = (frameTimestamp: number) => {\n const currentCallbacks = animationFrameCallbacks;\n animationFrameCallbacks = [];\n currentCallbacks.forEach((f) => f(frameTimestamp));\n flushImmediates();\n };\n\n global.requestAnimationFrame = (\n callback: (timestamp: number) => void\n ): number => {\n animationFrameCallbacks.push(callback);\n if (animationFrameCallbacks.length === 1) {\n // We schedule native requestAnimationFrame only when the first callback\n // is added and then use it to execute all the enqueued callbacks. Once\n // the callbacks are run, we clear the array.\n nativeRequestAnimationFrame((timestamp) => {\n if (lastNativeAnimationFrameTimestamp >= timestamp) {\n // Make sure we only execute the callbacks once for a given frame\n return;\n }\n lastNativeAnimationFrameTimestamp = timestamp;\n global.__frameTimestamp = timestamp;\n global.__flushAnimationFrame(timestamp);\n global.__frameTimestamp = undefined;\n });\n }\n // Reanimated currently does not support cancelling callbacks requested with\n // requestAnimationFrame. We return -1 as identifier which isn't in line\n // with the spec but it should give users better clue in case they actually\n // attempt to store the value returned from rAF and use it for cancelling.\n return -1;\n };\n}\n\nexport function initializeUIRuntime() {\n NativeReanimatedModule.installCoreFunctions(callGuardDEV, valueUnpacker);\n\n const IS_JEST = isJest();\n\n if (IS_JEST) {\n // requestAnimationFrame react-native jest's setup is incorrect as it polyfills\n // the method directly using setTimeout, therefore the callback doesn't get the\n // expected timestamp as the only argument: https://github.com/facebook/react-native/blob/main/jest/setup.js#L28\n // We override this setup here to make sure that callbacks get the proper timestamps\n // when executed. For non-jest environments we define requestAnimationFrame in setupRequestAnimationFrame\n // @ts-ignore TypeScript uses Node definition for rAF, setTimeout, etc which returns a Timeout object rather than a number\n global.requestAnimationFrame = (callback: (timestamp: number) => void) => {\n return setTimeout(() => callback(performance.now()), 0);\n };\n }\n\n const capturableConsole = console;\n runOnUIImmediately(() => {\n 'worklet';\n // setup error handler\n global.ErrorUtils = {\n reportFatalError: (error: Error) => {\n runOnJS(reportFatalErrorOnJS)({\n message: error.message,\n stack: error.stack,\n });\n },\n };\n\n // setup console\n // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version\n global.console = {\n debug: runOnJS(capturableConsole.debug),\n log: runOnJS(capturableConsole.log),\n warn: runOnJS(capturableConsole.warn),\n error: runOnJS(capturableConsole.error),\n info: runOnJS(capturableConsole.info),\n };\n\n if (!IS_JEST) {\n setupSetImmediate();\n setupRequestAnimationFrame();\n }\n })();\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAOA;AACA,SAASA,YAAT,CACEC,EADF,EAGQ;EACN;;EADM,kCADHC,IACG;IADHA,IACG;EAAA;;EAEN,IAAI;IACFD,EAAE,CAAC,GAAGC,IAAJ,CAAF;EACD,CAFD,CAEE,OAAOC,CAAP,EAAU;IACV,IAAIC,MAAM,CAACC,UAAX,EAAuB;MACrBD,MAAM,CAACC,UAAP,CAAkBC,gBAAlB,CAAmCH,CAAnC;IACD,CAFD,MAEO;MACL,MAAMA,CAAN;IACD;EACF;AACF;;AAED,SAASI,aAAT,CAAuBC,cAAvB,EAA4CC,QAA5C,EAAoE;EAClE;;EACA,IAAIC,aAAa,GAAGN,MAAM,CAACO,eAA3B;EACA,IAAIC,WAAW,GAAGR,MAAM,CAACS,aAAzB;;EACA,IAAIH,aAAa,KAAKI,SAAtB,EAAiC;IAC/B;IACAJ,aAAa,GAAGN,MAAM,CAACO,eAAP,GAAyB,IAAII,GAAJ,EAAzC;IACAH,WAAW,GAAGR,MAAM,CAACS,aAAP,GAAuB,IAAIG,OAAJ,EAArC;EACD;;EACD,MAAMC,WAAW,GAAGT,cAAc,CAACU,aAAnC;;EACA,IAAID,WAAW,KAAKH,SAApB,EAA+B;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AA1D;;EAEA,MAAMkD,OAAO,GAAG,IAAAC,uBAAA,GAAhB;;EAEA,IAAID,OAAJ,EAAa;IACX;IACA;IACA;IACA;IACA;IACA;IACArD,MAAM,CAACoC,qBAAP,GAAgCS,QAAD,IAA2C;MACxE,OAAOU,UAAU,CAAC,MAAMV,QAAQ,CAACW,WAAW,CAACC,GAAZ,EAAD,CAAf,EAAoC,CAApC,CAAjB;IACD,CAFD;EAGD;;EAED,MAAMC,iBAAiB,GAAGC,OAA1B;EACA,IAAAC,2BAAA,EAAmB,MAAM;IACvB,UADuB,CAEvB;;IACA5D,MAAM,CAACC,UAAP,GAAoB;MAClBC,gBAAgB,EAAG2D,KAAD,IAAkB;QAClC,IAAAC,gBAAA,EAAQC,4BAAR,EAA8B;UAC5BC,OAAO,EAAEH,KAAK,CAACG,OADa;UAE5BC,KAAK,EAAEJ,KAAK,CAACI;QAFe,CAA9B;MAID;IANiB,CAApB,CAHuB,CAYvB;IACA;;IACAjE,MAAM,CAAC2D,OAAP,GAAiB;MACfO,KAAK,EAAE,IAAAJ,gBAAA,EAAQJ,iBAAiB,CAACQ,KAA1B,CADQ;MAEfC,GAAG,EAAE,IAAAL,gBAAA,EAAQJ,iBAAiB,CAACS,GAA1B,CAFU;MAGfC,IAAI,EAAE,IAAAN,gBAAA,EAAQJ,iBAAiB,CAACU,IAA1B,CAHS;MAIfP,KAAK,EAAE,IAAAC,gBAAA,EAAQJ,iBAAiB,CAACG,KAA1B,CAJQ;MAKfQ,IAAI,EAAE,IAAAP,gBAAA,EAAQJ,iBAAiB,CAACW,IAA1B;IALS,CAAjB;;IAQA,IAAI,CAAChB,OAAL,EAAc;MACZ,IAAAiB,0BAAA;MACApC,0BAA0B;IAC3B;EACF,CA1BD;AA2BD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TAG_OFFSET","startObservingProgress","tag","sharedValue","animationType","isSharedTransition","LayoutAnimationType","SHARED_ELEMENT_TRANSITION","addListener","_notifyAboutProgress","value","stopObservingProgress","cancelled","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","enteringAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","ENTERING","set","LAYOUT","enteringAnimation","get","undefined","makeUIMutable","initialValues","_value","animation","withStyleAnimation","callback","finished","delete","shouldRemoveView","EXITING","stop","runOnUIImmediately","global","LayoutAnimationsManager"],"sources":["animationsManager.ts"],"sourcesContent":["import { withStyleAnimation } from '../animation/styleAnimation';\nimport { SharedValue } from '../commonTypes';\nimport { makeUIMutable } from '../mutables';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n LayoutAnimationsValues,\n} from './animationBuilder';\nimport { runOnUIImmediately } from '../threads';\n\nconst TAG_OFFSET = 1e9;\n\nfunction startObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n animationType: LayoutAnimationType\n): void {\n 'worklet';\n const isSharedTransition =\n animationType === LayoutAnimationType.SHARED_ELEMENT_TRANSITION;\n sharedValue.addListener(tag + TAG_OFFSET, () => {\n _notifyAboutProgress(tag, sharedValue.value, isSharedTransition);\n });\n}\n\nfunction stopObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n cancelled: boolean,\n removeView: boolean\n): void {\n 'worklet';\n sharedValue.removeListener(tag + TAG_OFFSET);\n _notifyAboutEnd(tag, cancelled, removeView);\n}\n\nfunction createLayoutAnimationManager() {\n 'worklet';\n const enteringAnimationForTag = new Map();\n const mutableValuesForTag = new Map();\n\n return {\n start(\n tag: number,\n type: LayoutAnimationType,\n yogaValues: LayoutAnimationsValues,\n config: LayoutAnimationFunction\n ) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === LayoutAnimationType.ENTERING) {\n enteringAnimationForTag.set(tag, currentAnimation);\n } else if (type === LayoutAnimationType.LAYOUT) {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag.get(tag);\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n\n let value = mutableValuesForTag.get(tag);\n if (value === undefined) {\n value = makeUIMutable(style.initialValues);\n mutableValuesForTag.set(tag, value);\n } else {\n stopObservingProgress(tag, value, false, false);\n value._value = style.initialValues;\n }\n\n // @ts-ignore The line below started failing because I added types to the method – don't have time to fix it right now\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n enteringAnimationForTag.delete(tag);\n mutableValuesForTag.delete(tag);\n const shouldRemoveView = type === LayoutAnimationType.EXITING;\n stopObservingProgress(tag, value, finished, shouldRemoveView);\n }\n style.callback &&\n style.callback(finished === undefined ? false : finished);\n };\n\n startObservingProgress(tag, value, type);\n value.value = animation;\n },\n stop(tag: number) {\n const value = mutableValuesForTag.get(tag);\n stopObservingProgress(tag, value, true, true);\n },\n };\n}\n\nrunOnUIImmediately(() => {\n 'worklet';\n global.LayoutAnimationsManager = createLayoutAnimationManager();\n})();\n"],"mappings":";;AAAA;;AAEA;;AACA;;AAKA;;AAEA,MAAMA,UAAU,GAAG,GAAnB;;AAEA,SAASC,sBAAT,CACEC,GADF,EAEEC,WAFF,EAGEC,aAHF,EAIQ;EACN;;EACA,MAAMC,kBAAkB,GACtBD,aAAa,KAAKE,qCAAA,CAAoBC,yBADxC;EAEAJ,WAAW,CAACK,WAAZ,CAAwBN,GAAG,GAAGF,UAA9B,EAA0C,MAAM;IAC9CS,oBAAoB,CAACP,GAAD,EAAMC,WAAW,CAACO,KAAlB,EAAyBL,kBAAzB,CAApB;EACD,CAFD;AAGD;;AAED,SAASM,qBAAT,CACET,GADF,EAEEC,WAFF,EAGES,SAHF,EAIEC,UAJF,EAKQ;EACN;;EACAV,WAAW,CAACW,cAAZ,CAA2BZ,GAAG,GAAGF,UAAjC;;EACAe,eAAe,CAACb,GAAD,EAAMU,SAAN,EAAiBC,UAAjB,CAAf;AACD;;AAED,SAASG,4BAAT,GAAwC;EACtC;;EACA,MAAMC,uBAAuB,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tC,GAA/B;UACAiB,mBAAmB,CAACqB,MAApB,CAA2BtC,GAA3B;UACA,MAAMuC,gBAAgB,GAAGpB,IAAI,KAAKf,qCAAA,CAAoBoC,OAAtD;UACA/B,qBAAqB,CAACT,GAAD,EAAMQ,KAAN,EAAa6B,QAAb,EAAuBE,gBAAvB,CAArB;QACD;;QACDjB,KAAK,CAACc,QAAN,IACEd,KAAK,CAACc,QAAN,CAAeC,QAAQ,KAAKP,SAAb,GAAyB,KAAzB,GAAiCO,QAAhD,CADF;MAED,CATD;;MAWAtC,sBAAsB,CAACC,GAAD,EAAMQ,KAAN,EAAaW,IAAb,CAAtB;MACAX,KAAK,CAACA,KAAN,GAAc0B,SAAd;IACD,CA9CI;;IA+CLO,IAAI,CAACzC,GAAD,EAAc;MAChB,MAAMQ,KAAK,GAAGS,mBAAmB,CAACY,GAApB,CAAwB7B,GAAxB,CAAd;
|
|
1
|
+
{"version":3,"names":["TAG_OFFSET","startObservingProgress","tag","sharedValue","animationType","isSharedTransition","LayoutAnimationType","SHARED_ELEMENT_TRANSITION","addListener","_notifyAboutProgress","value","stopObservingProgress","cancelled","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","enteringAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","ENTERING","set","LAYOUT","enteringAnimation","get","undefined","makeUIMutable","initialValues","_value","animation","withStyleAnimation","callback","finished","delete","shouldRemoveView","EXITING","stop","runOnUIImmediately","global","LayoutAnimationsManager"],"sources":["animationsManager.ts"],"sourcesContent":["import { withStyleAnimation } from '../animation/styleAnimation';\nimport { SharedValue } from '../commonTypes';\nimport { makeUIMutable } from '../mutables';\nimport {\n LayoutAnimationFunction,\n LayoutAnimationType,\n LayoutAnimationsValues,\n} from './animationBuilder';\nimport { runOnUIImmediately } from '../threads';\n\nconst TAG_OFFSET = 1e9;\n\nfunction startObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n animationType: LayoutAnimationType\n): void {\n 'worklet';\n const isSharedTransition =\n animationType === LayoutAnimationType.SHARED_ELEMENT_TRANSITION;\n sharedValue.addListener(tag + TAG_OFFSET, () => {\n _notifyAboutProgress(tag, sharedValue.value, isSharedTransition);\n });\n}\n\nfunction stopObservingProgress(\n tag: number,\n sharedValue: SharedValue<number>,\n cancelled: boolean,\n removeView: boolean\n): void {\n 'worklet';\n sharedValue.removeListener(tag + TAG_OFFSET);\n _notifyAboutEnd(tag, cancelled, removeView);\n}\n\nfunction createLayoutAnimationManager() {\n 'worklet';\n const enteringAnimationForTag = new Map();\n const mutableValuesForTag = new Map();\n\n return {\n start(\n tag: number,\n type: LayoutAnimationType,\n yogaValues: LayoutAnimationsValues,\n config: LayoutAnimationFunction\n ) {\n const style = config(yogaValues);\n let currentAnimation = style.animations;\n\n if (type === LayoutAnimationType.ENTERING) {\n enteringAnimationForTag.set(tag, currentAnimation);\n } else if (type === LayoutAnimationType.LAYOUT) {\n // When layout animation is requested, but entering is still running, we merge\n // new layout animation targets into the ongoing animation\n const enteringAnimation = enteringAnimationForTag.get(tag);\n if (enteringAnimation) {\n currentAnimation = { ...enteringAnimation, ...style.animations };\n }\n }\n\n let value = mutableValuesForTag.get(tag);\n if (value === undefined) {\n value = makeUIMutable(style.initialValues);\n mutableValuesForTag.set(tag, value);\n } else {\n stopObservingProgress(tag, value, false, false);\n value._value = style.initialValues;\n }\n\n // @ts-ignore The line below started failing because I added types to the method – don't have time to fix it right now\n const animation = withStyleAnimation(currentAnimation);\n\n animation.callback = (finished?: boolean) => {\n if (finished) {\n enteringAnimationForTag.delete(tag);\n mutableValuesForTag.delete(tag);\n const shouldRemoveView = type === LayoutAnimationType.EXITING;\n stopObservingProgress(tag, value, finished, shouldRemoveView);\n }\n style.callback &&\n style.callback(finished === undefined ? false : finished);\n };\n\n startObservingProgress(tag, value, type);\n value.value = animation;\n },\n stop(tag: number) {\n const value = mutableValuesForTag.get(tag);\n if (!value) {\n return;\n }\n stopObservingProgress(tag, value, true, true);\n },\n };\n}\n\nrunOnUIImmediately(() => {\n 'worklet';\n global.LayoutAnimationsManager = createLayoutAnimationManager();\n})();\n"],"mappings":";;AAAA;;AAEA;;AACA;;AAKA;;AAEA,MAAMA,UAAU,GAAG,GAAnB;;AAEA,SAASC,sBAAT,CACEC,GADF,EAEEC,WAFF,EAGEC,aAHF,EAIQ;EACN;;EACA,MAAMC,kBAAkB,GACtBD,aAAa,KAAKE,qCAAA,CAAoBC,yBADxC;EAEAJ,WAAW,CAACK,WAAZ,CAAwBN,GAAG,GAAGF,UAA9B,EAA0C,MAAM;IAC9CS,oBAAoB,CAACP,GAAD,EAAMC,WAAW,CAACO,KAAlB,EAAyBL,kBAAzB,CAApB;EACD,CAFD;AAGD;;AAED,SAASM,qBAAT,CACET,GADF,EAEEC,WAFF,EAGES,SAHF,EAIEC,UAJF,EAKQ;EACN;;EACAV,WAAW,CAACW,cAAZ,CAA2BZ,GAAG,GAAGF,UAAjC;;EACAe,eAAe,CAACb,GAAD,EAAMU,SAAN,EAAiBC,UAAjB,CAAf;AACD;;AAED,SAASG,4BAAT,GAAwC;EACtC;;EACA,MAAMC,uBAAuB,GAAG,IAAIC,GAAJ,EAAhC;EACA,MAAMC,mBAAmB,GAAG,IAAID,GAAJ,EAA5B;EAEA,OAAO;IACLE,KAAK,CACHlB,GADG,EAEHmB,IAFG,EAGHC,UAHG,EAIHC,MAJG,EAKH;MACA,MAAMC,KAAK,GAAGD,MAAM,CAACD,UAAD,CAApB;MACA,IAAIG,gBAAgB,GAAGD,KAAK,CAACE,UAA7B;;MAEA,IAAIL,IAAI,KAAKf,qCAAA,CAAoBqB,QAAjC,EAA2C;QACzCV,uBAAuB,CAACW,GAAxB,CAA4B1B,GAA5B,EAAiCuB,gBAAjC;MACD,CAFD,MAEO,IAAIJ,IAAI,KAAKf,qCAAA,CAAoBuB,MAAjC,EAAyC;QAC9C;QACA;QACA,MAAMC,iBAAiB,GAAGb,uBAAuB,CAACc,GAAxB,CAA4B7B,GAA5B,CAA1B;;QACA,I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GAAxB,CAAd;;MACA,IAAI,CAACQ,KAAL,EAAY;QACV;MACD;;MACDC,qBAAqB,CAACT,GAAD,EAAMQ,KAAN,EAAa,IAAb,EAAmB,IAAnB,CAArB;IACD;;EArDI,CAAP;AAuDD;;AAED,IAAAkC,2BAAA,EAAmB,MAAM;EACvB;;EACAC,MAAM,CAACC,uBAAP,GAAiC9B,4BAA4B,EAA7D;AACD,CAHD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","BaseAnimationMock","duration","_","delay","springify","damping","stiffness","withCallback","randomDelay","withInitialValues","build","initialValues","animations","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","forEach","k","Object","assign","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nclass BaseAnimationMock {\n duration(_: number) {\n return this;\n }\n\n delay(_: number) {\n return this;\n }\n\n springify(_: number) {\n return this;\n }\n\n damping(_: number) {\n return this;\n }\n\n stiffness(_: number) {\n return this;\n }\n\n withCallback(_: (
|
|
1
|
+
{"version":3,"names":["NOOP","ID","t","IMMEDIATE_CB_INVOCATION","cb","BaseAnimationMock","duration","_","delay","springify","damping","stiffness","withCallback","randomDelay","withInitialValues","build","initialValues","animations","ReanimatedV2","useSharedValue","v","value","useDerivedValue","a","useAnimatedScrollHandler","useAnimatedGestureHandler","useAnimatedStyle","useAnimatedRef","current","useAnimatedReaction","useAnimatedProps","withTiming","toValue","withSpring","withDecay","withDelay","animationValue","withSequence","withRepeat","animation","cancelAnimation","measure","x","y","width","height","pageX","pageY","Easing","linear","ease","quad","cubic","poly","sin","circle","exp","elastic","back","bounce","bezier","factory","bezierFn","in","out","inOut","Extrapolation","EXTEND","CLAMP","IDENTITY","runOnJS","fn","runOnUI","forEach","k","Object","assign","module","exports"],"sources":["mock.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nconst NOOP = () => {\n // noop\n};\nconst ID = (t) => t;\nconst IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();\n\nclass BaseAnimationMock {\n duration(_: number) {\n return this;\n }\n\n delay(_: number) {\n return this;\n }\n\n springify(_: number) {\n return this;\n }\n\n damping(_: number) {\n return this;\n }\n\n stiffness(_: number) {\n return this;\n }\n\n withCallback(_: (finished: boolean) => void) {\n return this;\n }\n\n randomDelay() {\n return this;\n }\n\n withInitialValues() {\n return this;\n }\n\n build() {\n return () => ({ initialValues: {}, animations: {} });\n }\n}\n\nconst ReanimatedV2 = {\n useSharedValue: (v) => ({ value: v }),\n useDerivedValue: (a) => ({ value: a() }),\n useAnimatedScrollHandler: () => NOOP,\n useAnimatedGestureHandler: () => NOOP,\n useAnimatedStyle: IMMEDIATE_CB_INVOCATION,\n useAnimatedRef: () => ({ current: null }),\n useAnimatedReaction: NOOP,\n useAnimatedProps: IMMEDIATE_CB_INVOCATION,\n\n withTiming: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withSpring: (toValue, _, cb) => {\n cb && cb(true);\n return toValue;\n },\n withDecay: (_, cb) => {\n cb && cb(true);\n return 0;\n },\n withDelay: (_, animationValue) => {\n return animationValue;\n },\n withSequence: (..._animations) => {\n return 0;\n },\n withRepeat: (animation) => {\n return animation;\n },\n cancelAnimation: NOOP,\n measure: () => ({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n }),\n Easing: {\n linear: ID,\n ease: ID,\n quad: ID,\n cubic: ID,\n poly: ID,\n sin: ID,\n circle: ID,\n exp: ID,\n elastic: ID,\n back: ID,\n bounce: ID,\n bezier: () => ({ factory: ID }),\n bezierFn: ID,\n in: ID,\n out: ID,\n inOut: ID,\n },\n Extrapolation: {\n EXTEND: 'extend',\n CLAMP: 'clamp',\n IDENTITY: 'identity',\n },\n\n runOnJS: (fn) => fn,\n runOnUI: (fn) => fn,\n};\n\n[\n 'FadeIn',\n 'FadeInRight',\n 'FadeInLeft',\n 'FadeInUp',\n 'FadeInDown',\n 'FadeOut',\n 'FadeOutRight',\n 'FadeOutLeft',\n 'FadeOutUp',\n 'FadeOutDown',\n\n 'FlipInYLeft',\n 'FlipInXDown',\n 'FlipInYRight',\n 'FlipInEasyX',\n 'FlipInEasyY',\n 'FlipOutXUp',\n 'FlipOutYLeft',\n 'FlipOutXDown',\n 'FlipOutYRight',\n 'FlipOutEasyX',\n 'FlipOutEasyY',\n\n 'StretchInY',\n 'StretchOutX',\n 'StretchOutY',\n 'SlideInLeft',\n 'SlideOutRight',\n 'SlideOutLeft',\n 'SlideInUp',\n 'SlideInDown',\n 'SlideOutUp',\n\n 'ZoomInRotate',\n 'ZoomInLeft',\n 'ZoomInRight',\n 'ZoomInUp',\n 'ZoomInDown',\n 'ZoomInEasyUp',\n 'ZoomInEasyDown',\n 'ZoomOut',\n 'ZoomOutRotate',\n 'ZoomOutLeft',\n 'ZoomOutRight',\n 'ZoomOutUp',\n 'ZoomOutDown',\n 'ZoomOutEasyUp',\n 'ZoomOutEasyDown',\n\n 'BounceInDown',\n 'BounceInUp',\n 'BounceInLeft',\n 'BounceInRight',\n 'BounceOut',\n 'BounceOutDown',\n 'BounceOutUp',\n 'BounceOutLeft',\n 'BounceOutRight',\n\n 'LightSpeedInLeft',\n 'LightSpeedOutRight',\n 'LightSpeedOutLeft',\n\n 'PinwheelOut',\n\n 'RotateInDownRight',\n 'RotateInUpLeft',\n 'RotateInUpRight',\n 'RotateOutDownLeft',\n 'RotateOutDownRight',\n 'RotateOutUpLeft',\n 'RotateOutUpRight',\n\n 'RollInRight',\n 'RollOutLeft',\n 'RollOutRight',\n\n 'Layout',\n 'CurvedTransition',\n 'JumpingTransition',\n 'SequencedTransition',\n 'FadingTransition',\n 'EntryExitTransition',\n].forEach((k) =>\n Object.assign(ReanimatedV2, {\n [k]: new BaseAnimationMock(),\n })\n);\n\nmodule.exports = {\n ...ReanimatedV2,\n};\n"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,EAAE,GAAIC,CAAD,IAAOA,CAAlB;;AACA,MAAMC,uBAAuB,GAAIC,EAAD,IAAuBA,EAAE,EAAzD;;AAEA,MAAMC,iBAAN,CAAwB;EACtBC,QAAQ,CAACC,CAAD,EAAY;IAClB,OAAO,IAAP;EACD;;EAEDC,KAAK,CAACD,CAAD,EAAY;IACf,OAAO,IAAP;EACD;;EAEDE,SAAS,CAACF,CAAD,EAAY;IACnB,OAAO,IAAP;EACD;;EAEDG,OAAO,CAACH,CAAD,EAAY;IACjB,OAAO,IAAP;EACD;;EAEDI,SAAS,CAACJ,CAAD,EAAY;IACnB,OAAO,IAAP;EACD;;EAEDK,YAAY,CAACL,CAAD,EAAiC;IAC3C,OAAO,IAAP;EACD;;EAEDM,WAAW,GAAG;IACZ,OAAO,IAAP;EACD;;EAEDC,iBAAiB,GAAG;IAClB,OAAO,IAAP;EACD;;EAEDC,KAAK,GAAG;IACN,OAAO,OAAO;MAAEC,aAAa,EAAE,EAAjB;MAAqBC,UAAU,EAAE;IAAjC,CAAP,CAAP;EACD;;AAnCqB;;AAsCxB,MAAMC,YAAY,GAAG;EACnBC,cAAc,EAAGC,CAAD,KAAQ;IAAEC,KAAK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6CE,WA7CF,EA8CE,aA9CF,EA+CE,eA/CF,EAgDE,iBAhDF,EAkDE,cAlDF,EAmDE,YAnDF,EAoDE,cApDF,EAqDE,eArDF,EAsDE,WAtDF,EAuDE,eAvDF,EAwDE,aAxDF,EAyDE,eAzDF,EA0DE,gBA1DF,EA4DE,kBA5DF,EA6DE,oBA7DF,EA8DE,mBA9DF,EAgEE,aAhEF,EAkEE,mBAlEF,EAmEE,gBAnEF,EAoEE,iBApEF,EAqEE,mBArEF,EAsEE,oBAtEF,EAuEE,iBAvEF,EAwEE,kBAxEF,EA0EE,aA1EF,EA2EE,aA3EF,EA4EE,cA5EF,EA8EE,QA9EF,EA+EE,kBA/EF,EAgFE,mBAhFF,EAiFE,qBAjFF,EAkFE,kBAlFF,EAmFE,qBAnFF,EAoFEE,OApFF,CAoFWC,CAAD,IACRC,MAAM,CAACC,MAAP,CAAc1D,YAAd,EAA4B;EAC1B,CAACwD,CAAD,GAAK,IAAIrE,iBAAJ;AADqB,CAA5B,CArFF;AA0FAwE,MAAM,CAACC,OAAP,GAAiB,EACf,GAAG5D;AADY,CAAjB"}
|
|
@@ -10,7 +10,7 @@ exports.checkVersion = checkVersion;
|
|
|
10
10
|
* with the version used to build the native part of the library in runtime.
|
|
11
11
|
* Remember to keep this in sync with the version declared in `package.json`
|
|
12
12
|
*/
|
|
13
|
-
const jsVersion = '3.0.
|
|
13
|
+
const jsVersion = '3.0.1';
|
|
14
14
|
/**
|
|
15
15
|
* Checks that native and js versions of reanimated match.
|
|
16
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jsVersion","checkVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","error","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor"],"sources":["checkVersion.ts"],"sourcesContent":["/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nconst jsVersion = '3.0.
|
|
1
|
+
{"version":3,"names":["jsVersion","checkVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","error","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor"],"sources":["checkVersion.ts"],"sourcesContent":["/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nconst jsVersion = '3.0.1';\n\n/**\n * Checks that native and js versions of reanimated match.\n */\nexport function checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n console.error(\n `[Reanimated] Couldn't determine the version of the native part of Reanimated. Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must use the exact version which is bundled into Expo SDK.`\n );\n return;\n }\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,OAAlB;AAEA;AACA;AACA;;AACO,SAASC,YAAT,GAA8B;EACnC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAA1B;;EACA,IAAIF,UAAU,KAAKG,SAAnB,EAA8B;IAC5BC,OAAO,CAACC,KAAR,CACG,8OADH;IAGA;EACD;;EACD,MAAMC,EAAE,GAAG,CAAC,MAAM;IAChB,IACER,SAAS,CAACS,KAAV,CAAgB,iBAAhB,KACAP,UAAU,CAACO,KAAX,CAAiB,iBAAjB,CAFF,EAGE;MACA;MACA,MAAM,CAACC,OAAD,EAAUC,OAAV,IAAqBX,SAAS,CAACY,KAAV,CAAgB,GAAhB,CAA3B;MACA,MAAM,CAACC,QAAD,EAAWC,QAAX,IAAuBZ,UAAU,CAACU,KAAX,CAAiB,GAAjB,CAA7B;MACA,OAAOF,OAAO,KAAKG,QAAZ,IAAwBF,OAAO,KAAKG,QAA3C;IACD,CARD,MAQO;MACL;MACA,OAAOd,SAAS,KAAKE,UAArB;IACD;EACF,CAbU,GAAX;;EAcA,IAAI,CAACM,EAAL,EAAS;IACPF,OAAO,CAACC,KAAR,CACG,gFAA+EP,SAAU,QAAOE,UAAW,4HAA2HA,UAAW,kCADpP,EADO,CAIP;EACD;AACF"}
|
|
@@ -18,25 +18,26 @@ var _shareables = require("./shareables");
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
20
|
const IS_JEST = (0, _PlatformChecker.isJest)();
|
|
21
|
+
const IS_WEB = (0, _PlatformChecker.shouldBeUseWeb)();
|
|
21
22
|
let _runOnUIQueue = [];
|
|
22
23
|
|
|
23
24
|
function setupSetImmediate() {
|
|
24
25
|
'worklet';
|
|
25
26
|
|
|
26
|
-
let
|
|
27
|
+
let immediateCallbacks = []; // @ts-ignore – typescript expects this to conform to NodeJS definition and expects the return value to be NodeJS.Immediate which is an object and not a number
|
|
27
28
|
|
|
28
29
|
global.setImmediate = callback => {
|
|
29
|
-
|
|
30
|
+
immediateCallbacks.push(callback);
|
|
30
31
|
return -1;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
global.__flushImmediates = () => {
|
|
34
|
-
for (let index = 0; index <
|
|
35
|
+
for (let index = 0; index < immediateCallbacks.length; index += 1) {
|
|
35
36
|
// we use classic 'for' loop because the size of the currentTasks array may change while executing some of the callbacks due to setImmediate calls
|
|
36
|
-
|
|
37
|
+
immediateCallbacks[index]();
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
immediateCallbacks = [];
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -57,10 +58,8 @@ const flushImmediates = (0, _PlatformChecker.shouldBeUseWeb)() ? () => {// on we
|
|
|
57
58
|
exports.flushImmediates = flushImmediates;
|
|
58
59
|
|
|
59
60
|
function runOnUI(worklet) {
|
|
60
|
-
if (__DEV__ && !
|
|
61
|
-
|
|
62
|
-
throw new Error('runOnUI() can only be used on worklets');
|
|
63
|
-
}
|
|
61
|
+
if (__DEV__ && !IS_WEB && worklet.__workletHash === undefined) {
|
|
62
|
+
throw new Error('runOnUI() can only be used on worklets');
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
return function () {
|
|
@@ -113,10 +112,8 @@ function runOnUI(worklet) {
|
|
|
113
112
|
|
|
114
113
|
|
|
115
114
|
function runOnUIImmediately(worklet) {
|
|
116
|
-
if (__DEV__) {
|
|
117
|
-
|
|
118
|
-
throw new Error('runOnUI() can only be used on worklets');
|
|
119
|
-
}
|
|
115
|
+
if (__DEV__ && !IS_WEB && worklet.__workletHash === undefined) {
|
|
116
|
+
throw new Error('runOnUI() can only be used on worklets');
|
|
120
117
|
}
|
|
121
118
|
|
|
122
119
|
return function () {
|