react-native-reanimated 3.13.0-rc.2 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +8 -2
  2. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +3 -1
  3. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +58 -33
  4. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +19 -9
  5. package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.cpp +11 -7
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +14 -6
  7. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +1 -1
  8. package/Common/cpp/NativeModules/NativeReanimatedModule.h +1 -1
  9. package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +1 -1
  10. package/Common/cpp/ReanimatedRuntime/WorkletRuntime.h +1 -1
  11. package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +6 -6
  12. package/Common/cpp/SharedItems/Shareables.cpp +25 -8
  13. package/Common/cpp/SharedItems/Shareables.h +12 -7
  14. package/android/CMakeLists.txt +1 -1
  15. package/android/src/main/cpp/LayoutAnimations.cpp +14 -0
  16. package/android/src/main/cpp/LayoutAnimations.h +5 -0
  17. package/android/src/main/cpp/NativeProxy.cpp +10 -0
  18. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -2
  19. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +2 -0
  20. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +2 -0
  21. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +10 -0
  22. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ScreensHelper.java +83 -0
  23. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +130 -31
  24. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +36 -0
  25. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/TabNavigatorObserver.java +128 -0
  26. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +8 -0
  27. package/android/src/reactNativeVersionPatch/RuntimeExecutor/73/com/swmansion/reanimated/NativeProxy.java +6 -0
  28. package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +6 -0
  29. package/apple/LayoutReanimation/REAAnimationsManager.h +2 -0
  30. package/apple/LayoutReanimation/REAAnimationsManager.m +5 -0
  31. package/apple/LayoutReanimation/REAScreensHelper.h +6 -0
  32. package/apple/LayoutReanimation/REAScreensHelper.m +92 -4
  33. package/apple/LayoutReanimation/REASharedTransitionManager.h +1 -0
  34. package/apple/LayoutReanimation/REASharedTransitionManager.m +254 -55
  35. package/apple/native/NativeProxy.mm +12 -0
  36. package/lib/module/Colors.js +5 -2
  37. package/lib/module/Colors.js.map +1 -1
  38. package/lib/module/UpdateProps.js +8 -8
  39. package/lib/module/UpdateProps.js.map +1 -1
  40. package/lib/module/ViewDescriptorsSet.js +0 -27
  41. package/lib/module/ViewDescriptorsSet.js.map +1 -1
  42. package/lib/module/createAnimatedComponent/InlinePropManager.js +1 -7
  43. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  44. package/lib/module/createAnimatedComponent/PropsFilter.js +1 -6
  45. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  46. package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
  47. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +1 -5
  48. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  49. package/lib/module/hook/commonTypes.js.map +1 -1
  50. package/lib/module/hook/useAnimatedStyle.js +12 -15
  51. package/lib/module/hook/useAnimatedStyle.js.map +1 -1
  52. package/lib/module/hook/useFrameCallback.js +2 -2
  53. package/lib/module/hook/useFrameCallback.js.map +1 -1
  54. package/lib/module/hook/useWorkletCallback.js +1 -1
  55. package/lib/module/hook/useWorkletCallback.js.map +1 -1
  56. package/lib/module/js-reanimated/index.js +3 -28
  57. package/lib/module/js-reanimated/index.js.map +1 -1
  58. package/lib/module/js-reanimated/webUtils.js +9 -0
  59. package/lib/module/js-reanimated/webUtils.js.map +1 -0
  60. package/lib/module/js-reanimated/webUtils.web.js +25 -0
  61. package/lib/module/js-reanimated/webUtils.web.js.map +1 -0
  62. package/lib/module/layoutReanimation/defaultTransitions/CurvedTransition.js +1 -0
  63. package/lib/module/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  64. package/lib/module/layoutReanimation/defaultTransitions/EntryExitTransition.js +1 -0
  65. package/lib/module/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  66. package/lib/module/layoutReanimation/defaultTransitions/FadingTransition.js +11 -10
  67. package/lib/module/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  68. package/lib/module/layoutReanimation/defaultTransitions/JumpingTransition.js +1 -0
  69. package/lib/module/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  70. package/lib/module/layoutReanimation/defaultTransitions/LinearTransition.js +1 -0
  71. package/lib/module/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  72. package/lib/module/layoutReanimation/defaultTransitions/SequencedTransition.js +1 -0
  73. package/lib/module/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  74. package/lib/module/layoutReanimation/web/Easing.web.js +14 -0
  75. package/lib/module/layoutReanimation/web/Easing.web.js.map +1 -0
  76. package/lib/module/layoutReanimation/web/animationParser.js +16 -1
  77. package/lib/module/layoutReanimation/web/animationParser.js.map +1 -1
  78. package/lib/module/layoutReanimation/web/animationsManager.js +25 -8
  79. package/lib/module/layoutReanimation/web/animationsManager.js.map +1 -1
  80. package/lib/module/layoutReanimation/web/componentStyle.js +12 -16
  81. package/lib/module/layoutReanimation/web/componentStyle.js.map +1 -1
  82. package/lib/module/layoutReanimation/web/componentUtils.js +53 -18
  83. package/lib/module/layoutReanimation/web/componentUtils.js.map +1 -1
  84. package/lib/module/layoutReanimation/web/config.js +1 -12
  85. package/lib/module/layoutReanimation/web/config.js.map +1 -1
  86. package/lib/module/layoutReanimation/web/createAnimation.js +21 -2
  87. package/lib/module/layoutReanimation/web/createAnimation.js.map +1 -1
  88. package/lib/module/layoutReanimation/web/domUtils.js +6 -5
  89. package/lib/module/layoutReanimation/web/domUtils.js.map +1 -1
  90. package/lib/module/layoutReanimation/web/transition/Jumping.web.js +43 -0
  91. package/lib/module/layoutReanimation/web/transition/Jumping.web.js.map +1 -0
  92. package/lib/module/platform-specific/RNRenderer.web.js +1 -1
  93. package/lib/module/platform-specific/RNRenderer.web.js.map +1 -1
  94. package/lib/module/platform-specific/jsVersion.js +1 -1
  95. package/lib/module/platform-specific/jsVersion.js.map +1 -1
  96. package/lib/module/platformFunctions/setNativeProps.web.js +1 -3
  97. package/lib/module/platformFunctions/setNativeProps.web.js.map +1 -1
  98. package/lib/typescript/UpdateProps.d.ts +2 -3
  99. package/lib/typescript/ViewDescriptorsSet.d.ts +0 -9
  100. package/lib/typescript/createAnimatedComponent/commonTypes.d.ts +1 -2
  101. package/lib/typescript/hook/commonTypes.d.ts +3 -6
  102. package/lib/typescript/hook/useWorkletCallback.d.ts +1 -1
  103. package/lib/typescript/js-reanimated/index.d.ts +2 -4
  104. package/lib/typescript/js-reanimated/webUtils.d.ts +3 -0
  105. package/lib/typescript/js-reanimated/webUtils.web.d.ts +3 -0
  106. package/lib/typescript/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +1 -0
  107. package/lib/typescript/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +1 -0
  108. package/lib/typescript/layoutReanimation/defaultTransitions/FadingTransition.d.ts +1 -0
  109. package/lib/typescript/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +1 -0
  110. package/lib/typescript/layoutReanimation/defaultTransitions/LinearTransition.d.ts +1 -0
  111. package/lib/typescript/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +1 -0
  112. package/lib/typescript/layoutReanimation/web/Easing.web.d.ts +10 -0
  113. package/lib/typescript/layoutReanimation/web/animationParser.d.ts +1 -2
  114. package/lib/typescript/layoutReanimation/web/componentStyle.d.ts +1 -1
  115. package/lib/typescript/layoutReanimation/web/componentUtils.d.ts +4 -3
  116. package/lib/typescript/layoutReanimation/web/config.d.ts +5 -12
  117. package/lib/typescript/layoutReanimation/web/createAnimation.d.ts +2 -0
  118. package/lib/typescript/layoutReanimation/web/domUtils.d.ts +1 -1
  119. package/lib/typescript/layoutReanimation/web/transition/Jumping.web.d.ts +29 -0
  120. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  121. package/package.json +4 -3
  122. package/src/Colors.ts +5 -2
  123. package/src/UpdateProps.ts +8 -11
  124. package/src/ViewDescriptorsSet.ts +0 -42
  125. package/src/createAnimatedComponent/InlinePropManager.ts +2 -8
  126. package/src/createAnimatedComponent/PropsFilter.tsx +0 -4
  127. package/src/createAnimatedComponent/commonTypes.ts +1 -2
  128. package/src/createAnimatedComponent/createAnimatedComponent.tsx +1 -5
  129. package/src/hook/commonTypes.ts +3 -6
  130. package/src/hook/useAnimatedStyle.ts +9 -26
  131. package/src/hook/useFrameCallback.ts +2 -2
  132. package/src/hook/useWorkletCallback.ts +1 -1
  133. package/src/js-reanimated/index.ts +11 -37
  134. package/src/js-reanimated/webUtils.ts +8 -0
  135. package/src/js-reanimated/webUtils.web.ts +27 -0
  136. package/src/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -0
  137. package/src/layoutReanimation/defaultTransitions/EntryExitTransition.ts +2 -0
  138. package/src/layoutReanimation/defaultTransitions/FadingTransition.ts +12 -10
  139. package/src/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -0
  140. package/src/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -0
  141. package/src/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -0
  142. package/src/layoutReanimation/web/Easing.web.ts +15 -0
  143. package/src/layoutReanimation/web/animationParser.ts +30 -2
  144. package/src/layoutReanimation/web/animationsManager.ts +45 -12
  145. package/src/layoutReanimation/web/componentStyle.ts +13 -16
  146. package/src/layoutReanimation/web/componentUtils.ts +68 -25
  147. package/src/layoutReanimation/web/config.ts +5 -14
  148. package/src/layoutReanimation/web/createAnimation.ts +38 -4
  149. package/src/layoutReanimation/web/domUtils.ts +15 -5
  150. package/src/layoutReanimation/web/transition/Jumping.web.ts +44 -0
  151. package/src/platform-specific/RNRenderer.web.ts +1 -1
  152. package/src/platform-specific/jsVersion.ts +1 -1
  153. package/src/platformFunctions/setNativeProps.web.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["isWindowAvailable","setDummyPosition","snapshots","Animations","PREDEFINED_WEB_ANIMATIONS_ID","CUSTOM_WEB_ANIMATIONS_ID","animationNameToIndex","Map","animationNameList","isObserverSet","configureWebLayoutAnimations","document","getElementById","predefinedAnimationsStyleTag","createElement","id","onload","sheet","console","error","animationName","insertRule","style","customAnimationsStyleTag","head","appendChild","insertWebAnimation","keyframe","styleTag","unshift","set","i","length","nextAnimationName","nextAnimationIndex","get","undefined","Error","removeWebAnimation","_styleTag$sheet","currentAnimationIndex","deleteRule","splice","delete","timeoutScale","frameDurationMs","minimumFrames","scheduleAnimationCleanup","animationDuration","timeoutValue","Math","max","setTimeout","reattachElementToAncestor","child","parent","childSnapshot","removedAfterAnimation","originalOnAnimationEnd","onanimationend","event","removeChild","call","findDescendantWithExitingAnimation","node","root","HTMLElement","reanimatedDummy","children","Array","from","checkIfScreenWasChanged","mutationTarget","_mutationTarget$react","reactFiberKey","key","Object","keys","startsWith","memoizedProps","navigation","addHTMLMutationObserver","observer","MutationObserver","mutationsList","rootMutation","target","removedNodes","observe","body","childList","subtree","areDOMRectsEqual","r1","r2","x","y","width","height"],"sources":["domUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { isWindowAvailable } from '../../PlatformChecker';\nimport { setDummyPosition, snapshots } from './componentStyle';\nimport { Animations } from './config';\nimport type { AnimationNames } from './config';\n\nconst PREDEFINED_WEB_ANIMATIONS_ID = 'ReanimatedPredefinedWebAnimationsStyle';\nconst CUSTOM_WEB_ANIMATIONS_ID = 'ReanimatedCustomWebAnimationsStyle';\n\n// Since we cannot remove keyframe from DOM by its name, we have to store its id\nconst animationNameToIndex = new Map<string, number>();\nconst animationNameList: string[] = [];\n\nlet isObserverSet = false;\n\n/**\n * Creates `HTMLStyleElement`, inserts it into DOM and then inserts CSS rules into the stylesheet.\n * If style element already exists, nothing happens.\n */\nexport function configureWebLayoutAnimations() {\n if (\n !isWindowAvailable() || // Without this check SSR crashes because document is undefined (NextExample on CI)\n document.getElementById(PREDEFINED_WEB_ANIMATIONS_ID) !== null\n ) {\n return;\n }\n\n const predefinedAnimationsStyleTag = document.createElement('style');\n predefinedAnimationsStyleTag.id = PREDEFINED_WEB_ANIMATIONS_ID;\n\n predefinedAnimationsStyleTag.onload = () => {\n if (!predefinedAnimationsStyleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n for (const animationName in Animations) {\n predefinedAnimationsStyleTag.sheet.insertRule(\n Animations[animationName as AnimationNames].style\n );\n }\n };\n\n const customAnimationsStyleTag = document.createElement('style');\n customAnimationsStyleTag.id = CUSTOM_WEB_ANIMATIONS_ID;\n\n document.head.appendChild(predefinedAnimationsStyleTag);\n document.head.appendChild(customAnimationsStyleTag);\n}\n\nexport function insertWebAnimation(animationName: string, keyframe: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n if (!styleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n styleTag.sheet.insertRule(keyframe, 0);\n animationNameList.unshift(animationName);\n animationNameToIndex.set(animationName, 0);\n\n for (let i = 1; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex + 1);\n }\n}\n\nfunction removeWebAnimation(animationName: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n const currentAnimationIndex = animationNameToIndex.get(animationName);\n\n if (currentAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n styleTag.sheet?.deleteRule(currentAnimationIndex);\n animationNameList.splice(currentAnimationIndex, 1);\n animationNameToIndex.delete(animationName);\n\n for (let i = currentAnimationIndex; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex - 1);\n }\n}\n\nconst timeoutScale = 1.25; // We use this value to enlarge timeout duration. It can prove useful if animation lags.\nconst frameDurationMs = 16; // Just an approximation.\nconst minimumFrames = 10;\n\nexport function scheduleAnimationCleanup(\n animationName: string,\n animationDuration: number\n) {\n // If duration is very short, we want to keep remove delay to at least 10 frames\n // In our case it is exactly 160/1099 s, which is approximately 0.15s\n const timeoutValue = Math.max(\n animationDuration * timeoutScale * 1000,\n animationDuration + frameDurationMs * minimumFrames\n );\n\n setTimeout(() => removeWebAnimation(animationName), timeoutValue);\n}\n\nfunction reattachElementToAncestor(child: ReanimatedHTMLElement, parent: Node) {\n const childSnapshot = snapshots.get(child);\n\n if (!childSnapshot) {\n console.error('[Reanimated] Failed to obtain snapshot.');\n return;\n }\n\n // We use that so we don't end up in infinite loop\n child.removedAfterAnimation = true;\n parent.appendChild(child);\n\n setDummyPosition(child, childSnapshot);\n\n const originalOnAnimationEnd = child.onanimationend;\n\n child.onanimationend = function (event: AnimationEvent) {\n parent.removeChild(child);\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n}\n\nfunction findDescendantWithExitingAnimation(\n node: ReanimatedHTMLElement,\n root: Node\n) {\n // Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object),\n // therefore it won't have children prop and calling Array.from(node.children) will cause error.\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n if (node.reanimatedDummy && node.removedAfterAnimation === undefined) {\n reattachElementToAncestor(node, root);\n }\n\n const children = Array.from(node.children);\n\n for (let i = 0; i < children.length; ++i) {\n findDescendantWithExitingAnimation(\n children[i] as ReanimatedHTMLElement,\n root\n );\n }\n}\n\ntype FiberNodeKey = `__reactFiber${string}`;\n\ninterface FiberNode {\n memoizedProps?: {\n navigation?: unknown;\n };\n\n child?: FiberNode;\n}\n\ntype WithFiberNode = {\n [key: FiberNodeKey]: FiberNode;\n};\n\ntype MaybeWithFiberNode = Partial<WithFiberNode>;\n\nfunction checkIfScreenWasChanged(\n mutationTarget: ReanimatedHTMLElement & MaybeWithFiberNode\n) {\n let reactFiberKey: FiberNodeKey = '__reactFiber';\n\n for (const key of Object.keys(mutationTarget)) {\n if (key.startsWith('__reactFiber')) {\n reactFiberKey = key as FiberNodeKey;\n break;\n }\n }\n\n return (\n mutationTarget[reactFiberKey]?.child?.memoizedProps?.navigation !==\n undefined\n );\n}\n\nexport function addHTMLMutationObserver() {\n if (isObserverSet || !isWindowAvailable()) {\n return;\n }\n\n isObserverSet = true;\n\n const observer = new MutationObserver((mutationsList) => {\n const rootMutation = mutationsList[mutationsList.length - 1];\n\n if (\n checkIfScreenWasChanged(\n rootMutation.target as ReanimatedHTMLElement & MaybeWithFiberNode\n )\n ) {\n return;\n }\n\n for (let i = 0; i < rootMutation.removedNodes.length; ++i) {\n findDescendantWithExitingAnimation(\n rootMutation.removedNodes[i] as ReanimatedHTMLElement,\n rootMutation.target\n );\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport function areDOMRectsEqual(r1: DOMRect, r2: DOMRect) {\n // There are 4 more fields, but checking these should suffice\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AAC9D,SAASC,UAAU,QAAQ,UAAU;AAGrC,MAAMC,4BAA4B,GAAG,wCAAwC;AAC7E,MAAMC,wBAAwB,GAAG,oCAAoC;;AAErE;AACA,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAiB,CAAC;AACtD,MAAMC,iBAA2B,GAAG,EAAE;AAEtC,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC7C,IACE,CAACV,iBAAiB,CAAC,CAAC;EAAI;EACxBW,QAAQ,CAACC,cAAc,CAACR,4BAA4B,CAAC,KAAK,IAAI,EAC9D;IACA;EACF;EAEA,MAAMS,4BAA4B,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EACpED,4BAA4B,CAACE,EAAE,GAAGX,4BAA4B;EAE9DS,4BAA4B,CAACG,MAAM,GAAG,MAAM;IAC1C,IAAI,CAACH,4BAA4B,CAACI,KAAK,EAAE;MACvCC,OAAO,CAACC,KAAK,CACX,6DACF,CAAC;MACD;IACF;IAEA,KAAK,MAAMC,aAAa,IAAIjB,UAAU,EAAE;MACtCU,4BAA4B,CAACI,KAAK,CAACI,UAAU,CAC3ClB,UAAU,CAACiB,aAAa,CAAmB,CAAC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AAI;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;AACrE;AAEA,OAAO,SAASC,gBAAgBA,CAACC,EAAW,EAAEC,EAAW,EAAE;EACzD;EACA,OACED,EAAE,CAACE,CAAC,KAAKD,EAAE,CAACC,CAAC,IACbF,EAAE,CAACG,CAAC,KAAKF,EAAE,CAACE,CAAC,IACbH,EAAE,CAACI,KAAK,KAAKH,EAAE,CAACG,KAAK,IACrBJ,EAAE,CAACK,MAAM,KAAKJ,EAAE,CAACI,MAAM;AAE3B","ignoreList":[]}
1
+ {"version":3,"names":["isWindowAvailable","setElementPosition","snapshots","Animations","PREDEFINED_WEB_ANIMATIONS_ID","CUSTOM_WEB_ANIMATIONS_ID","animationNameToIndex","Map","animationNameList","isObserverSet","configureWebLayoutAnimations","document","getElementById","predefinedAnimationsStyleTag","createElement","id","onload","sheet","console","error","animationName","insertRule","style","customAnimationsStyleTag","head","appendChild","insertWebAnimation","keyframe","styleTag","unshift","set","i","length","nextAnimationName","nextAnimationIndex","get","undefined","Error","removeWebAnimation","animationRemoveCallback","_styleTag$sheet","currentAnimationIndex","deleteRule","splice","delete","timeoutScale","frameDurationMs","minimumFrames","scheduleAnimationCleanup","animationDuration","timeoutValue","Math","max","setTimeout","reattachElementToAncestor","child","parent","childSnapshot","removedAfterAnimation","originalOnAnimationEnd","onanimationend","event","removeChild","call","findDescendantWithExitingAnimation","node","root","HTMLElement","reanimatedDummy","children","Array","from","checkIfScreenWasChanged","mutationTarget","_mutationTarget$react","reactFiberKey","key","Object","keys","startsWith","memoizedProps","navigation","addHTMLMutationObserver","observer","MutationObserver","mutationsList","rootMutation","target","removedNodes","observe","body","childList","subtree","areDOMRectsEqual","r1","r2","x","y","width","height"],"sources":["domUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { isWindowAvailable } from '../../PlatformChecker';\nimport { setElementPosition, snapshots } from './componentStyle';\nimport { Animations } from './config';\nimport type { AnimationNames } from './config';\n\nconst PREDEFINED_WEB_ANIMATIONS_ID = 'ReanimatedPredefinedWebAnimationsStyle';\nconst CUSTOM_WEB_ANIMATIONS_ID = 'ReanimatedCustomWebAnimationsStyle';\n\n// Since we cannot remove keyframe from DOM by its name, we have to store its id\nconst animationNameToIndex = new Map<string, number>();\nconst animationNameList: string[] = [];\n\nlet isObserverSet = false;\n\n/**\n * Creates `HTMLStyleElement`, inserts it into DOM and then inserts CSS rules into the stylesheet.\n * If style element already exists, nothing happens.\n */\nexport function configureWebLayoutAnimations() {\n if (\n !isWindowAvailable() || // Without this check SSR crashes because document is undefined (NextExample on CI)\n document.getElementById(PREDEFINED_WEB_ANIMATIONS_ID) !== null\n ) {\n return;\n }\n\n const predefinedAnimationsStyleTag = document.createElement('style');\n predefinedAnimationsStyleTag.id = PREDEFINED_WEB_ANIMATIONS_ID;\n\n predefinedAnimationsStyleTag.onload = () => {\n if (!predefinedAnimationsStyleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n for (const animationName in Animations) {\n predefinedAnimationsStyleTag.sheet.insertRule(\n Animations[animationName as AnimationNames].style\n );\n }\n };\n\n const customAnimationsStyleTag = document.createElement('style');\n customAnimationsStyleTag.id = CUSTOM_WEB_ANIMATIONS_ID;\n\n document.head.appendChild(predefinedAnimationsStyleTag);\n document.head.appendChild(customAnimationsStyleTag);\n}\n\nexport function insertWebAnimation(animationName: string, keyframe: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n if (!styleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n styleTag.sheet.insertRule(keyframe, 0);\n animationNameList.unshift(animationName);\n animationNameToIndex.set(animationName, 0);\n\n for (let i = 1; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex + 1);\n }\n}\n\nfunction removeWebAnimation(\n animationName: string,\n animationRemoveCallback: () => void\n) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n const currentAnimationIndex = animationNameToIndex.get(animationName);\n\n if (currentAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationRemoveCallback();\n\n styleTag.sheet?.deleteRule(currentAnimationIndex);\n\n animationNameList.splice(currentAnimationIndex, 1);\n animationNameToIndex.delete(animationName);\n\n for (let i = currentAnimationIndex; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex - 1);\n }\n}\n\nconst timeoutScale = 1.25; // We use this value to enlarge timeout duration. It can prove useful if animation lags.\nconst frameDurationMs = 16; // Just an approximation.\nconst minimumFrames = 10;\n\nexport function scheduleAnimationCleanup(\n animationName: string,\n animationDuration: number,\n animationRemoveCallback: () => void\n) {\n // If duration is very short, we want to keep remove delay to at least 10 frames\n // In our case it is exactly 160/1099 s, which is approximately 0.15s\n const timeoutValue = Math.max(\n animationDuration * timeoutScale * 1000,\n animationDuration + frameDurationMs * minimumFrames\n );\n\n setTimeout(\n () => removeWebAnimation(animationName, animationRemoveCallback),\n timeoutValue\n );\n}\n\nfunction reattachElementToAncestor(child: ReanimatedHTMLElement, parent: Node) {\n const childSnapshot = snapshots.get(child);\n\n if (!childSnapshot) {\n console.error('[Reanimated] Failed to obtain snapshot.');\n return;\n }\n\n // We use that so we don't end up in infinite loop\n child.removedAfterAnimation = true;\n parent.appendChild(child);\n\n setElementPosition(child, childSnapshot);\n\n const originalOnAnimationEnd = child.onanimationend;\n\n child.onanimationend = function (event: AnimationEvent) {\n parent.removeChild(child);\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n}\n\nfunction findDescendantWithExitingAnimation(\n node: ReanimatedHTMLElement,\n root: Node\n) {\n // Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object),\n // therefore it won't have children prop and calling Array.from(node.children) will cause error.\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n if (node.reanimatedDummy && node.removedAfterAnimation === undefined) {\n reattachElementToAncestor(node, root);\n }\n\n const children = Array.from(node.children);\n\n for (let i = 0; i < children.length; ++i) {\n findDescendantWithExitingAnimation(\n children[i] as ReanimatedHTMLElement,\n root\n );\n }\n}\n\ntype FiberNodeKey = `__reactFiber${string}`;\n\ninterface FiberNode {\n memoizedProps?: {\n navigation?: unknown;\n };\n\n child?: FiberNode;\n}\n\ntype WithFiberNode = {\n [key: FiberNodeKey]: FiberNode;\n};\n\ntype MaybeWithFiberNode = Partial<WithFiberNode>;\n\nfunction checkIfScreenWasChanged(\n mutationTarget: ReanimatedHTMLElement & MaybeWithFiberNode\n) {\n let reactFiberKey: FiberNodeKey = '__reactFiber';\n\n for (const key of Object.keys(mutationTarget)) {\n if (key.startsWith('__reactFiber')) {\n reactFiberKey = key as FiberNodeKey;\n break;\n }\n }\n\n return (\n mutationTarget[reactFiberKey]?.child?.memoizedProps?.navigation !==\n undefined\n );\n}\n\nexport function addHTMLMutationObserver() {\n if (isObserverSet || !isWindowAvailable()) {\n return;\n }\n\n isObserverSet = true;\n\n const observer = new MutationObserver((mutationsList) => {\n const rootMutation = mutationsList[mutationsList.length - 1];\n\n if (\n checkIfScreenWasChanged(\n rootMutation.target as ReanimatedHTMLElement & MaybeWithFiberNode\n )\n ) {\n return;\n }\n\n for (let i = 0; i < rootMutation.removedNodes.length; ++i) {\n findDescendantWithExitingAnimation(\n rootMutation.removedNodes[i] as ReanimatedHTMLElement,\n rootMutation.target\n );\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport function areDOMRectsEqual(r1: DOMRect, r2: DOMRect) {\n // There are 4 more fields, but checking these should suffice\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,kBAAkB,EAAEC,SAAS,QAAQ,kBAAkB;AAChE,SAASC,UAAU,QAAQ,UAAU;AAGrC,MAAMC,4BAA4B,GAAG,wCAAwC;AAC7E,MAAMC,wBAAwB,GAAG,oCAAoC;;AAErE;AACA,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAiB,CAAC;AACtD,MAAMC,iBAA2B,GAAG,EAAE;AAEtC,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC7C,IACE,CAACV,iBAAiB,CAAC,CAAC;EAAI;EACxBW,QAAQ,CAACC,cAAc,CAACR,4BAA4B,CAAC,KAAK,IAAI,EAC9D;IACA;EACF;EAEA,MAAMS,4BAA4B,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EACpED,4BAA4B,CAACE,EAAE,GAAGX,4BAA4B;EAE9DS,4BAA4B,CAACG,MAAM,GAAG,MAAM;IAC1C,IAAI,CAACH,4BAA4B,CAACI,KAAK,EAAE;MACvCC,OAAO,CAACC,KAAK,CACX,6DACF,CAAC;MACD;IACF;IAEA,KAAK,MAAMC,aAAa,IAAIjB,UAAU,EAAE;MACtCU,4BAA4B,CAACI,KAAK,CAACI,UAAU,CAC3ClB,UAAU,CAACiB,aAAa,CAAmB,CAACE,KAC9C,CAAC;IACH;EACF,CAAC;EAED,MAAMC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AI,EAAE;IAAEC,SAAS,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;AACrE;AAEA,OAAO,SAASC,gBAAgBA,CAACC,EAAW,EAAEC,EAAW,EAAE;EACzD;EACA,OACED,EAAE,CAACE,CAAC,KAAKD,EAAE,CAACC,CAAC,IACbF,EAAE,CAACG,CAAC,KAAKF,EAAE,CAACE,CAAC,IACbH,EAAE,CAACI,KAAK,KAAKH,EAAE,CAACG,KAAK,IACrBJ,EAAE,CAACK,MAAM,KAAKJ,EAAE,CAACI,MAAM;AAE3B","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ import { Easing } from '../../../Easing';
4
+ export function JumpingTransition(name, transitionData) {
5
+ const {
6
+ translateX,
7
+ translateY,
8
+ scaleX,
9
+ scaleY
10
+ } = transitionData;
11
+ const d = Math.max(Math.abs(translateX), Math.abs(translateY)) / 2;
12
+ const peakTranslateY = translateY <= 0 ? translateY - d : -translateY + d;
13
+ const jumpingTransition = {
14
+ name,
15
+ style: {
16
+ 0: {
17
+ transform: [{
18
+ translateX: `${translateX}px`,
19
+ translateY: `${translateY}px`,
20
+ scale: `${scaleX},${scaleY}`
21
+ }],
22
+ easing: Easing.exp
23
+ },
24
+ 50: {
25
+ transform: [{
26
+ translateX: `${translateX / 2}px`,
27
+ translateY: `${peakTranslateY}px`,
28
+ scale: `${scaleX},${scaleY}`
29
+ }]
30
+ },
31
+ 100: {
32
+ transform: [{
33
+ translateX: '0px',
34
+ translateY: '0px',
35
+ scale: '1,1'
36
+ }]
37
+ }
38
+ },
39
+ duration: 300
40
+ };
41
+ return jumpingTransition;
42
+ }
43
+ //# sourceMappingURL=Jumping.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Easing","JumpingTransition","name","transitionData","translateX","translateY","scaleX","scaleY","d","Math","max","abs","peakTranslateY","jumpingTransition","style","transform","scale","easing","exp","duration"],"sources":["Jumping.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\nimport { Easing } from '../../../Easing';\n\nexport function JumpingTransition(\n name: string,\n transitionData: TransitionData\n) {\n const { translateX, translateY, scaleX, scaleY } = transitionData;\n\n const d = Math.max(Math.abs(translateX), Math.abs(translateY)) / 2;\n const peakTranslateY = translateY <= 0 ? translateY - d : -translateY + d;\n\n const jumpingTransition = {\n name,\n style: {\n 0: {\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n easing: Easing.exp,\n },\n 50: {\n transform: [\n {\n translateX: `${translateX / 2}px`,\n translateY: `${peakTranslateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 100: {\n transform: [{ translateX: '0px', translateY: '0px', scale: '1,1' }],\n },\n },\n duration: 300,\n };\n\n return jumpingTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,iBAAiB;AAExC,OAAO,SAASC,iBAAiBA,CAC/BC,IAAY,EACZC,cAA8B,EAC9B;EACA,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,cAAc;EAEjE,MAAMK,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,UAAU,CAAC,EAAEK,IAAI,CAACE,GAAG,CAACN,UAAU,CAAC,CAAC,GAAG,CAAC;EAClE,MAAMO,cAAc,GAAGP,UAAU,IAAI,CAAC,GAAGA,UAAU,GAAGG,CAAC,GAAG,CAACH,UAAU,GAAGG,CAAC;EAEzE,MAAMK,iBAAiB,GAAG;IACxBX,IAAI;IACJY,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,SAAS,EAAE,CACT;UACEX,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BW,KAAK,EAAG,GAAEV,MAAO,IAAGC,MAAO;QAC7B,CAAC,CACF;QACDU,MAAM,EAAEjB,MAAM,CAACkB;MACjB,CAAC;MACD,EAAE,EAAE;QACFH,SAAS,EAAE,CACT;UACEX,UAAU,EAAG,GAAEA,UAAU,GAAG,CAAE,IAAG;UACjCC,UAAU,EAAG,GAAEO,cAAe,IAAG;UACjCI,KAAK,EAAG,GAAEV,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,GAAG,EAAE;QACHQ,SAAS,EAAE,CAAC;UAAEX,UAAU,EAAE,KAAK;UAAEC,UAAU,EAAE,KAAK;UAAEW,KAAK,EAAE;QAAM,CAAC;MACpE;IACF,CAAC;IACDG,QAAQ,EAAE;EACZ,CAAC;EAED,OAAON,iBAAiB;AAC1B","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
3
  // RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.
4
- module.exports = null;
4
+ export {};
5
5
  //# sourceMappingURL=RNRenderer.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["module","exports"],"sources":["RNRenderer.web.ts"],"sourcesContent":["'use strict';\n// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nmodule.exports = null;\n"],"mappings":"AAAA,YAAY;;AACZ;AACAA,MAAM,CAACC,OAAO,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["RNRenderer.web.ts"],"sourcesContent":["'use strict';\n// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nexport {};\n"],"mappings":"AAAA,YAAY;;AACZ;AACA","ignoreList":[]}
@@ -5,5 +5,5 @@
5
5
  * with the version used to build the native part of the library in runtime.
6
6
  * Remember to keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '3.13.0-rc.2';
8
+ export const jsVersion = '3.13.0';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\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 */\nexport const jsVersion = '3.13.0-rc.2';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\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 */\nexport const jsVersion = '3.13.0';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,QAAQ","ignoreList":[]}
@@ -3,8 +3,6 @@
3
3
  import { _updatePropsJS } from '../js-reanimated';
4
4
  export function setNativeProps(animatedRef, updates) {
5
5
  const component = animatedRef();
6
- _updatePropsJS(updates, {
7
- _component: component
8
- });
6
+ _updatePropsJS(updates, component);
9
7
  }
10
8
  //# sourceMappingURL=setNativeProps.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_updatePropsJS","setNativeProps","animatedRef","updates","component","_component"],"sources":["setNativeProps.web.ts"],"sourcesContent":["'use strict';\nimport type { ReanimatedHTMLElement } from '../js-reanimated';\nimport { _updatePropsJS } from '../js-reanimated';\nimport type { StyleProps } from '../commonTypes';\nimport type { AnimatedRef } from '../hook/commonTypes';\nimport type { Component } from 'react';\n\nexport function setNativeProps<T extends Component>(\n animatedRef: AnimatedRef<T>,\n updates: StyleProps\n) {\n const component = animatedRef() as ReanimatedHTMLElement;\n _updatePropsJS(updates, { _component: component });\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,cAAc,QAAQ,kBAAkB;AAKjD,OAAO,SAASC,cAAcA,CAC5BC,WAA2B,EAC3BC,OAAmB,EACnB;EACA,MAAMC,SAAS,GAAGF,WAAW,CAAC,CAA0B;EACxDF,cAAc,CAACG,OAAO,EAAE;IAAEE,UAAU,EAAED;EAAU,CAAC,CAAC;AACpD","ignoreList":[]}
1
+ {"version":3,"names":["_updatePropsJS","setNativeProps","animatedRef","updates","component"],"sources":["setNativeProps.web.ts"],"sourcesContent":["'use strict';\nimport type { ReanimatedHTMLElement } from '../js-reanimated';\nimport { _updatePropsJS } from '../js-reanimated';\nimport type { StyleProps } from '../commonTypes';\nimport type { AnimatedRef } from '../hook/commonTypes';\nimport type { Component } from 'react';\n\nexport function setNativeProps<T extends Component>(\n animatedRef: AnimatedRef<T>,\n updates: StyleProps\n) {\n const component = animatedRef() as ReanimatedHTMLElement;\n _updatePropsJS(updates, component);\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,cAAc,QAAQ,kBAAkB;AAKjD,OAAO,SAASC,cAAcA,CAC5BC,WAA2B,EAC3BC,OAAmB,EACnB;EACA,MAAMC,SAAS,GAAGF,WAAW,CAAC,CAA0B;EACxDF,cAAc,CAACG,OAAO,EAAEC,SAAS,CAAC;AACpC","ignoreList":[]}
@@ -2,9 +2,8 @@ import type { MutableRefObject } from 'react';
2
2
  import type { SharedValue, StyleProps } from './commonTypes';
3
3
  import type { AnimatedStyle } from './helperTypes';
4
4
  import type { Descriptor } from './hook/commonTypes';
5
- import type { ViewRefSet } from './ViewDescriptorsSet';
6
- declare let updateProps: (viewDescriptor: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle<any>, maybeViewRef: ViewRefSet<any> | undefined, isAnimatedProps?: boolean) => void;
7
- export declare const updatePropsJestWrapper: (viewDescriptors: SharedValue<Descriptor[]>, updates: AnimatedStyle<any>, maybeViewRef: ViewRefSet<any> | undefined, animatedStyle: MutableRefObject<AnimatedStyle<any>>, adapters: ((updates: AnimatedStyle<any>) => void)[]) => void;
5
+ declare let updateProps: (viewDescriptor: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle<any>, isAnimatedProps?: boolean) => void;
6
+ export declare const updatePropsJestWrapper: (viewDescriptors: SharedValue<Descriptor[]>, updates: AnimatedStyle<any>, animatedStyle: MutableRefObject<AnimatedStyle<any>>, adapters: ((updates: AnimatedStyle<any>) => void)[]) => void;
8
7
  export default updateProps;
9
8
  export interface UpdatePropsManager {
10
9
  update(viewDescriptors: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle<any>): void;
@@ -1,17 +1,8 @@
1
1
  import type { SharedValue } from './commonTypes';
2
2
  import type { Descriptor } from './hook/commonTypes';
3
- export interface ViewRefSet<T> {
4
- items: Set<T>;
5
- add: (item: T) => void;
6
- remove: (item: T) => void;
7
- }
8
3
  export interface ViewDescriptorsSet {
9
4
  shareableViewDescriptors: SharedValue<Descriptor[]>;
10
5
  add: (item: Descriptor) => void;
11
6
  remove: (viewTag: number) => void;
12
7
  }
13
8
  export declare function makeViewDescriptorsSet(): ViewDescriptorsSet;
14
- export declare const useViewRefSet: typeof useViewRefSetJS | typeof useViewRefSetNative;
15
- declare function useViewRefSetNative(): undefined;
16
- declare function useViewRefSetJS<T>(): ViewRefSet<T>;
17
- export {};
@@ -1,12 +1,11 @@
1
1
  import type { Ref, Component } from 'react';
2
2
  import type { ShadowNodeWrapper, SharedValue, StyleProps } from '../commonTypes';
3
3
  import type { ViewConfig } from '../ConfigHelper';
4
- import type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';
4
+ import type { ViewDescriptorsSet } from '../ViewDescriptorsSet';
5
5
  import type { BaseAnimationBuilder, EntryExitAnimationFunction, ILayoutAnimationBuilder, SharedTransition } from '../layoutReanimation';
6
6
  import type { SkipEnteringContext } from '../component/LayoutAnimationConfig';
7
7
  export interface AnimatedProps extends Record<string, unknown> {
8
8
  viewDescriptors?: ViewDescriptorsSet;
9
- viewsRef?: ViewRefSet<unknown>;
10
9
  initial?: SharedValue<StyleProps>;
11
10
  }
12
11
  export interface ViewInfo {
@@ -1,11 +1,12 @@
1
1
  import type { Component, MutableRefObject } from 'react';
2
2
  import type { AnimatedPropsAdapterFunction, ShadowNodeWrapper, SharedValue, WorkletFunction } from '../commonTypes';
3
3
  import type { ImageStyle, NativeSyntheticEvent, TextStyle, ViewStyle, NativeScrollEvent } from 'react-native';
4
- import type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';
4
+ import type { ViewDescriptorsSet } from '../ViewDescriptorsSet';
5
5
  import type { AnimatedStyle } from '../helperTypes';
6
+ import type { ReanimatedHTMLElement } from '../js-reanimated';
6
7
  export type DependencyList = Array<unknown> | undefined;
7
8
  export interface Descriptor {
8
- tag: number;
9
+ tag: number | ReanimatedHTMLElement;
9
10
  name: string;
10
11
  shadowNodeWrapper: ShadowNodeWrapper;
11
12
  }
@@ -56,10 +57,6 @@ export interface AnimatedStyleHandle<Style extends DefaultStyle = DefaultStyle>
56
57
  value: AnimatedStyle<Style>;
57
58
  updater: () => AnimatedStyle<Style>;
58
59
  };
59
- /**
60
- * @remarks `viewsRef` is only defined in Web implementation.
61
- */
62
- viewsRef: ViewRefSet<unknown> | undefined;
63
60
  }
64
61
  export interface JestAnimatedStyleHandle<Style extends DefaultStyle = DefaultStyle> extends AnimatedStyleHandle<Style> {
65
62
  jestAnimatedStyle: MutableRefObject<AnimatedStyle<Style>>;
@@ -1,5 +1,5 @@
1
1
  import type { DependencyList } from './commonTypes';
2
2
  /**
3
- * @deprecated don't use
3
+ * @deprecated use React.useCallback instead
4
4
  */
5
5
  export declare function useWorkletCallback<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, deps?: DependencyList): (...args: Args) => ReturnValue;
@@ -21,9 +21,7 @@ export interface ReanimatedHTMLElement extends HTMLElement {
21
21
  reanimatedDummy?: boolean;
22
22
  removedAfterAnimation?: boolean;
23
23
  }
24
- export declare const _updatePropsJS: (updates: StyleProps | AnimatedStyle<any>, viewRef: {
25
- _component?: (JSReanimatedComponent | ReanimatedHTMLElement) & {
26
- getAnimatableRef?: () => JSReanimatedComponent | ReanimatedHTMLElement;
27
- };
24
+ export declare const _updatePropsJS: (updates: StyleProps | AnimatedStyle<any>, viewRef: (JSReanimatedComponent | ReanimatedHTMLElement) & {
25
+ getAnimatableRef?: () => JSReanimatedComponent | ReanimatedHTMLElement;
28
26
  }, isAnimatedProps?: boolean) => void;
29
27
  export default reanimatedJS;
@@ -0,0 +1,3 @@
1
+ export declare let createReactDOMStyle: (style: any) => any;
2
+ export declare let createTransformValue: (transform: any) => any;
3
+ export declare let createTextShadowValue: (style: any) => void | string;
@@ -0,0 +1,3 @@
1
+ export declare let createReactDOMStyle: (style: any) => any;
2
+ export declare let createTransformValue: (transform: any) => any;
3
+ export declare let createTextShadowValue: (style: any) => void | string;
@@ -9,6 +9,7 @@ import type { EasingFunction } from '../../Easing';
9
9
  * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#fading-transition
10
10
  */
11
11
  export declare class CurvedTransition extends BaseAnimationBuilder implements ILayoutAnimationBuilder {
12
+ static presetName: string;
12
13
  easingXV: EasingFunction;
13
14
  easingYV: EasingFunction;
14
15
  easingWidthV: EasingFunction;
@@ -1,6 +1,7 @@
1
1
  import type { ILayoutAnimationBuilder, LayoutAnimationFunction } from '../animationBuilder/commonTypes';
2
2
  import { BaseAnimationBuilder } from '../animationBuilder';
3
3
  export declare class EntryExitTransition extends BaseAnimationBuilder implements ILayoutAnimationBuilder {
4
+ static presetName: string;
4
5
  enteringV: BaseAnimationBuilder | typeof BaseAnimationBuilder;
5
6
  exitingV: BaseAnimationBuilder | typeof BaseAnimationBuilder;
6
7
  static createInstance<T extends typeof BaseAnimationBuilder>(this: T): InstanceType<T>;
@@ -8,6 +8,7 @@ import { BaseAnimationBuilder } from '../animationBuilder';
8
8
  * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#fading-transition
9
9
  */
10
10
  export declare class FadingTransition extends BaseAnimationBuilder implements ILayoutAnimationBuilder {
11
+ static presetName: string;
11
12
  static createInstance<T extends typeof BaseAnimationBuilder>(this: T): InstanceType<T>;
12
13
  build: () => LayoutAnimationFunction;
13
14
  }
@@ -8,6 +8,7 @@ import { BaseAnimationBuilder } from '../animationBuilder';
8
8
  * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#jumping-transition
9
9
  */
10
10
  export declare class JumpingTransition extends BaseAnimationBuilder implements ILayoutAnimationBuilder {
11
+ static presetName: string;
11
12
  static createInstance<T extends typeof BaseAnimationBuilder>(this: T): InstanceType<T>;
12
13
  build: () => LayoutAnimationFunction;
13
14
  }
@@ -9,6 +9,7 @@ import type { ILayoutAnimationBuilder, LayoutAnimationFunction } from '../animat
9
9
  * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#linear-transition
10
10
  */
11
11
  export declare class LinearTransition extends ComplexAnimationBuilder implements ILayoutAnimationBuilder {
12
+ static presetName: string;
12
13
  static createInstance<T extends typeof BaseAnimationBuilder>(this: T): InstanceType<T>;
13
14
  build: () => LayoutAnimationFunction;
14
15
  }
@@ -8,6 +8,7 @@ import { BaseAnimationBuilder } from '../animationBuilder';
8
8
  * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions#sequenced-transition
9
9
  */
10
10
  export declare class SequencedTransition extends BaseAnimationBuilder implements ILayoutAnimationBuilder {
11
+ static presetName: string;
11
12
  reversed: boolean;
12
13
  static createInstance<T extends typeof BaseAnimationBuilder>(this: T): InstanceType<T>;
13
14
  static reverse(): SequencedTransition;
@@ -0,0 +1,10 @@
1
+ export declare const WebEasings: {
2
+ linear: number[];
3
+ ease: number[];
4
+ quad: number[];
5
+ cubic: number[];
6
+ sin: number[];
7
+ circle: number[];
8
+ exp: number[];
9
+ };
10
+ export type WebEasingsNames = keyof typeof WebEasings;
@@ -11,7 +11,7 @@ export interface ReanimatedWebTransformProperties {
11
11
  skew?: string;
12
12
  skewX?: string;
13
13
  }
14
- interface AnimationStyle {
14
+ export interface AnimationStyle {
15
15
  opacity?: number;
16
16
  transform?: ReanimatedWebTransformProperties[];
17
17
  }
@@ -28,4 +28,3 @@ export interface TransitionData {
28
28
  reversed?: boolean;
29
29
  }
30
30
  export declare function convertAnimationObjectToKeyframes(animationObject: AnimationData): string;
31
- export {};
@@ -11,4 +11,4 @@ export interface ScrollOffsets {
11
11
  }
12
12
  export declare const snapshots: WeakMap<HTMLElement, ReanimatedSnapshot>;
13
13
  export declare function makeElementVisible(element: HTMLElement, delay: number): void;
14
- export declare function setDummyPosition(dummy: HTMLElement, snapshot: ReanimatedSnapshot): void;
14
+ export declare function setElementPosition(element: HTMLElement, snapshot: ReanimatedSnapshot): void;
@@ -1,9 +1,10 @@
1
- import type { AnimationConfig, AnimationNames, CustomConfig } from './config';
1
+ import type { AnimationConfig, CustomConfig } from './config';
2
2
  import type { TransitionData } from './animationParser';
3
3
  import { LayoutAnimationType } from '../animationBuilder/commonTypes';
4
4
  export declare function getReducedMotionFromConfig(config: CustomConfig): boolean;
5
- export declare function getProcessedConfig(animationName: string, animationType: LayoutAnimationType, config: CustomConfig, initialAnimationName: AnimationNames): AnimationConfig;
5
+ export declare function getProcessedConfig(animationName: string, animationType: LayoutAnimationType, config: CustomConfig): AnimationConfig;
6
+ export declare function maybeModifyStyleForKeyframe(element: HTMLElement, config: CustomConfig): void;
6
7
  export declare function saveSnapshot(element: HTMLElement): void;
7
- export declare function setElementAnimation(element: HTMLElement, animationConfig: AnimationConfig): void;
8
+ export declare function setElementAnimation(element: HTMLElement, animationConfig: AnimationConfig, shouldSavePosition?: boolean): void;
8
9
  export declare function handleLayoutTransition(element: HTMLElement, animationConfig: AnimationConfig, transitionData: TransitionData): void;
9
10
  export declare function handleExitingAnimation(element: HTMLElement, animationConfig: AnimationConfig): void;
@@ -1,7 +1,8 @@
1
1
  import type { ReduceMotion } from '../../commonTypes';
2
2
  import type { LayoutAnimationType } from '../animationBuilder/commonTypes';
3
- import type { AnimationData } from './animationParser';
3
+ import type { AnimationData, AnimationStyle } from './animationParser';
4
4
  export type AnimationCallback = ((finished: boolean) => void) | null;
5
+ export type KeyframeDefinitions = Record<number, AnimationStyle>;
5
6
  export interface AnimationConfig {
6
7
  animationName: string;
7
8
  animationType: LayoutAnimationType;
@@ -19,11 +20,13 @@ export interface CustomConfig {
19
20
  reduceMotionV?: ReduceMotion;
20
21
  callbackV?: AnimationCallback;
21
22
  reversed?: boolean;
23
+ definitions?: KeyframeDefinitions;
22
24
  }
23
25
  export declare enum TransitionType {
24
26
  LINEAR = 0,
25
27
  SEQUENCED = 1,
26
- FADING = 2
28
+ FADING = 2,
29
+ JUMPING = 3
27
30
  }
28
31
  export declare const AnimationsData: Record<string, AnimationData>;
29
32
  export declare const Animations: {
@@ -340,15 +343,5 @@ export declare const Animations: {
340
343
  duration: number;
341
344
  };
342
345
  };
343
- export declare const WebEasings: {
344
- linear: number[];
345
- ease: number[];
346
- quad: number[];
347
- cubic: number[];
348
- sin: number[];
349
- circle: number[];
350
- exp: number[];
351
- };
352
346
  export type AnimationNames = keyof typeof Animations;
353
347
  export type LayoutTransitionsNames = keyof typeof AnimationsData;
354
- export type WebEasingsNames = keyof typeof WebEasings;
@@ -1,5 +1,7 @@
1
1
  import { TransitionType } from './config';
2
+ import type { KeyframeDefinitions } from './config';
2
3
  import type { TransitionData } from './animationParser';
4
+ export declare function createCustomKeyFrameAnimation(keyframeDefinitions: KeyframeDefinitions): string;
3
5
  /**
4
6
  * Creates transition of given type, appends it to stylesheet and returns keyframe name.
5
7
  *
@@ -4,6 +4,6 @@
4
4
  */
5
5
  export declare function configureWebLayoutAnimations(): void;
6
6
  export declare function insertWebAnimation(animationName: string, keyframe: string): void;
7
- export declare function scheduleAnimationCleanup(animationName: string, animationDuration: number): void;
7
+ export declare function scheduleAnimationCleanup(animationName: string, animationDuration: number, animationRemoveCallback: () => void): void;
8
8
  export declare function addHTMLMutationObserver(): void;
9
9
  export declare function areDOMRectsEqual(r1: DOMRect, r2: DOMRect): boolean;
@@ -0,0 +1,29 @@
1
+ import type { TransitionData } from '../animationParser';
2
+ export declare function JumpingTransition(name: string, transitionData: TransitionData): {
3
+ name: string;
4
+ style: {
5
+ 0: {
6
+ transform: {
7
+ translateX: string;
8
+ translateY: string;
9
+ scale: string;
10
+ }[];
11
+ easing: (t: number) => number;
12
+ };
13
+ 50: {
14
+ transform: {
15
+ translateX: string;
16
+ translateY: string;
17
+ scale: string;
18
+ }[];
19
+ };
20
+ 100: {
21
+ transform: {
22
+ translateX: string;
23
+ translateY: string;
24
+ scale: string;
25
+ }[];
26
+ };
27
+ };
28
+ duration: number;
29
+ };
@@ -3,4 +3,4 @@
3
3
  * with the version used to build the native part of the library in runtime.
4
4
  * Remember to keep this in sync with the version declared in `package.json`
5
5
  */
6
- export declare const jsVersion = "3.13.0-rc.2";
6
+ export declare const jsVersion = "3.13.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "3.13.0-rc.2",
3
+ "version": "3.13.0",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "test": "yarn format:js && yarn lint:js && yarn test:unit",
@@ -168,8 +168,9 @@
168
168
  }
169
169
  },
170
170
  "sideEffects": [
171
- "./lib/reanimated2/core",
172
- "./lib/index"
171
+ "./lib/module/reanimated2/layoutReanimation/animationsManager.js",
172
+ "./lib/module/reanimated2/core.js",
173
+ "./lib/module/index.js"
173
174
  ],
174
175
  "packageManager": "yarn@4.1.1"
175
176
  }
package/src/Colors.ts CHANGED
@@ -522,7 +522,9 @@ export const rgbaColor = (
522
522
  ): number | string => {
523
523
  'worklet';
524
524
  if (IS_WEB || !_WORKLET) {
525
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
525
+ // Replace tiny values like 1.234e-11 with 0:
526
+ const safeAlpha = alpha < 0.001 ? 0 : alpha;
527
+ return `rgba(${r}, ${g}, ${b}, ${safeAlpha})`;
526
528
  }
527
529
 
528
530
  const c =
@@ -701,9 +703,10 @@ export function convertToRGBA(color: unknown): ParsedColorArray {
701
703
 
702
704
  export function rgbaArrayToRGBAColor(RGBA: ParsedColorArray): string {
703
705
  'worklet';
706
+ const alpha = RGBA[3] < 0.001 ? 0 : RGBA[3];
704
707
  return `rgba(${Math.round(RGBA[0] * 255)}, ${Math.round(
705
708
  RGBA[1] * 255
706
- )}, ${Math.round(RGBA[2] * 255)}, ${RGBA[3]})`;
709
+ )}, ${Math.round(RGBA[2] * 255)}, ${alpha})`;
707
710
  }
708
711
 
709
712
  export function toLinearSpace(
@@ -5,26 +5,24 @@ import { processColorsInProps } from './Colors';
5
5
  import type { ShadowNodeWrapper, SharedValue, StyleProps } from './commonTypes';
6
6
  import type { AnimatedStyle } from './helperTypes';
7
7
  import type { Descriptor } from './hook/commonTypes';
8
+ import type { ReanimatedHTMLElement } from './js-reanimated';
8
9
  import { _updatePropsJS } from './js-reanimated';
9
10
  import { isFabric, isJest, shouldBeUseWeb } from './PlatformChecker';
10
- import type { ViewRefSet } from './ViewDescriptorsSet';
11
11
  import { runOnUIImmediately } from './threads';
12
12
 
13
13
  let updateProps: (
14
14
  viewDescriptor: SharedValue<Descriptor[]>,
15
15
  updates: StyleProps | AnimatedStyle<any>,
16
- maybeViewRef: ViewRefSet<any> | undefined,
17
16
  isAnimatedProps?: boolean
18
17
  ) => void;
19
18
 
20
19
  if (shouldBeUseWeb()) {
21
- updateProps = (_, updates, maybeViewRef, isAnimatedProps) => {
20
+ updateProps = (viewDescriptors, updates, isAnimatedProps) => {
22
21
  'worklet';
23
- if (maybeViewRef) {
24
- maybeViewRef.items.forEach((item, _index) => {
25
- _updatePropsJS(updates, item, isAnimatedProps);
26
- });
27
- }
22
+ viewDescriptors.value?.forEach((viewDescriptor) => {
23
+ const component = viewDescriptor.tag as ReanimatedHTMLElement;
24
+ _updatePropsJS(updates, component, isAnimatedProps);
25
+ });
28
26
  };
29
27
  } else {
30
28
  updateProps = (viewDescriptors, updates) => {
@@ -37,7 +35,6 @@ if (shouldBeUseWeb()) {
37
35
  export const updatePropsJestWrapper = (
38
36
  viewDescriptors: SharedValue<Descriptor[]>,
39
37
  updates: AnimatedStyle<any>,
40
- maybeViewRef: ViewRefSet<any> | undefined,
41
38
  animatedStyle: MutableRefObject<AnimatedStyle<any>>,
42
39
  adapters: ((updates: AnimatedStyle<any>) => void)[]
43
40
  ): void => {
@@ -49,7 +46,7 @@ export const updatePropsJestWrapper = (
49
46
  ...updates,
50
47
  };
51
48
 
52
- updateProps(viewDescriptors, updates, maybeViewRef);
49
+ updateProps(viewDescriptors, updates);
53
50
  };
54
51
 
55
52
  export default updateProps;
@@ -98,7 +95,7 @@ const createUpdatePropsManager = isFabric()
98
95
  ) {
99
96
  viewDescriptors.value.forEach((viewDescriptor) => {
100
97
  operations.push({
101
- tag: viewDescriptor.tag,
98
+ tag: viewDescriptor.tag as number,
102
99
  name: viewDescriptor.name || 'RCTView',
103
100
  updates,
104
101
  });