react-native-reanimated 3.4.0 → 3.4.2

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 (148) hide show
  1. package/lib/module/Animated.js +60 -1
  2. package/lib/module/Animated.js.map +1 -1
  3. package/lib/module/createAnimatedComponent.js.map +1 -1
  4. package/lib/module/reanimated2/Easing.js +8 -0
  5. package/lib/module/reanimated2/Easing.js.map +1 -1
  6. package/lib/module/reanimated2/UpdateProps.js +2 -2
  7. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  8. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
  9. package/lib/module/reanimated2/animation/decay.js.map +1 -1
  10. package/lib/module/reanimated2/animation/index.js +1 -1
  11. package/lib/module/reanimated2/animation/index.js.map +1 -1
  12. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  13. package/lib/module/reanimated2/animation/styleAnimation.js +2 -2
  14. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  15. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  16. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +6 -0
  17. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
  18. package/lib/module/reanimated2/animation/util.js +4 -19
  19. package/lib/module/reanimated2/animation/util.js.map +1 -1
  20. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  21. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  22. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  23. package/lib/module/reanimated2/core.js +16 -0
  24. package/lib/module/reanimated2/core.js.map +1 -1
  25. package/lib/module/reanimated2/fabricUtils.js +3 -1
  26. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  27. package/lib/module/reanimated2/globals.d.js.map +1 -1
  28. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  29. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  30. package/lib/module/reanimated2/hook/index.js.map +1 -1
  31. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -1
  32. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  33. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  34. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  35. package/lib/module/reanimated2/hook/useAnimatedStyle.js +1 -1
  36. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  37. package/lib/module/reanimated2/hook/utils.js +2 -27
  38. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  39. package/lib/module/reanimated2/index.js.map +1 -1
  40. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  41. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  42. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  43. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  44. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  45. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  46. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  47. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  48. package/lib/module/reanimated2/mappers.js +1 -1
  49. package/lib/module/reanimated2/mappers.js.map +1 -1
  50. package/lib/module/reanimated2/mock.js +26 -0
  51. package/lib/module/reanimated2/mock.js.map +1 -1
  52. package/lib/module/reanimated2/mutables.js +0 -1
  53. package/lib/module/reanimated2/mutables.js.map +1 -1
  54. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +3 -0
  55. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  56. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  57. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  58. package/lib/module/reanimated2/valueSetter.js +0 -1
  59. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  60. package/lib/module/setAndForwardRef.js.map +1 -1
  61. package/lib/typescript/Animated.d.ts +68 -3
  62. package/lib/typescript/createAnimatedComponent.d.ts +1 -26
  63. package/lib/typescript/reanimated2/Easing.d.ts +17 -9
  64. package/lib/typescript/reanimated2/UpdateProps.d.ts +5 -5
  65. package/lib/typescript/reanimated2/animation/commonTypes.d.ts +4 -3
  66. package/lib/typescript/reanimated2/animation/decay.d.ts +2 -4
  67. package/lib/typescript/reanimated2/animation/index.d.ts +3 -3
  68. package/lib/typescript/reanimated2/animation/springUtils.d.ts +1 -0
  69. package/lib/typescript/reanimated2/animation/styleAnimation.d.ts +2 -6
  70. package/lib/typescript/reanimated2/animation/timing.d.ts +4 -7
  71. package/lib/typescript/reanimated2/animation/transformationMatrix/matrixUtils.d.ts +1 -1
  72. package/lib/typescript/reanimated2/animation/util.d.ts +2 -4
  73. package/lib/typescript/reanimated2/commonTypes.d.ts +0 -4
  74. package/lib/typescript/reanimated2/component/FlatList.d.ts +2 -1
  75. package/lib/typescript/reanimated2/component/ScrollView.d.ts +1 -1
  76. package/lib/typescript/reanimated2/core.d.ts +12 -0
  77. package/lib/typescript/reanimated2/helperTypes.d.ts +11 -7
  78. package/lib/typescript/reanimated2/hook/commonTypes.d.ts +2 -2
  79. package/lib/typescript/reanimated2/hook/index.d.ts +1 -1
  80. package/lib/typescript/reanimated2/hook/useAnimatedGestureHandler.d.ts +2 -2
  81. package/lib/typescript/reanimated2/hook/useAnimatedRef.d.ts +4 -4
  82. package/lib/typescript/reanimated2/hook/useAnimatedStyle.d.ts +4 -5
  83. package/lib/typescript/reanimated2/hook/utils.d.ts +3 -11
  84. package/lib/typescript/reanimated2/index.d.ts +3 -1
  85. package/lib/typescript/reanimated2/interpolateColor.d.ts +2 -3
  86. package/lib/typescript/reanimated2/js-reanimated/commonTypes.d.ts +1 -43
  87. package/lib/typescript/reanimated2/js-reanimated/index.d.ts +3 -2
  88. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +4 -4
  89. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -11
  90. package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +3 -3
  91. package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +13 -13
  92. package/lib/typescript/reanimated2/layoutReanimation/index.d.ts +1 -0
  93. package/lib/typescript/reanimated2/mappers.d.ts +0 -12
  94. package/lib/typescript/reanimated2/mock.d.ts +1 -76
  95. package/lib/typescript/reanimated2/mutables.d.ts +0 -1
  96. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  97. package/lib/typescript/reanimated2/valueSetter.d.ts +0 -1
  98. package/lib/typescript/setAndForwardRef.d.ts +1 -1
  99. package/package.json +3 -1
  100. package/src/Animated.ts +80 -6
  101. package/src/createAnimatedComponent.tsx +2 -2
  102. package/src/reanimated2/Easing.ts +18 -8
  103. package/src/reanimated2/UpdateProps.ts +13 -17
  104. package/src/reanimated2/animation/commonTypes.ts +3 -3
  105. package/src/reanimated2/animation/decay.ts +3 -1
  106. package/src/reanimated2/animation/index.ts +3 -3
  107. package/src/reanimated2/animation/springUtils.ts +2 -0
  108. package/src/reanimated2/animation/styleAnimation.ts +5 -5
  109. package/src/reanimated2/animation/timing.ts +6 -4
  110. package/src/reanimated2/animation/transformationMatrix/matrixUtils.tsx +4 -1
  111. package/src/reanimated2/animation/util.ts +5 -29
  112. package/src/reanimated2/commonTypes.ts +0 -25
  113. package/src/reanimated2/component/FlatList.tsx +3 -1
  114. package/src/reanimated2/component/ScrollView.tsx +1 -1
  115. package/src/reanimated2/core.ts +16 -0
  116. package/src/reanimated2/fabricUtils.ts +1 -0
  117. package/src/reanimated2/globals.d.ts +3 -3
  118. package/src/reanimated2/helperTypes.ts +17 -7
  119. package/src/reanimated2/hook/commonTypes.ts +2 -3
  120. package/src/reanimated2/hook/index.ts +4 -1
  121. package/src/reanimated2/hook/useAnimatedGestureHandler.ts +2 -2
  122. package/src/reanimated2/hook/useAnimatedRef.ts +13 -10
  123. package/src/reanimated2/hook/useAnimatedStyle.ts +27 -26
  124. package/src/reanimated2/hook/utils.ts +5 -31
  125. package/src/reanimated2/index.ts +13 -1
  126. package/src/reanimated2/interpolateColor.ts +2 -2
  127. package/src/reanimated2/js-reanimated/commonTypes.ts +3 -3
  128. package/src/reanimated2/js-reanimated/index.ts +4 -3
  129. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -4
  130. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +5 -5
  131. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -3
  132. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -13
  133. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  134. package/src/reanimated2/mappers.ts +2 -2
  135. package/src/reanimated2/mock.ts +27 -0
  136. package/src/reanimated2/mutables.ts +0 -1
  137. package/src/reanimated2/platform-specific/checkCppVersion.ts +2 -0
  138. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  139. package/src/reanimated2/valueSetter.ts +0 -1
  140. package/src/setAndForwardRef.ts +1 -1
  141. package/lib/module/reanimated2/js-reanimated/Mapper.js +0 -69
  142. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +0 -1
  143. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +0 -109
  144. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +0 -1
  145. package/lib/typescript/reanimated2/js-reanimated/Mapper.d.ts +0 -14
  146. package/lib/typescript/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
  147. package/src/reanimated2/js-reanimated/Mapper.ts +0 -94
  148. package/src/reanimated2/js-reanimated/MapperRegistry.ts +0 -133
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","Error","ok","matchVersion","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["import { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n throw new 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 }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part (${jsVersion}) and native part of Reanimated (${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 }\n}\n\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5B,MAAM,IAAIC,KAAK,CACZ,8OAA6O,CAC/O;EACH;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACR,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACK,EAAE,EAAE;IACP,MAAM,IAAID,KAAK,CACZ,kDAAiDN,SAAU,oCAAmCE,UAAW,4HAA2HA,UAAW,kCAAiC,CAClR;EACH;AACF;AAEA,OAAO,SAASM,YAAYA,CAACC,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
1
+ {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","Error","ok","matchVersion","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["import { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n throw new 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 }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part (${jsVersion}) and native part of Reanimated (${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 }\n}\n\n// This is used only in test files, therefore it is reported by ts-prune (which is desired)\n// ts-prune-ignore-next\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5B,MAAM,IAAIC,KAAK,CACZ,8OAA6O,CAC/O;EACH;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACR,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACK,EAAE,EAAE;IACP,MAAM,IAAID,KAAK,CACZ,kDAAiDN,SAAU,oCAAmCE,UAAW,4HAA2HA,UAAW,kCAAiC,CAClR;EACH;AACF;;AAEA;AACA;AACA,OAAO,SAASM,YAAYA,CAACC,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
@@ -3,5 +3,5 @@
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 const jsVersion = '3.4.0';
6
+ export const jsVersion = '3.4.2';
7
7
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sources":["jsVersion.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 */\nexport const jsVersion = '3.4.0';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO"}
1
+ {"version":3,"names":["jsVersion"],"sources":["jsVersion.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 */\nexport const jsVersion = '3.4.2';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO"}
@@ -1,4 +1,3 @@
1
- export { stopMapper } from './mappers';
2
1
  export function valueSetter(sv, value) {
3
2
  'worklet';
4
3
 
@@ -1 +1 @@
1
- {"version":3,"names":["stopMapper","valueSetter","sv","value","previousAnimation","_animation","cancelled","onFrame","undefined","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","currentTimestamp","global","__frameTimestamp","performance","now","step","finished","requestAnimationFrame"],"sources":["valueSetter.ts"],"sourcesContent":["import type { AnimationObject, AnimatableValue } from './commonTypes';\nimport type { Descriptor } from './hook/commonTypes';\nexport { stopMapper } from './mappers';\n\nexport function valueSetter(sv: any, value: any): void {\n 'worklet';\n const previousAnimation = sv._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n sv._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (sv._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, sv.value, timestamp, previousAnimation);\n };\n const currentTimestamp = global.__frameTimestamp || performance.now();\n initializeAnimation(currentTimestamp);\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n sv._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n sv._animation = animation;\n\n step(currentTimestamp);\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (sv._value === value) {\n return;\n }\n sv._value = value as Descriptor | AnimatableValue;\n }\n}\n"],"mappings":"AAEA,SAASA,UAAU,QAAQ,WAAW;AAEtC,OAAO,SAASC,WAAWA,CAACC,EAAO,EAAEC,KAAU,EAAQ;EACrD,SAAS;;EACT,MAAMC,iBAAiB,GAAGF,EAAE,CAACG,UAAU;EACvC,IAAID,iBAAiB,EAAE;IACrBA,iBAAiB,CAACE,SAAS,GAAG,IAAI;IAClCJ,EAAE,CAACG,UAAU,GAAG,IAAI;EACtB;EACA,IACE,OAAOF,KAAK,KAAK,UAAU,IAC1BA,KAAK,KAAK,IAAI,IACb,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAAqBI,OAAO,KAAKC,SAAU,EACnD;IACA,MAAMC,SAA0B,GAC9B,OAAON,KAAK,KAAK,UAAU,GACtBA,KAAK,EAA4B,GACjCA,KAAyB;IAChC;IACA;IACA;IACA;IACA,IAAID,EAAE,CAACQ,MAAM,KAAKD,SAAS,CAACE,OAAO,IAAI,CAACF,SAAS,CAACG,aAAa,EAAE;MAC/DH,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,IAAI,CAAC;MAC9C;IACF;IACA;IACA,MAAMC,mBAAmB,GAAIC,SAAiB,IAAK;MACjDN,SAAS,CAACO,OAAO,CAACP,SAAS,EAAEP,EAAE,CAACC,KAAK,EAAEY,SAAS,EAAEX,iBAAiB,CAAC;IACtE,CAAC;IACD,MAAMa,gBAAgB,GAAGC,MAAM,CAACC,gBAAgB,IAAIC,WAAW,CAACC,GAAG,EAAE;IACrEP,mBAAmB,CAACG,gBAAgB,CAAC;IACrC,MAAMK,IAAI,GAAIP,SAAiB,IAAK;MAClC,IAAIN,SAAS,CAACH,SAAS,EAAE;QACvBG,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,KAAK,CAAC,eAAe;QAC9D;MACF;MACA,MAAMU,QAAQ,GAAGd,SAAS,CAACF,OAAO,CAACE,SAAS,EAAEM,SAAS,CAAC;MACxDN,SAAS,CAACc,QAAQ,GAAG,IAAI;MACzBd,SAAS,CAACM,SAAS,GAAGA,SAAS;MAC/Bb,EAAE,CAACQ,MAAM,GAAGD,SAAS,CAACE,OAAO;MAC7B,IAAIY,QAAQ,EAAE;QACZd,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,IAAI,CAAC,eAAe;MAC/D,CAAC,MAAM;QACLW,qBAAqB,CAACF,IAAI,CAAC;MAC7B;IACF,CAAC;IAEDpB,EAAE,CAACG,UAAU,GAAGI,SAAS;IAEzBa,IAAI,CAACL,gBAAgB,CAAC;EACxB,CAAC,MAAM;IACL;IACA;IACA,IAAIf,EAAE,CAACQ,MAAM,KAAKP,KAAK,EAAE;MACvB;IACF;IACAD,EAAE,CAACQ,MAAM,GAAGP,KAAqC;EACnD;AACF"}
1
+ {"version":3,"names":["valueSetter","sv","value","previousAnimation","_animation","cancelled","onFrame","undefined","animation","_value","current","isHigherOrder","callback","initializeAnimation","timestamp","onStart","currentTimestamp","global","__frameTimestamp","performance","now","step","finished","requestAnimationFrame"],"sources":["valueSetter.ts"],"sourcesContent":["import type { AnimationObject, AnimatableValue } from './commonTypes';\nimport type { Descriptor } from './hook/commonTypes';\n\nexport function valueSetter(sv: any, value: any): void {\n 'worklet';\n const previousAnimation = sv._animation;\n if (previousAnimation) {\n previousAnimation.cancelled = true;\n sv._animation = null;\n }\n if (\n typeof value === 'function' ||\n (value !== null &&\n typeof value === 'object' &&\n (value as AnimationObject).onFrame !== undefined)\n ) {\n const animation: AnimationObject =\n typeof value === 'function'\n ? (value as () => AnimationObject)()\n : (value as AnimationObject);\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)\n // built in animations that are not higher order(withTiming, withSpring) hold target value in .current\n if (sv._value === animation.current && !animation.isHigherOrder) {\n animation.callback && animation.callback(true);\n return;\n }\n // animated set\n const initializeAnimation = (timestamp: number) => {\n animation.onStart(animation, sv.value, timestamp, previousAnimation);\n };\n const currentTimestamp = global.__frameTimestamp || performance.now();\n initializeAnimation(currentTimestamp);\n const step = (timestamp: number) => {\n if (animation.cancelled) {\n animation.callback && animation.callback(false /* finished */);\n return;\n }\n const finished = animation.onFrame(animation, timestamp);\n animation.finished = true;\n animation.timestamp = timestamp;\n sv._value = animation.current;\n if (finished) {\n animation.callback && animation.callback(true /* finished */);\n } else {\n requestAnimationFrame(step);\n }\n };\n\n sv._animation = animation;\n\n step(currentTimestamp);\n } else {\n // prevent setting again to the same value\n // and triggering the mappers that treat this value as an input\n if (sv._value === value) {\n return;\n }\n sv._value = value as Descriptor | AnimatableValue;\n }\n}\n"],"mappings":"AAGA,OAAO,SAASA,WAAWA,CAACC,EAAO,EAAEC,KAAU,EAAQ;EACrD,SAAS;;EACT,MAAMC,iBAAiB,GAAGF,EAAE,CAACG,UAAU;EACvC,IAAID,iBAAiB,EAAE;IACrBA,iBAAiB,CAACE,SAAS,GAAG,IAAI;IAClCJ,EAAE,CAACG,UAAU,GAAG,IAAI;EACtB;EACA,IACE,OAAOF,KAAK,KAAK,UAAU,IAC1BA,KAAK,KAAK,IAAI,IACb,OAAOA,KAAK,KAAK,QAAQ,IACxBA,KAAK,CAAqBI,OAAO,KAAKC,SAAU,EACnD;IACA,MAAMC,SAA0B,GAC9B,OAAON,KAAK,KAAK,UAAU,GACtBA,KAAK,EAA4B,GACjCA,KAAyB;IAChC;IACA;IACA;IACA;IACA,IAAID,EAAE,CAACQ,MAAM,KAAKD,SAAS,CAACE,OAAO,IAAI,CAACF,SAAS,CAACG,aAAa,EAAE;MAC/DH,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,IAAI,CAAC;MAC9C;IACF;IACA;IACA,MAAMC,mBAAmB,GAAIC,SAAiB,IAAK;MACjDN,SAAS,CAACO,OAAO,CAACP,SAAS,EAAEP,EAAE,CAACC,KAAK,EAAEY,SAAS,EAAEX,iBAAiB,CAAC;IACtE,CAAC;IACD,MAAMa,gBAAgB,GAAGC,MAAM,CAACC,gBAAgB,IAAIC,WAAW,CAACC,GAAG,EAAE;IACrEP,mBAAmB,CAACG,gBAAgB,CAAC;IACrC,MAAMK,IAAI,GAAIP,SAAiB,IAAK;MAClC,IAAIN,SAAS,CAACH,SAAS,EAAE;QACvBG,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,KAAK,CAAC,eAAe;QAC9D;MACF;MACA,MAAMU,QAAQ,GAAGd,SAAS,CAACF,OAAO,CAACE,SAAS,EAAEM,SAAS,CAAC;MACxDN,SAAS,CAACc,QAAQ,GAAG,IAAI;MACzBd,SAAS,CAACM,SAAS,GAAGA,SAAS;MAC/Bb,EAAE,CAACQ,MAAM,GAAGD,SAAS,CAACE,OAAO;MAC7B,IAAIY,QAAQ,EAAE;QACZd,SAAS,CAACI,QAAQ,IAAIJ,SAAS,CAACI,QAAQ,CAAC,IAAI,CAAC,eAAe;MAC/D,CAAC,MAAM;QACLW,qBAAqB,CAACF,IAAI,CAAC;MAC7B;IACF,CAAC;IAEDpB,EAAE,CAACG,UAAU,GAAGI,SAAS;IAEzBa,IAAI,CAACL,gBAAgB,CAAC;EACxB,CAAC,MAAM;IACL;IACA;IACA,IAAIf,EAAE,CAACQ,MAAM,KAAKP,KAAK,EAAE;MACvB;IACF;IACAD,EAAE,CAACQ,MAAM,GAAGP,KAAqC;EACnD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"names":["setAndForwardRef","_ref","getForwardedRef","setLocalRef","forwardRef","ref","forwardedRef","current"],"sources":["setAndForwardRef.ts"],"sourcesContent":["/**\n * imported from react-native\n */\n\nimport type { MutableRefObject } from 'react';\n\n/**\n * This is a helper function for when a component needs to be able to forward a ref\n * to a child component, but still needs to have access to that component as part of\n * its implementation.\n *\n * Its main use case is in wrappers for native components.\n *\n * Usage:\n *\n * class MyView extends React.Component {\n * _nativeRef = null;\n *\n * _setNativeRef = setAndForwardRef({\n * getForwardedRef: () => this.props.forwardedRef,\n * setLocalRef: ref => {\n * this._nativeRef = ref;\n * },\n * });\n *\n * render() {\n * return <View ref={this._setNativeRef} />;\n * }\n * }\n *\n * const MyViewWithRef = React.forwardRef((props, ref) => (\n * <MyView {...props} forwardedRef={ref} />\n * ));\n *\n * module.exports = MyViewWithRef;\n */\n\nexport type ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);\n\nfunction setAndForwardRef<T>({\n getForwardedRef,\n setLocalRef,\n}: {\n getForwardedRef: ForwardedRef<T>;\n setLocalRef: (ref: T) => void;\n}): (ref: T) => void {\n return function forwardRef(ref: T) {\n const forwardedRef = getForwardedRef();\n\n setLocalRef(ref);\n\n // Forward to user ref prop (if one has been specified)\n if (typeof forwardedRef === 'function') {\n // Handle function-based refs. String-based refs are handled as functions.\n forwardedRef(ref);\n } else if (typeof forwardedRef === 'object' && forwardedRef != null) {\n // Handle createRef-based refs\n forwardedRef.current = ref;\n }\n };\n}\n\nexport default setAndForwardRef;\n"],"mappings":"AAAA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,gBAAgBA,CAAAC,IAAA,EAMJ;EAAA,IANQ;IAC3BC,eAAe;IACfC;EAIF,CAAC,GAAAF,IAAA;EACC,OAAO,SAASG,UAAUA,CAACC,GAAM,EAAE;IACjC,MAAMC,YAAY,GAAGJ,eAAe,EAAE;IAEtCC,WAAW,CAACE,GAAG,CAAC;;IAEhB;IACA,IAAI,OAAOC,YAAY,KAAK,UAAU,EAAE;MACtC;MACAA,YAAY,CAACD,GAAG,CAAC;IACnB,CAAC,MAAM,IAAI,OAAOC,YAAY,KAAK,QAAQ,IAAIA,YAAY,IAAI,IAAI,EAAE;MACnE;MACAA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC5B;EACF,CAAC;AACH;AAEA,eAAeL,gBAAgB"}
1
+ {"version":3,"names":["setAndForwardRef","_ref","getForwardedRef","setLocalRef","forwardRef","ref","forwardedRef","current"],"sources":["setAndForwardRef.ts"],"sourcesContent":["/**\n * imported from react-native\n */\n\nimport type { MutableRefObject } from 'react';\n\n/**\n * This is a helper function for when a component needs to be able to forward a ref\n * to a child component, but still needs to have access to that component as part of\n * its implementation.\n *\n * Its main use case is in wrappers for native components.\n *\n * Usage:\n *\n * class MyView extends React.Component {\n * _nativeRef = null;\n *\n * _setNativeRef = setAndForwardRef({\n * getForwardedRef: () => this.props.forwardedRef,\n * setLocalRef: ref => {\n * this._nativeRef = ref;\n * },\n * });\n *\n * render() {\n * return <View ref={this._setNativeRef} />;\n * }\n * }\n *\n * const MyViewWithRef = React.forwardRef((props, ref) => (\n * <MyView {...props} forwardedRef={ref} />\n * ));\n *\n * module.exports = MyViewWithRef;\n */\n\ntype ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);\n\nfunction setAndForwardRef<T>({\n getForwardedRef,\n setLocalRef,\n}: {\n getForwardedRef: ForwardedRef<T>;\n setLocalRef: (ref: T) => void;\n}): (ref: T) => void {\n return function forwardRef(ref: T) {\n const forwardedRef = getForwardedRef();\n\n setLocalRef(ref);\n\n // Forward to user ref prop (if one has been specified)\n if (typeof forwardedRef === 'function') {\n // Handle function-based refs. String-based refs are handled as functions.\n forwardedRef(ref);\n } else if (typeof forwardedRef === 'object' && forwardedRef != null) {\n // Handle createRef-based refs\n forwardedRef.current = ref;\n }\n };\n}\n\nexport default setAndForwardRef;\n"],"mappings":"AAAA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,gBAAgBA,CAAAC,IAAA,EAMJ;EAAA,IANQ;IAC3BC,eAAe;IACfC;EAIF,CAAC,GAAAF,IAAA;EACC,OAAO,SAASG,UAAUA,CAACC,GAAM,EAAE;IACjC,MAAMC,YAAY,GAAGJ,eAAe,EAAE;IAEtCC,WAAW,CAACE,GAAG,CAAC;;IAEhB;IACA,IAAI,OAAOC,YAAY,KAAK,UAAU,EAAE;MACtC;MACAA,YAAY,CAACD,GAAG,CAAC;IACnB,CAAC,MAAM,IAAI,OAAOC,YAAY,KAAK,QAAQ,IAAIA,YAAY,IAAI,IAAI,EAAE;MACnE;MACAA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC5B;EACF,CAAC;AACH;AAEA,eAAeL,gBAAgB"}
@@ -1,9 +1,74 @@
1
+ import type { Extrapolate as _Extrapolate } from './reanimated2/interpolateColor';
2
+ import type { SharedValue as _SharedValue } from './reanimated2/commonTypes';
3
+ import type { DerivedValue as _DerivedValue } from './reanimated2/hook/useDerivedValue';
4
+ import type { TransformStyleTypes as _TransformStyleTypes, Adaptable as _Adaptable, AdaptTransforms as _AdaptTransforms, AnimatedTransform as _AnimatedTransform, AnimateStyle as _AnimateStyle, StylesOrDefault as _StylesOrDefault, AnimateProps as _AnimateProps } from './reanimated2/helperTypes';
5
+ import type { EasingFunction as _EasingFunction } from './reanimated2/Easing';
6
+ import { addWhitelistedNativeProps as _addWhitelistedNativeProps, addWhitelistedUIProps as _addWhitelistedUIProps } from './ConfigHelper';
7
+ import type { AnimatedScrollViewProps as _AnimatedScrollViewProps } from './reanimated2/component/ScrollView';
8
+ import type { FlatListPropsWithLayout as _FlatListPropsWithLayout } from './reanimated2/component/FlatList';
1
9
  export { default as createAnimatedComponent } from './createAnimatedComponent';
2
- export { addWhitelistedNativeProps, addWhitelistedUIProps, } from './ConfigHelper';
3
10
  export { AnimatedText as Text } from './reanimated2/component/Text';
4
11
  export { AnimatedView as View } from './reanimated2/component/View';
5
12
  export { AnimatedScrollView as ScrollView } from './reanimated2/component/ScrollView';
6
13
  export { AnimatedImage as Image } from './reanimated2/component/Image';
7
14
  export { ReanimatedFlatList as FlatList } from './reanimated2/component/FlatList';
8
- export type { SharedValue } from './reanimated2/commonTypes';
9
- export type { AnimateStyle } from './reanimated2/helperTypes';
15
+ /**
16
+ * @deprecated Please import `Extrapolate` directly from `react-native-reanimated` instead of `Animated` namespace.
17
+ */
18
+ export type Extrapolate = typeof _Extrapolate;
19
+ /**
20
+ * @deprecated Please import `SharedValue` directly from `react-native-reanimated` instead of `Animated` namespace.
21
+ */
22
+ export type SharedValue<T> = _SharedValue<T>;
23
+ /**
24
+ * @deprecated Please import `DerivedValue` directly from `react-native-reanimated` instead of `Animated` namespace.
25
+ */
26
+ export type DerivedValue<T> = _DerivedValue<T>;
27
+ /**
28
+ * @deprecated Please import `Adaptable` directly from `react-native-reanimated` instead of `Animated` namespace.
29
+ */
30
+ export type Adaptable<T> = _Adaptable<T>;
31
+ /**
32
+ * @deprecated Please import `TransformStyleTypes` directly from `react-native-reanimated` instead of `Animated` namespace.
33
+ * */
34
+ export type TransformStyleTypes = _TransformStyleTypes;
35
+ /**
36
+ * @deprecated Please import `AdaptTransforms` directly from `react-native-reanimated` instead of `Animated` namespace.
37
+ * */
38
+ export type AdaptTransforms<T> = _AdaptTransforms<T>;
39
+ /**
40
+ * @deprecated Please import `AnimatedTransform` directly from `react-native-reanimated` instead of `Animated` namespace.
41
+ */
42
+ export type AnimatedTransform = _AnimatedTransform;
43
+ /**
44
+ * @deprecated Please import `AnimateStyle` directly from `react-native-reanimated` instead of `Animated` namespace.
45
+ * */
46
+ export type AnimateStyle<S> = _AnimateStyle<S>;
47
+ /**
48
+ * @deprecated Please import `StylesOrDefault` directly from `react-native-reanimated` instead of `Animated` namespace.
49
+ * */
50
+ export type StylesOrDefault<S> = _StylesOrDefault<S>;
51
+ /**
52
+ * @deprecated Please import `AnimateProps` directly from `react-native-reanimated` instead of `Animated` namespace.
53
+ * */
54
+ export type AnimateProps<P extends object> = _AnimateProps<P>;
55
+ /**
56
+ * @deprecated Please import `EasingFunction` directly from `react-native-reanimated` instead of `Animated` namespace.
57
+ * */
58
+ export type EasingFunction = _EasingFunction;
59
+ /**
60
+ * @deprecated Please import `addWhitelistedNativeProps` directly from `react-native-reanimated` instead of `Animated` namespace.
61
+ * */
62
+ export declare const addWhitelistedNativeProps: typeof _addWhitelistedNativeProps;
63
+ /**
64
+ * @deprecated Please import `addWhitelistedUIProps` directly from `react-native-reanimated` instead of `Animated` namespace.
65
+ * */
66
+ export declare const addWhitelistedUIProps: typeof _addWhitelistedUIProps;
67
+ /**
68
+ * @deprecated Please import `AnimatedScrollViewProps` directly from `react-native-reanimated` instead of `Animated` namespace.
69
+ * */
70
+ export type AnimatedScrollViewProps = _AnimatedScrollViewProps;
71
+ /**
72
+ * @deprecated Please import `FlatListPropsWithLayout` directly from `react-native-reanimated` instead of `Animated` namespace.
73
+ * */
74
+ export type FlatListPropsWithLayout<T> = _FlatListPropsWithLayout<T>;
@@ -1,27 +1,6 @@
1
- import type { Component, ComponentClass, FunctionComponent, Ref } from 'react';
1
+ import type { Component, ComponentClass, FunctionComponent } from 'react';
2
2
  import './reanimated2/layoutReanimation/animationsManager';
3
- import type { BaseAnimationBuilder, EntryExitAnimationFunction, ILayoutAnimationBuilder } from './reanimated2/layoutReanimation';
4
- import { SharedTransition } from './reanimated2/layoutReanimation';
5
- import type { SharedValue, StyleProps } from './reanimated2/commonTypes';
6
- import type { ViewDescriptorsSet, ViewRefSet } from './reanimated2/ViewDescriptorsSet';
7
3
  import type { AnimateProps } from './reanimated2/helperTypes';
8
- type NestedArray<T> = T | NestedArray<T>[];
9
- interface AnimatedProps extends Record<string, unknown> {
10
- viewDescriptors?: ViewDescriptorsSet;
11
- viewsRef?: ViewRefSet<unknown>;
12
- initial?: SharedValue<StyleProps>;
13
- }
14
- export type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
15
- forwardedRef?: Ref<Component>;
16
- style?: NestedArray<StyleProps>;
17
- animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;
18
- animatedStyle?: StyleProps;
19
- layout?: BaseAnimationBuilder | ILayoutAnimationBuilder | typeof BaseAnimationBuilder;
20
- entering?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe;
21
- exiting?: BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | Keyframe;
22
- sharedTransitionTag?: string;
23
- sharedTransitionStyle?: SharedTransition;
24
- };
25
4
  type Options<P> = {
26
5
  setNativeProps: (ref: ComponentRef, props: P) => void;
27
6
  };
@@ -30,10 +9,6 @@ interface ComponentRef extends Component {
30
9
  getScrollableNode?: () => ComponentRef;
31
10
  getAnimatableRef?: () => ComponentRef;
32
11
  }
33
- export interface InitialComponentProps extends Record<string, unknown> {
34
- ref?: Ref<Component>;
35
- collapsable?: boolean;
36
- }
37
12
  export default function createAnimatedComponent<P extends object>(component: FunctionComponent<P>, options?: Options<P>): FunctionComponent<AnimateProps<P>>;
38
13
  export default function createAnimatedComponent<P extends object>(component: ComponentClass<P>, options?: Options<P>): ComponentClass<AnimateProps<P>>;
39
14
  export {};
@@ -43,10 +43,18 @@
43
43
  * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
44
44
  * - [`out`](docs/easing.html#out) runs an easing function backwards
45
45
  */
46
- export type EasingFn = (t: number) => number;
47
- export type EasingFactoryFn = {
48
- factory: () => EasingFn;
46
+ export type EasingFunction = (t: number) => number;
47
+ /**
48
+ * @deprecated Please use `EasingFunction` type instead.
49
+ */
50
+ export type EasingFn = EasingFunction;
51
+ export type EasingFunctionFactory = {
52
+ factory: () => EasingFunction;
49
53
  };
54
+ /**
55
+ * @deprecated Please use `EasingFunctionFactory` type instead.
56
+ */
57
+ export type EasingFactoryFn = EasingFunctionFactory;
50
58
  /**
51
59
  * A linear function, `f(t) = t`. Position correlates to elapsed time one to
52
60
  * one.
@@ -81,7 +89,7 @@ declare function cubic(t: number): number;
81
89
  * n = 4: http://easings.net/#easeInQuart
82
90
  * n = 5: http://easings.net/#easeInQuint
83
91
  */
84
- declare function poly(n: number): EasingFn;
92
+ declare function poly(n: number): EasingFunction;
85
93
  /**
86
94
  * A sinusoidal function.
87
95
  *
@@ -110,7 +118,7 @@ declare function exp(t: number): number;
110
118
  *
111
119
  * http://easings.net/#easeInElastic
112
120
  */
113
- declare function elastic(bounciness?: number): EasingFn;
121
+ declare function elastic(bounciness?: number): EasingFunction;
114
122
  /**
115
123
  * Use with `Animated.parallel()` to create a simple effect where the object
116
124
  * animates back slightly as the animation starts.
@@ -140,24 +148,24 @@ declare function bezierFn(x1: number, y1: number, x2: number, y2: number): (x: n
140
148
  /**
141
149
  * Runs an easing function forwards.
142
150
  */
143
- declare function in_(easing: EasingFn): EasingFn;
151
+ declare function in_(easing: EasingFunction): EasingFunction;
144
152
  /**
145
153
  * Runs an easing function backwards.
146
154
  */
147
- declare function out(easing: EasingFn): EasingFn;
155
+ declare function out(easing: EasingFunction): EasingFunction;
148
156
  /**
149
157
  * Makes any easing function symmetrical. The easing function will run
150
158
  * forwards for half of the duration, then backwards for the rest of the
151
159
  * duration.
152
160
  */
153
- declare function inOut(easing: EasingFn): EasingFn;
161
+ declare function inOut(easing: EasingFunction): EasingFunction;
154
162
  /**
155
163
  * The `steps` easing function jumps between discrete values at regular intervals,
156
164
  * creating a stepped animation effect. The `n` parameter determines the number of
157
165
  * steps in the animation, and the `roundToNextStep` parameter determines whether the animation
158
166
  * should start at the beginning or end of each step.
159
167
  */
160
- declare function steps(n?: number, roundToNextStep?: boolean): EasingFn;
168
+ declare function steps(n?: number, roundToNextStep?: boolean): EasingFunction;
161
169
  export declare const Easing: {
162
170
  linear: typeof linear;
163
171
  ease: typeof ease;
@@ -1,13 +1,13 @@
1
1
  import type { MutableRefObject } from 'react';
2
- import type { AnimatedStyle, SharedValue, StyleProps } from './commonTypes';
2
+ import type { SharedValue, StyleProps } from './commonTypes';
3
+ import type { AnimatedStyle } from './helperTypes';
3
4
  import type { Descriptor } from './hook/commonTypes';
4
5
  import type { ViewRefSet } from './ViewDescriptorsSet';
5
- export declare const colorProps: string[];
6
6
  export declare const ColorProperties: string[];
7
- export declare let updateProps: (viewDescriptor: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle, maybeViewRef: ViewRefSet<any> | undefined) => void;
8
- export declare const updatePropsJestWrapper: (viewDescriptors: SharedValue<Descriptor[]>, updates: AnimatedStyle, maybeViewRef: ViewRefSet<any> | undefined, animatedStyle: MutableRefObject<AnimatedStyle>, adapters: ((updates: AnimatedStyle) => void)[]) => void;
7
+ declare let updateProps: (viewDescriptor: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle<any>, maybeViewRef: ViewRefSet<any> | undefined) => void;
8
+ export declare const updatePropsJestWrapper: (viewDescriptors: SharedValue<Descriptor[]>, updates: AnimatedStyle<any>, maybeViewRef: ViewRefSet<any> | undefined, animatedStyle: MutableRefObject<AnimatedStyle<any>>, adapters: ((updates: AnimatedStyle<any>) => void)[]) => void;
9
9
  export default updateProps;
10
10
  export interface UpdatePropsManager {
11
- update(viewDescriptors: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle): void;
11
+ update(viewDescriptors: SharedValue<Descriptor[]>, updates: StyleProps | AnimatedStyle<any>): void;
12
12
  flush(): void;
13
13
  }
@@ -1,4 +1,5 @@
1
- import type { AnimatedStyle, StyleProps, AnimatableValue, AnimationObject, Animation, Timestamp, AnimationCallback } from '../commonTypes';
1
+ import type { StyleProps, AnimatableValue, AnimationObject, Animation, Timestamp, AnimationCallback } from '../commonTypes';
2
+ import type { AnimatedStyle } from '../helperTypes';
2
3
  export interface HigherOrderAnimation {
3
4
  isHigherOrder?: boolean;
4
5
  }
@@ -20,8 +21,8 @@ export interface SequenceAnimation extends Animation<SequenceAnimation>, HigherO
20
21
  }
21
22
  export interface StyleLayoutAnimation extends HigherOrderAnimation {
22
23
  current: StyleProps;
23
- styleAnimations: AnimatedStyle;
24
+ styleAnimations: AnimatedStyle<any>;
24
25
  onFrame: (animation: StyleLayoutAnimation, timestamp: Timestamp) => boolean;
25
- onStart: (nextAnimation: StyleLayoutAnimation, current: AnimatedStyle, timestamp: Timestamp, previousAnimation: StyleLayoutAnimation) => void;
26
+ onStart: (nextAnimation: StyleLayoutAnimation, current: AnimatedStyle<any>, timestamp: Timestamp, previousAnimation: StyleLayoutAnimation) => void;
26
27
  callback?: AnimationCallback;
27
28
  }
@@ -1,10 +1,11 @@
1
- import type { Animation, AnimationCallback, AnimationObject, AnimatableValue, Timestamp } from '../commonTypes';
1
+ import type { Animation, AnimationCallback, AnimatableValue, Timestamp } from '../commonTypes';
2
2
  interface DecayConfig {
3
3
  deceleration?: number;
4
4
  velocityFactor?: number;
5
5
  clamp?: number[];
6
6
  velocity?: number;
7
7
  }
8
+ export type WithDecayConfig = DecayConfig;
8
9
  export interface DecayAnimation extends Animation<DecayAnimation> {
9
10
  lastTimestamp: Timestamp;
10
11
  startTimestamp: Timestamp;
@@ -12,9 +13,6 @@ export interface DecayAnimation extends Animation<DecayAnimation> {
12
13
  velocity: number;
13
14
  current: AnimatableValue;
14
15
  }
15
- export interface InnerDecayAnimation extends Omit<DecayAnimation, 'current'>, AnimationObject {
16
- current: number;
17
- }
18
16
  type withDecayType = (userConfig: DecayConfig, callback?: AnimationCallback) => number;
19
17
  export declare const withDecay: withDecayType;
20
18
  export {};
@@ -1,10 +1,10 @@
1
1
  export type { HigherOrderAnimation, NextAnimation, DelayAnimation, RepeatAnimation, SequenceAnimation, StyleLayoutAnimation, } from './commonTypes';
2
2
  export { cancelAnimation, defineAnimation, initialUpdaterRun } from './util';
3
3
  export { withTiming } from './timing';
4
- export type { TimingAnimation } from './timing';
4
+ export type { TimingAnimation, WithTimingConfig } from './timing';
5
5
  export { withSpring } from './spring';
6
- export type { SpringAnimation } from './springUtils';
7
- export { withDecay } from './decay';
6
+ export type { SpringAnimation, WithSpringConfig } from './springUtils';
7
+ export { withDecay, WithDecayConfig } from './decay';
8
8
  export type { DecayAnimation } from './decay';
9
9
  export { withDelay } from './delay';
10
10
  export { withRepeat } from './repeat';
@@ -16,6 +16,7 @@ export type SpringConfig = {
16
16
  duration?: number;
17
17
  dampingRatio?: number;
18
18
  });
19
+ export type WithSpringConfig = SpringConfig;
19
20
  export interface SpringConfigInner {
20
21
  useDuration: boolean;
21
22
  configIsInvalid: boolean;
@@ -1,7 +1,3 @@
1
- import type { AnimatableValue, AnimatedStyle, NestedObject, NestedObjectValues } from '../commonTypes';
1
+ import type { AnimatedStyle } from '../helperTypes';
2
2
  import type { StyleLayoutAnimation } from './commonTypes';
3
- export declare function resolvePath<T>(obj: NestedObject<T>, path: AnimatableValue[] | AnimatableValue): NestedObjectValues<T> | undefined;
4
- type Path = Array<string | number> | string | number;
5
- export declare function setPath<T>(obj: NestedObject<T>, path: Path, value: NestedObjectValues<T>): void;
6
- export declare function withStyleAnimation(styleAnimations: AnimatedStyle): StyleLayoutAnimation;
7
- export {};
3
+ export declare function withStyleAnimation(styleAnimations: AnimatedStyle<any>): StyleLayoutAnimation;
@@ -1,22 +1,19 @@
1
- import type { EasingFn, EasingFactoryFn } from '../Easing';
1
+ import type { EasingFunction, EasingFunctionFactory } from '../Easing';
2
2
  import type { Animation, AnimationCallback, Timestamp, AnimatableValue } from '../commonTypes';
3
3
  interface TimingConfig {
4
4
  duration?: number;
5
- easing?: EasingFn | EasingFactoryFn;
5
+ easing?: EasingFunction | EasingFunctionFactory;
6
6
  }
7
+ export type WithTimingConfig = TimingConfig;
7
8
  export interface TimingAnimation extends Animation<TimingAnimation> {
8
9
  type: string;
9
- easing: EasingFn;
10
+ easing: EasingFunction;
10
11
  startValue: AnimatableValue;
11
12
  startTime: Timestamp;
12
13
  progress: number;
13
14
  toValue: AnimatableValue;
14
15
  current: AnimatableValue;
15
16
  }
16
- export interface InnerTimingAnimation extends Omit<TimingAnimation, 'toValue' | 'current'> {
17
- toValue: number;
18
- current: number;
19
- }
20
17
  type withTimingType = <T extends AnimatableValue>(toValue: T, userConfig?: TimingConfig, callback?: AnimationCallback) => T;
21
18
  export declare const withTiming: withTimingType;
22
19
  export {};
@@ -4,7 +4,7 @@ type FixedLengthArray<T, L extends number, PassedObject = [T, ...Array<T>]> = Pa
4
4
  };
5
5
  export type AffineMatrix = FixedLengthArray<FixedLengthArray<number, 4>, 4>;
6
6
  export type AffineMatrixFlat = FixedLengthArray<number, 16>;
7
- export type TransformMatrixDecomposition = Record<'translationMatrix' | 'scaleMatrix' | 'rotationMatrix' | 'skewMatrix', AffineMatrix>;
7
+ type TransformMatrixDecomposition = Record<'translationMatrix' | 'scaleMatrix' | 'rotationMatrix' | 'skewMatrix', AffineMatrix>;
8
8
  type Axis = 'x' | 'y' | 'z';
9
9
  interface TansformMatrixDecompositionWithAngles extends TransformMatrixDecomposition {
10
10
  rx: number;
@@ -1,10 +1,8 @@
1
- import type { NextAnimation, StyleLayoutAnimation } from './commonTypes';
2
- import type { AnimatedStyle, SharedValue, AnimatableValue, Animation, AnimationObject } from '../commonTypes';
3
- export type UserUpdater = () => AnimatedStyle;
1
+ import type { StyleLayoutAnimation } from './commonTypes';
2
+ import type { SharedValue, AnimatableValue, AnimationObject } from '../commonTypes';
4
3
  export declare function initialUpdaterRun<T>(updater: () => T): T;
5
4
  type AnimationToDecoration<T extends AnimationObject | StyleLayoutAnimation, U extends AnimationObject | StyleLayoutAnimation> = T extends StyleLayoutAnimation ? Record<string, unknown> : U | (() => U) | AnimatableValue;
6
5
  export declare function defineAnimation<T extends AnimationObject | StyleLayoutAnimation, // type that's supposed to be returned
7
6
  U extends AnimationObject | StyleLayoutAnimation = T>(starting: AnimationToDecoration<T, U>, factory: () => T): T;
8
7
  export declare function cancelAnimation<T>(sharedValue: SharedValue<T>): void;
9
- export declare function withStartValue(startValue: AnimatableValue, animation: NextAnimation<AnimationObject>): Animation<AnimationObject>;
10
8
  export {};
@@ -5,10 +5,6 @@ export interface StyleProps extends ViewStyle, TextStyle {
5
5
  originY?: number;
6
6
  [key: string]: any;
7
7
  }
8
- export interface AnimatedStyle extends Record<string, AnimationObject> {
9
- [key: string]: any;
10
- transform?: Array<Record<'matrix', number[] | AnimationObject> | Partial<Record<'perspective' | 'scale' | 'scaleX' | 'scaleY' | 'translateX' | 'translateY', number | AnimationObject>> | Partial<Record<'rotate' | 'rotateX' | 'rotateY' | 'rotateZ' | 'skewX' | 'skewY', string | AnimationObject>> | Record<string, AnimationObject>>;
11
- }
12
8
  export interface SharedValue<T> {
13
9
  value: T;
14
10
  addListener: (listenerID: number, listener: (value: T) => void) => void;
@@ -6,10 +6,11 @@ import type { AnimateProps } from '../helperTypes';
6
6
  interface ReanimatedFlatListPropsWithLayout<T> extends FlatListProps<T> {
7
7
  itemLayoutAnimation?: ILayoutAnimationBuilder;
8
8
  }
9
+ export type FlatListPropsWithLayout<T> = ReanimatedFlatListPropsWithLayout<T>;
9
10
  declare class ReanimatedFlatListClass<T> extends Component<AnimateProps<ReanimatedFlatListPropsWithLayout<T>>> {
10
11
  getNode(): FlatList;
11
12
  }
12
- export interface ReanimatedFlatListProps<ItemT> extends FlatListProps<ItemT> {
13
+ interface ReanimatedFlatListProps<ItemT> extends FlatListProps<ItemT> {
13
14
  itemLayoutAnimation?: ILayoutAnimationBuilder;
14
15
  }
15
16
  export declare const ReanimatedFlatList: React.ForwardRefExoticComponent<ReanimatedFlatListProps<any> & React.RefAttributes<FlatList<any>>>;
@@ -3,7 +3,7 @@ import type { ScrollViewProps } from 'react-native';
3
3
  import { ScrollView } from 'react-native';
4
4
  import type { SharedValue } from '../commonTypes';
5
5
  import type { AnimateProps } from '../helperTypes';
6
- interface AnimatedScrollViewProps extends ScrollViewProps {
6
+ export interface AnimatedScrollViewProps extends ScrollViewProps {
7
7
  scrollViewOffset?: SharedValue<number>;
8
8
  }
9
9
  declare class AnimatedScrollViewClass extends Component<AnimateProps<AnimatedScrollViewProps>> {
@@ -7,6 +7,18 @@ export { runOnJS, runOnUI } from './threads';
7
7
  export { makeShareable } from './shareables';
8
8
  export { makeMutable, makeRemote } from './mutables';
9
9
  export type ReanimatedConsole = Pick<Console, 'debug' | 'log' | 'warn' | 'info' | 'error'>;
10
+ /**
11
+ * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2 or 1
12
+ */
13
+ export declare const isReanimated3: () => boolean;
14
+ /**
15
+ * @deprecated This function was superseded by other checks.
16
+ * We keep it here for backward compatibility reasons.
17
+ * If you need to check if you are using Reanimated 3 or Reanimated 2
18
+ * please use `isReanimated3` function instead.
19
+ * @returns `true` in Reanimated 3, doesn't exist in Reanimated 2
20
+ */
21
+ export declare const isConfigured: () => boolean;
10
22
  export declare function getViewProp<T>(viewTag: string, propName: string): Promise<T>;
11
23
  export declare function getSensorContainer(): SensorContainer;
12
24
  export declare function registerEventHandler<T>(eventHash: string, eventHandler: (event: T) => void): number;
@@ -3,29 +3,33 @@ import type { AnimatableValue, BaseAnimationBuilder, EntryExitAnimationFunction,
3
3
  import type { ReanimatedKeyframe } from './layoutReanimation/animationBuilder/Keyframe';
4
4
  import type { SharedTransition } from './layoutReanimation/sharedTransitions';
5
5
  import type { DependencyList } from './hook/commonTypes';
6
- type Adaptable<T> = T | ReadonlyArray<T | ReadonlyArray<T>> | SharedValue<T>;
7
- type AdaptTransforms<T> = {
6
+ export type Adaptable<T> = T | ReadonlyArray<T | ReadonlyArray<T>> | SharedValue<T>;
7
+ export type AdaptTransforms<T> = {
8
8
  [P in keyof T]: Adaptable<T[P]>;
9
9
  };
10
10
  type TransformsStyle = Pick<RNTransformsStyle, 'transform'>;
11
- type TransformStyleTypes = TransformsStyle['transform'] extends readonly (infer T)[] | undefined ? T : never;
12
- type AnimatedTransform = AdaptTransforms<TransformStyleTypes>[];
11
+ export type TransformStyleTypes = TransformsStyle['transform'] extends readonly (infer T)[] | string | undefined ? T : never;
12
+ export type AnimatedTransform = AdaptTransforms<TransformStyleTypes>[];
13
+ /**
14
+ * @deprecated Please use `AnimatedStyle` type instead.
15
+ */
13
16
  export type AnimateStyle<S> = {
14
17
  [K in keyof S]: K extends 'transform' ? AnimatedTransform : S[K] extends ReadonlyArray<any> ? ReadonlyArray<AnimateStyle<S[K][0]>> : S[K] extends object ? AnimateStyle<S[K]> : S[K] extends ColorValue | undefined ? S[K] | number : S[K] | SharedValue<AnimatableValue>;
15
18
  };
19
+ export type AnimatedStyle<S> = AnimateStyle<S>;
16
20
  type MaybeSharedValue<S> = {
17
21
  [K in keyof S]: S[K] | Readonly<SharedValue<Extract<S[K], AnimatableValue>>>;
18
22
  };
19
- type StylesOrDefault<T> = 'style' extends keyof T ? MaybeSharedValue<T['style']> : Record<string, unknown>;
23
+ export type StylesOrDefault<T> = 'style' extends keyof T ? MaybeSharedValue<T['style']> : Record<string, unknown>;
20
24
  type EntryOrExitLayoutType = BaseAnimationBuilder | typeof BaseAnimationBuilder | EntryExitAnimationFunction | ReanimatedKeyframe;
21
25
  type PickStyleProps<T> = Pick<T, {
22
26
  [Key in keyof T]-?: Key extends `${string}Style` ? Key : never;
23
27
  }[keyof T]>;
24
28
  type StyleAnimatedProps<P extends object> = {
25
- [K in keyof PickStyleProps<P>]: StyleProp<AnimateStyle<P[K] | MaybeSharedValue<P[K]>>>;
29
+ [K in keyof PickStyleProps<P>]: StyleProp<AnimatedStyle<P[K] | MaybeSharedValue<P[K]>>>;
26
30
  };
27
31
  type JustStyleAnimatedProp<P extends object> = {
28
- style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
32
+ style?: StyleProp<AnimatedStyle<StylesOrDefault<P>>>;
29
33
  };
30
34
  type NonStyleAnimatedProps<P extends object> = {
31
35
  [K in keyof Omit<P, keyof PickStyleProps<P> | 'style'>]: P[K] | SharedValue<P[K]>;
@@ -1,3 +1,4 @@
1
+ import type { Component } from 'react';
1
2
  import type { Context, ShadowNodeWrapper } from '../commonTypes';
2
3
  export type DependencyList = Array<unknown> | undefined;
3
4
  export interface ContextWithDependencies<TContext extends Context> {
@@ -9,8 +10,7 @@ export interface Descriptor {
9
10
  name: string;
10
11
  shadowNodeWrapper: ShadowNodeWrapper;
11
12
  }
12
- export interface RefObjectFunction<T> {
13
+ export interface AnimatedRef<T extends Component> {
13
14
  current: T | null;
14
15
  (component?: T): number | ShadowNodeWrapper | HTMLElement;
15
16
  }
16
- export type AnimatedRef<T> = RefObjectFunction<T>;
@@ -3,7 +3,7 @@ export { useAnimatedProps, useEvent, useHandler, useWorkletCallback, } from './H
3
3
  export { useSharedValue } from './useSharedValue';
4
4
  export { useReducedMotion } from './useReducedMotion';
5
5
  export { useAnimatedStyle } from './useAnimatedStyle';
6
- export type { AnimatedStyleResult } from './useAnimatedStyle';
6
+ export type { AnimatedStyleResult, AnimatedStyleProp, } from './useAnimatedStyle';
7
7
  export { useAnimatedGestureHandler } from './useAnimatedGestureHandler';
8
8
  export type { GestureHandlerEvent, GestureHandlers, } from './useAnimatedGestureHandler';
9
9
  export { useAnimatedReaction } from './useAnimatedReaction';
@@ -12,7 +12,7 @@ export interface GestureHandlers<T, TContext extends Context> {
12
12
  onCancel?: Handler<T, TContext>;
13
13
  onFinish?: Handler<T, TContext>;
14
14
  }
15
- export declare const EventType: {
15
+ declare const EventType: {
16
16
  UNDETERMINED: number;
17
17
  FAILED: number;
18
18
  BEGAN: number;
@@ -20,7 +20,7 @@ export declare const EventType: {
20
20
  ACTIVE: number;
21
21
  END: number;
22
22
  };
23
- export interface GestureHandlerNativeEvent {
23
+ interface GestureHandlerNativeEvent {
24
24
  handlerTag: number;
25
25
  numberOfPointers: number;
26
26
  state: (typeof EventType)[keyof typeof EventType];
@@ -1,8 +1,8 @@
1
1
  import type { Component } from 'react';
2
2
  import type { AnimatedRef } from './commonTypes';
3
- interface ComponentRef extends Component {
4
- getNativeScrollRef?: () => ComponentRef;
5
- getScrollableNode?: () => ComponentRef;
3
+ interface MaybeScrollableComponent extends Component {
4
+ getNativeScrollRef?: any;
5
+ getScrollableNode?: any;
6
6
  }
7
- export declare function useAnimatedRef<T extends ComponentRef>(): AnimatedRef<T>;
7
+ export declare function useAnimatedRef<T extends MaybeScrollableComponent>(): AnimatedRef<T>;
8
8
  export {};
@@ -1,16 +1,15 @@
1
1
  import type { MutableRefObject } from 'react';
2
2
  import type { DependencyList } from './commonTypes';
3
3
  import type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';
4
- import type { AnimatedStyle } from '../commonTypes';
5
4
  import type { ImageStyle, RegisteredStyle, TextStyle, ViewStyle } from 'react-native';
6
- import type { AnimateStyle } from '../helperTypes';
5
+ import type { AnimatedStyle } from '../helperTypes';
7
6
  export interface AnimatedStyleResult {
8
7
  viewDescriptors: ViewDescriptorsSet;
9
- initial: AnimatedStyle;
8
+ initial: AnimatedStyle<any>;
10
9
  viewsRef: ViewRefSet<any>;
11
- animatedStyle?: MutableRefObject<AnimatedStyle>;
10
+ animatedStyle?: MutableRefObject<AnimatedStyle<any>>;
12
11
  }
13
- type AnimatedStyleProp<T> = AnimateStyle<T> | RegisteredStyle<AnimateStyle<T>>;
12
+ export type AnimatedStyleProp<T> = AnimatedStyle<T> | RegisteredStyle<AnimatedStyle<T>>;
14
13
  type useAnimatedStyleType = <T extends AnimatedStyleProp<ViewStyle | ImageStyle | TextStyle>>(updater: () => T, deps?: DependencyList | null) => T;
15
14
  export declare const useAnimatedStyle: useAnimatedStyleType;
16
15
  export {};