react-native-reanimated 2.3.0-beta.3 → 2.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +9 -0
  2. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +13 -0
  3. package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
  4. package/Common/cpp/Tools/RuntimeDecorator.cpp +21 -2
  5. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +3 -0
  6. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +5 -0
  7. package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
  8. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +2 -0
  9. package/Common/cpp/headers/Tools/RuntimeDecorator.h +8 -7
  10. package/RNReanimated.podspec +20 -3
  11. package/android/build.gradle +29 -5
  12. package/android/react-native-reanimated-63-hermes.aar +0 -0
  13. package/android/react-native-reanimated-63-jsc.aar +0 -0
  14. package/android/react-native-reanimated-64-hermes.aar +0 -0
  15. package/android/react-native-reanimated-64-jsc.aar +0 -0
  16. package/android/react-native-reanimated-65-hermes.aar +0 -0
  17. package/android/react-native-reanimated-65-jsc.aar +0 -0
  18. package/android/react-native-reanimated-66-hermes.aar +0 -0
  19. package/android/react-native-reanimated-66-jsc.aar +0 -0
  20. package/android/react-native-reanimated-67-hermes.aar +0 -0
  21. package/android/react-native-reanimated-67-jsc.aar +0 -0
  22. package/ios/LayoutReanimation/REAUIManager.mm +56 -12
  23. package/ios/REAEventDispatcher.m +1 -1
  24. package/ios/REAModule.h +0 -2
  25. package/ios/REAModule.m +0 -3
  26. package/ios/REANodesManager.m +1 -0
  27. package/ios/RNGestureHandlerStateManager.h +5 -0
  28. package/ios/native/NativeMethods.h +5 -0
  29. package/ios/native/NativeMethods.mm +8 -1
  30. package/ios/native/NativeProxy.h +1 -0
  31. package/ios/native/NativeProxy.mm +10 -2
  32. package/ios/native/REAInitializer.mm +8 -3
  33. package/lib/Animated.js +9 -1
  34. package/lib/createAnimatedComponent.js +53 -37
  35. package/lib/index.js +9 -1
  36. package/lib/reanimated2/NativeMethods.js +7 -0
  37. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +3 -0
  38. package/lib/reanimated2/UpdateProps.js +1 -1
  39. package/lib/reanimated2/ViewDescriptorsSet.js +4 -2
  40. package/lib/reanimated2/animation/styleAnimation.js +5 -0
  41. package/lib/reanimated2/core.js +18 -0
  42. package/lib/reanimated2/globals.d.ts +2 -0
  43. package/lib/reanimated2/js-reanimated/JSReanimated.js +3 -0
  44. package/lib/reanimated2/js-reanimated/Mapper.js +4 -1
  45. package/lib/reanimated2/js-reanimated/index.js +3 -0
  46. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +14 -5
  47. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +1 -1
  48. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +2 -2
  49. package/mock.js +1 -1
  50. package/package.json +2 -2
  51. package/plugin.js +9 -3
  52. package/react-native-reanimated.d.ts +1 -0
  53. package/src/Animated.js +9 -1
  54. package/src/createAnimatedComponent.tsx +76 -41
  55. package/src/reanimated2/NativeMethods.ts +13 -1
  56. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +4 -0
  57. package/src/reanimated2/UpdateProps.ts +1 -1
  58. package/src/reanimated2/ViewDescriptorsSet.ts +6 -2
  59. package/src/reanimated2/animation/styleAnimation.ts +9 -0
  60. package/src/reanimated2/core.ts +29 -0
  61. package/src/reanimated2/globals.d.ts +2 -0
  62. package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -0
  63. package/src/reanimated2/js-reanimated/Mapper.ts +3 -1
  64. package/src/reanimated2/js-reanimated/index.ts +5 -0
  65. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +18 -5
  66. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +1 -1
  67. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +5 -5
package/lib/Animated.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Image, ScrollView, Text, View } from 'react-native';
1
+ import { Image, ScrollView, Text, View, LogBox } from 'react-native';
2
2
  import createAnimatedComponent from './createAnimatedComponent';
3
3
  import {
4
4
  addWhitelistedNativeProps,
@@ -23,3 +23,11 @@ const Animated = {
23
23
  export * from './reanimated2';
24
24
  export * from './reanimated1';
25
25
  export default Animated;
26
+
27
+ // I think we can ignore this message as long as Gesture Handler doesn't
28
+ // try to load the Reanimated module. I figured it should be here instead of
29
+ // RNGH because this prevents the message from being displayed for all
30
+ // versions of RNGH.
31
+ LogBox.ignoreLogs([
32
+ 'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
33
+ ]);
@@ -15,9 +15,9 @@ import './reanimated2/layoutReanimation/LayoutAnimationRepository';
15
15
  import invariant from 'invariant';
16
16
  import { adaptViewConfig } from './ConfigHelper';
17
17
  import { RNRenderer } from './reanimated2/platform-specific/RNRenderer';
18
- import { makeMutable, runOnUI } from './reanimated2/core';
18
+ import { makeMutable, runOnUI, enableLayoutAnimations, } from './reanimated2/core';
19
19
  import { DefaultEntering, DefaultExiting, DefaultLayout, } from './reanimated2/layoutReanimation/defaultAnimations/Default';
20
- import { isJest, isChromeDebugger } from './reanimated2/PlatformChecker';
20
+ import { isJest, isChromeDebugger, shouldBeUseWeb, } from './reanimated2/PlatformChecker';
21
21
  import { initialUpdaterRun } from './reanimated2/animation';
22
22
  const NODE_MAPPING = new Map();
23
23
  function listener(data) {
@@ -58,6 +58,14 @@ function flattenArray(array) {
58
58
  _flattenArray(array);
59
59
  return resultArr;
60
60
  }
61
+ function onlyAnimatedStyles(styles) {
62
+ return styles.filter((style) => style === null || style === void 0 ? void 0 : style.viewDescriptors);
63
+ }
64
+ function isSameAnimatedStyle(style1, style2) {
65
+ // We cannot use equality check to compare useAnimatedStyle outputs directly.
66
+ // Instead, we can compare its viewsRefs.
67
+ return style1.viewsRef === style2.viewsRef;
68
+ }
61
69
  const has = (key, x) => {
62
70
  if (typeof x === 'function' || typeof x === 'object') {
63
71
  if (x === null || x === undefined) {
@@ -111,6 +119,9 @@ export default function createAnimatedComponent(Component, options) {
111
119
  const tag = findNodeHandle(ref);
112
120
  if ((this.props.layout || this.props.entering || this.props.exiting) &&
113
121
  tag != null) {
122
+ if (!shouldBeUseWeb()) {
123
+ enableLayoutAnimations(true, false);
124
+ }
114
125
  let layout = this.props.layout ? this.props.layout : DefaultLayout;
115
126
  let entering = this.props.entering
116
127
  ? this.props.entering
@@ -213,9 +224,7 @@ export default function createAnimatedComponent(Component, options) {
213
224
  }
214
225
  else if (this._viewTag !== -1 && this._styles !== null) {
215
226
  for (const style of this._styles) {
216
- if (style === null || style === void 0 ? void 0 : style.viewDescriptors) {
217
- style.viewDescriptors.remove(this._viewTag);
218
- }
227
+ style.viewDescriptors.remove(this._viewTag);
219
228
  }
220
229
  if ((_a = this.props.animatedProps) === null || _a === void 0 ? void 0 : _a.viewDescriptors) {
221
230
  this.props.animatedProps.viewDescriptors.remove(this._viewTag);
@@ -309,8 +318,13 @@ export default function createAnimatedComponent(Component, options) {
309
318
  }
310
319
  _attachAnimatedStyles() {
311
320
  var _a, _b, _c;
312
- const styles = flattenArray((_a = this.props.style) !== null && _a !== void 0 ? _a : []);
321
+ const styles = this.props.style
322
+ ? onlyAnimatedStyles(flattenArray(this.props.style))
323
+ : [];
324
+ const prevStyles = this._styles;
313
325
  this._styles = styles;
326
+ const prevAnimatedProps = this._animatedProps;
327
+ this._animatedProps = this.props.animatedProps;
314
328
  let viewTag;
315
329
  let viewName;
316
330
  if (Platform.OS === 'web') {
@@ -329,30 +343,47 @@ export default function createAnimatedComponent(Component, options) {
329
343
  * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).
330
344
  * The name we're looking for is in the field named uiViewClassName.
331
345
  */
332
- viewName = (_b = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig) === null || _b === void 0 ? void 0 : _b.uiViewClassName;
346
+ viewName = (_a = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig) === null || _a === void 0 ? void 0 : _a.uiViewClassName;
333
347
  // update UI props whitelist for this view
334
- if (hostInstance &&
335
- this._hasReanimated2Props(styles) &&
336
- hostInstance.viewConfig) {
348
+ const hasReanimated2Props = ((_b = this.props.animatedProps) === null || _b === void 0 ? void 0 : _b.viewDescriptors) || styles.length;
349
+ if (hasReanimated2Props && (hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig)) {
337
350
  adaptViewConfig(hostInstance.viewConfig);
338
351
  }
339
352
  }
340
353
  this._viewTag = viewTag;
341
- styles.forEach((style) => {
342
- if (style === null || style === void 0 ? void 0 : style.viewDescriptors) {
343
- style.viewDescriptors.add({ tag: viewTag, name: viewName });
344
- if (isJest()) {
345
- /**
346
- * We need to connect Jest's TestObject instance whose contains just props object
347
- * with the updateProps() function where we update the properties of the component.
348
- * We can't update props object directly because TestObject contains a copy of props - look at render function:
349
- * const props = this._filterNonAnimatedProps(this.props);
350
- */
351
- this.animatedStyle.value = Object.assign(Object.assign({}, this.animatedStyle.value), style.initial.value);
352
- style.animatedStyle.current = this.animatedStyle;
354
+ // remove old styles
355
+ if (prevStyles) {
356
+ // in most of the cases, views have only a single animated style and it remains unchanged
357
+ const hasOneSameStyle = styles.length === 1 &&
358
+ prevStyles.length === 1 &&
359
+ isSameAnimatedStyle(styles[0], prevStyles[0]);
360
+ if (!hasOneSameStyle) {
361
+ // otherwise, remove each style that is not present in new styles
362
+ for (const prevStyle of prevStyles) {
363
+ const isPresent = styles.some((style) => isSameAnimatedStyle(style, prevStyle));
364
+ if (!isPresent) {
365
+ prevStyle.viewDescriptors.remove(viewTag);
366
+ }
353
367
  }
354
368
  }
369
+ }
370
+ styles.forEach((style) => {
371
+ style.viewDescriptors.add({ tag: viewTag, name: viewName });
372
+ if (isJest()) {
373
+ /**
374
+ * We need to connect Jest's TestObject instance whose contains just props object
375
+ * with the updateProps() function where we update the properties of the component.
376
+ * We can't update props object directly because TestObject contains a copy of props - look at render function:
377
+ * const props = this._filterNonAnimatedProps(this.props);
378
+ */
379
+ this.animatedStyle.value = Object.assign(Object.assign({}, this.animatedStyle.value), style.initial.value);
380
+ style.animatedStyle.current = this.animatedStyle;
381
+ }
355
382
  });
383
+ // detach old animatedProps
384
+ if (prevAnimatedProps && prevAnimatedProps !== this.props.animatedProps) {
385
+ prevAnimatedProps.viewDescriptors.remove(viewTag);
386
+ }
356
387
  // attach animatedProps property
357
388
  if ((_c = this.props.animatedProps) === null || _c === void 0 ? void 0 : _c.viewDescriptors) {
358
389
  this.props.animatedProps.viewDescriptors.add({
@@ -363,21 +394,6 @@ export default function createAnimatedComponent(Component, options) {
363
394
  });
364
395
  }
365
396
  }
366
- _hasReanimated2Props(flattenStyles) {
367
- var _a;
368
- if ((_a = this.props.animatedProps) === null || _a === void 0 ? void 0 : _a.viewDescriptors) {
369
- return true;
370
- }
371
- if (this.props.style) {
372
- for (const style of flattenStyles) {
373
- // eslint-disable-next-line no-prototype-builtins
374
- if (style === null || style === void 0 ? void 0 : style.hasOwnProperty('viewDescriptors')) {
375
- return true;
376
- }
377
- }
378
- }
379
- return false;
380
- }
381
397
  _detachPropUpdater() {
382
398
  const viewTag = findNodeHandle(this);
383
399
  NODE_MAPPING.delete(viewTag);
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Image, ScrollView, Text, View } from 'react-native';
1
+ import { Image, ScrollView, Text, View, LogBox } from 'react-native';
2
2
  import createAnimatedComponent from './createAnimatedComponent';
3
3
  import {
4
4
  addWhitelistedNativeProps,
@@ -23,3 +23,11 @@ const Animated = {
23
23
  export * from './reanimated2';
24
24
  export * from './reanimated1';
25
25
  export default Animated;
26
+
27
+ // I think we can ignore this message as long as Gesture Handler doesn't
28
+ // try to load the Reanimated module. I figured it should be here instead of
29
+ // RNGH because this prevents the message from being displayed for all
30
+ // versions of RNGH.
31
+ LogBox.ignoreLogs([
32
+ 'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
33
+ ]);
@@ -23,3 +23,10 @@ export function scrollTo(animatedRef, x, y, animated) {
23
23
  const viewTag = animatedRef();
24
24
  _scrollTo(viewTag, x, y, animated);
25
25
  }
26
+ export function setGestureState(handlerTag, newState) {
27
+ 'worklet';
28
+ if (!_WORKLET && !isChromeDebugger()) {
29
+ console.warn('[Reanimated] You can not use setGestureState in non-worklet function.');
30
+ }
31
+ _setGestureState(handlerTag, newState);
32
+ }
@@ -31,4 +31,7 @@ export class NativeReanimated {
31
31
  getViewProp(viewTag, propName, callback) {
32
32
  return InnerNativeModule.getViewProp(viewTag, propName, callback);
33
33
  }
34
+ enableLayoutAnimations(flag) {
35
+ InnerNativeModule.enableLayoutAnimations(flag);
36
+ }
34
37
  }
@@ -19,7 +19,7 @@ export const colorProps = [
19
19
  'textShadowColor',
20
20
  'overlayColor',
21
21
  ];
22
- const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
22
+ export const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
23
23
  let updatePropsByPlatform;
24
24
  if (shouldBeUseWeb()) {
25
25
  updatePropsByPlatform = (_, updates, maybeViewRef) => {
@@ -1,5 +1,7 @@
1
1
  import { useRef } from 'react';
2
2
  import { makeMutable } from './core';
3
+ import { Platform } from 'react-native';
4
+ const scheduleUpdates = Platform.OS === 'web' ? requestAnimationFrame : setImmediate;
3
5
  export function makeViewDescriptorsSet() {
4
6
  const ref = useRef(null);
5
7
  if (ref.current === null) {
@@ -18,7 +20,7 @@ export function makeViewDescriptorsSet() {
18
20
  data.items.push(item);
19
21
  if (!data.waitForInsertSync) {
20
22
  data.waitForInsertSync = true;
21
- setImmediate(() => {
23
+ scheduleUpdates(() => {
22
24
  data.sharableViewDescriptors.value = data.items;
23
25
  data.waitForInsertSync = false;
24
26
  });
@@ -28,7 +30,7 @@ export function makeViewDescriptorsSet() {
28
30
  data.batchToRemove.add(viewTag);
29
31
  if (!data.waitForRemoveSync) {
30
32
  data.waitForRemoveSync = true;
31
- setImmediate(() => {
33
+ scheduleUpdates(() => {
32
34
  const items = [];
33
35
  for (const item of data.items) {
34
36
  if (data.batchToRemove.has(item.tag)) {
@@ -1,5 +1,7 @@
1
1
  import { defineAnimation } from './util';
2
2
  import { withTiming } from './timing';
3
+ import { ColorProperties } from '../UpdateProps';
4
+ import { processColor } from '../Colors';
3
5
  // resolves path to value for nested objects
4
6
  // if path cannot be resolved returns undefined
5
7
  export function resolvePath(obj, path) {
@@ -79,6 +81,9 @@ export function withStyleAnimation(styleAnimations) {
79
81
  else {
80
82
  stillGoing = true;
81
83
  }
84
+ if (ColorProperties.includes(currentEntry.path[0])) {
85
+ currentStyleAnimation.current = processColor(currentStyleAnimation.current);
86
+ }
82
87
  setPath(animation.current, currentEntry.path, currentStyleAnimation.current);
83
88
  }
84
89
  }
@@ -277,3 +277,21 @@ if (!NativeReanimatedModule.useOnlyV1) {
277
277
  _setGlobalConsole(console);
278
278
  })();
279
279
  }
280
+ let featuresConfig = {
281
+ enableLayoutAnimations: false,
282
+ setByUser: false,
283
+ };
284
+ export function enableLayoutAnimations(flag, isCallByUser = true) {
285
+ if (isCallByUser) {
286
+ featuresConfig = {
287
+ enableLayoutAnimations: flag,
288
+ setByUser: true,
289
+ };
290
+ NativeReanimatedModule.enableLayoutAnimations(flag);
291
+ }
292
+ else if (!featuresConfig.setByUser &&
293
+ featuresConfig.enableLayoutAnimations !== flag) {
294
+ featuresConfig.enableLayoutAnimations = flag;
295
+ NativeReanimatedModule.enableLayoutAnimations(flag);
296
+ }
297
+ }
@@ -13,6 +13,7 @@ declare global {
13
13
  tag: number,
14
14
  flag: { value: boolean; _value: boolean }
15
15
  ) => void;
16
+ const _setGestureState: (handlerTag: number, newState: number) => void;
16
17
  const _updateProps: (
17
18
  tag: number,
18
19
  name: string,
@@ -30,6 +31,7 @@ declare global {
30
31
  __reanimatedWorkletInit: (worklet: WorkletFunction) => void;
31
32
  _setGlobalConsole: (console?: ReanimatedConsole) => void;
32
33
  _log: (s: string) => void;
34
+ _setGestureState: () => void;
33
35
  _WORKLET: boolean;
34
36
  __reanimatedModuleProxy: NativeReanimated;
35
37
  _frameTimestamp: number | null;
@@ -72,4 +72,7 @@ export default class JSReanimated extends NativeReanimated {
72
72
  unregisterEventHandler(_) {
73
73
  // noop
74
74
  }
75
+ enableLayoutAnimations() {
76
+ console.warn('[Reanimated] enableLayoutAnimations is not available for WEB yet');
77
+ }
75
78
  }
@@ -21,7 +21,10 @@ export default class Mapper {
21
21
  extractMutablesFromArray(array) {
22
22
  const res = [];
23
23
  function extractMutables(value) {
24
- if (value instanceof MutableValue) {
24
+ if (value == null) {
25
+ // return;
26
+ }
27
+ else if (value instanceof MutableValue) {
25
28
  res.push(value);
26
29
  }
27
30
  else if (Array.isArray(value)) {
@@ -20,6 +20,9 @@ if (shouldBeUseWeb()) {
20
20
  global._scrollTo = () => {
21
21
  console.warn("[Reanimated] You can't use 'scrollTo' method with Chrome Debugger or with web version");
22
22
  };
23
+ global._setGestureState = () => {
24
+ console.warn("[Reanimated] You can't use 'setGestureState' method with Chrome Debugger or with web version");
25
+ };
23
26
  }
24
27
  export const _updatePropsJS = (updates, viewRef) => {
25
28
  if (viewRef._component) {
@@ -1,6 +1,8 @@
1
1
  /* global _stopObservingProgress, _startObservingProgress */
2
2
  import { runOnUI } from '../core';
3
3
  import { withStyleAnimation } from '../animation/styleAnimation';
4
+ import { ColorProperties } from '../UpdateProps';
5
+ import { processColor } from '../Colors';
4
6
  runOnUI(() => {
5
7
  'worklet';
6
8
  const configs = {};
@@ -34,12 +36,19 @@ runOnUI(() => {
34
36
  for (const key in layoutAnimation) {
35
37
  currentAnimation[key] = layoutAnimation[key];
36
38
  }
37
- enteringAnimationForTag[tag] = null;
38
39
  }
39
40
  const sv = configs[tag].sv;
40
41
  _stopObservingProgress(tag, false);
41
42
  _startObservingProgress(tag, sv);
42
- sv._value = Object.assign({}, sv._value, style.initialValues);
43
+ const backupColor = {};
44
+ for (const key in style.initialValues) {
45
+ if (ColorProperties.includes(key)) {
46
+ const value = style.initialValues[key];
47
+ backupColor[key] = value;
48
+ style.initialValues[key] = processColor(value);
49
+ }
50
+ }
51
+ sv.value = Object.assign({}, sv._value, style.initialValues);
43
52
  _stopObservingProgress(tag, false);
44
53
  const animation = withStyleAnimation(currentAnimation);
45
54
  animation.callback = (finished) => {
@@ -47,10 +56,10 @@ runOnUI(() => {
47
56
  _stopObservingProgress(tag, finished);
48
57
  }
49
58
  style.callback && style.callback(finished);
50
- if (type === 'entering') {
51
- enteringAnimationForTag[tag] = null;
52
- }
53
59
  };
60
+ if (backupColor) {
61
+ configs[tag].sv._value = Object.assign(Object.assign({}, configs[tag].sv.value), backupColor);
62
+ }
54
63
  configs[tag].sv.value = animation;
55
64
  _startObservingProgress(tag, sv);
56
65
  },
@@ -120,7 +120,7 @@ export class SlideInUp extends ComplexAnimationBuilder {
120
120
  originY: delayFunction(delay, animation(values.originY, config)),
121
121
  },
122
122
  initialValues: {
123
- originY: height,
123
+ originY: -height,
124
124
  },
125
125
  callback: callback,
126
126
  };
@@ -60,7 +60,7 @@ export class EntryExitTransition extends BaseAnimationBuilder {
60
60
  (_a = animations.transform) === null || _a === void 0 ? void 0 : _a.push({
61
61
  [transformProp]: delayFunction(delay + exitingDuration, withSequence(withTiming(enteringValues.initialValues.transform
62
62
  ? enteringValues.initialValues.transform[index][transformProp]
63
- : 0, { duration: 0 }), value[transformProp])),
63
+ : 0, { duration: exitingDuration }), value[transformProp])),
64
64
  });
65
65
  }
66
66
  });
@@ -97,7 +97,7 @@ export class EntryExitTransition extends BaseAnimationBuilder {
97
97
  }));
98
98
  return {
99
99
  initialValues: Object.assign(Object.assign({}, exitingValues.initialValues), { originX: values.boriginX, originY: values.boriginY, width: values.bwidth, height: values.bheight, transform: mergedTransform }),
100
- animations: Object.assign({ originX: delayFunction(delay + exitingDuration, withTiming(values.originX, { duration: 0 })), originY: delayFunction(delay + exitingDuration, withTiming(values.originY, { duration: 0 })), width: delayFunction(delay + exitingDuration, withTiming(values.width, { duration: 0 })), height: delayFunction(delay + exitingDuration, withTiming(values.height, { duration: 0 })) }, animations),
100
+ animations: Object.assign({ originX: delayFunction(delay + exitingDuration, withTiming(values.originX, { duration: exitingDuration })), originY: delayFunction(delay + exitingDuration, withTiming(values.originY, { duration: exitingDuration })), width: delayFunction(delay + exitingDuration, withTiming(values.width, { duration: exitingDuration })), height: delayFunction(delay + exitingDuration, withTiming(values.height, { duration: exitingDuration })) }, animations),
101
101
  callback: callback,
102
102
  };
103
103
  };
package/mock.js CHANGED
@@ -86,7 +86,7 @@ function createTransitioningComponent(Component) {
86
86
  }
87
87
 
88
88
  render() {
89
- return <Component {...this.props} />;
89
+ return React.createElement(Component, this.props);
90
90
  }
91
91
  };
92
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "2.3.0-beta.3",
3
+ "version": "2.3.0-beta.4",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "start": "node node_modules/react-native/local-cli/cli.js start",
@@ -115,7 +115,7 @@
115
115
  "lint-staged": "^11.2.0",
116
116
  "prettier": "^2.2.1",
117
117
  "react": "17.0.2",
118
- "react-native": "0.66.0",
118
+ "react-native": "0.67.0-rc.3",
119
119
  "react-native-codegen": "^0.0.7",
120
120
  "react-native-gesture-handler": "^1.6.1",
121
121
  "react-test-renderer": "17.0.2",
package/plugin.js CHANGED
@@ -69,6 +69,7 @@ const globals = new Set([
69
69
  'global',
70
70
  '_measure',
71
71
  '_scrollTo',
72
+ '_setGestureState',
72
73
  '_getCurrentTime',
73
74
  '_eventTimestamp',
74
75
  '_frameTimestamp',
@@ -145,16 +146,21 @@ const gestureHandlerGestureObjects = new Set([
145
146
  'LongPress',
146
147
  'ForceTouch',
147
148
  'Native',
149
+ 'Custom',
148
150
  'Race',
149
151
  'Simultaneous',
150
152
  'Exclusive',
151
153
  ]);
152
154
 
153
- const gestureHandlerCallbackMethods = new Set([
154
- 'onBegan',
155
+ const gestureHandlerBuilderMethods = new Set([
156
+ 'onBegin',
155
157
  'onStart',
156
158
  'onEnd',
157
159
  'onUpdate',
160
+ 'onTouchesDown',
161
+ 'onTouchesMove',
162
+ 'onTouchesUp',
163
+ 'onTouchesCancelled',
158
164
  ]);
159
165
 
160
166
  class ClosureGenerator {
@@ -652,7 +658,7 @@ function isGestureObjectEventCallbackMethod(t, node) {
652
658
  return (
653
659
  t.isMemberExpression(node) &&
654
660
  t.isIdentifier(node.property) &&
655
- gestureHandlerCallbackMethods.has(node.property.name) &&
661
+ gestureHandlerBuilderMethods.has(node.property.name) &&
656
662
  containsGestureObject(t, node.object)
657
663
  );
658
664
  }
@@ -1071,4 +1071,5 @@ declare module 'react-native-reanimated' {
1071
1071
  export const SpringUtils: typeof Animated.SpringUtils;
1072
1072
  export const useValue: typeof Animated.useValue;
1073
1073
  export const ReverseAnimation: typeof Animated.ReverseAnimation;
1074
+ export function enableLayoutAnimations(flag: boolean): void;
1074
1075
  }
package/src/Animated.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Image, ScrollView, Text, View } from 'react-native';
1
+ import { Image, ScrollView, Text, View, LogBox } from 'react-native';
2
2
  import createAnimatedComponent from './createAnimatedComponent';
3
3
  import {
4
4
  addWhitelistedNativeProps,
@@ -23,3 +23,11 @@ const Animated = {
23
23
  export * from './reanimated2';
24
24
  export * from './reanimated1';
25
25
  export default Animated;
26
+
27
+ // I think we can ignore this message as long as Gesture Handler doesn't
28
+ // try to load the Reanimated module. I figured it should be here instead of
29
+ // RNGH because this prevents the message from being displayed for all
30
+ // versions of RNGH.
31
+ LogBox.ignoreLogs([
32
+ 'RCTBridge required dispatch_sync to load RNGestureHandlerModule. This may lead to deadlocks',
33
+ ]);