react-native-reanimated 2.3.0-beta.1 → 2.3.0-beta.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.
- package/RNReanimated.podspec +4 -4
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/ios/LayoutReanimation/REAUIManager.mm +19 -14
- package/ios/native/REAInitializer.mm +9 -0
- package/lib/reanimated2/index.js +1 -0
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +4 -2
- package/lib/reanimated2/utils.js +9 -0
- package/package.json +3 -3
- package/react-native-reanimated.d.ts +9 -0
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +10 -2
- package/src/reanimated2/utils.ts +21 -0
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
package/RNReanimated.podspec
CHANGED
|
@@ -7,7 +7,7 @@ reactVersion = '0.0.0'
|
|
|
7
7
|
begin
|
|
8
8
|
reactVersion = JSON.parse(File.read(File.join(__dir__, "..", "react-native", "package.json")))["version"]
|
|
9
9
|
rescue
|
|
10
|
-
reactVersion = '0.
|
|
10
|
+
reactVersion = '0.66.0'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
rnVersion = reactVersion.split('.')[1]
|
|
@@ -20,7 +20,7 @@ end
|
|
|
20
20
|
|
|
21
21
|
folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion
|
|
22
22
|
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
|
|
23
|
-
folly_version = '
|
|
23
|
+
folly_version = '2021.04.26.00'
|
|
24
24
|
boost_compiler_flags = '-Wno-documentation'
|
|
25
25
|
|
|
26
26
|
Pod::Spec.new do |s|
|
|
@@ -49,12 +49,12 @@ Pod::Spec.new do |s|
|
|
|
49
49
|
|
|
50
50
|
s.pod_target_xcconfig = {
|
|
51
51
|
"USE_HEADERMAP" => "YES",
|
|
52
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" "
|
|
52
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" "
|
|
53
53
|
}
|
|
54
54
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
55
55
|
s.xcconfig = {
|
|
56
56
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
|
|
57
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
|
|
57
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
|
|
58
58
|
"OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags }
|
|
59
59
|
|
|
60
60
|
s.requires_arc = true
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
#import "RCTLayoutAnimationGroup.h"
|
|
9
9
|
#import "REAIOSScheduler.h"
|
|
10
10
|
#include "Scheduler.h"
|
|
11
|
+
|
|
12
|
+
#if __has_include(<RNScreens/RNSScreen.h>)
|
|
11
13
|
#import <RNScreens/RNSScreen.h>
|
|
14
|
+
#endif
|
|
12
15
|
|
|
13
16
|
@interface RCTUIManager(REA)
|
|
14
17
|
- (void)_manageChildren:(NSNumber *)containerTag
|
|
@@ -40,7 +43,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
40
43
|
{
|
|
41
44
|
if(!_blockSetter) {
|
|
42
45
|
_blockSetter = true;
|
|
43
|
-
|
|
46
|
+
|
|
44
47
|
self.bridge = bridge;
|
|
45
48
|
[super setValue:bridge forKey:@"_bridge"];
|
|
46
49
|
[self setValue:[bridge.uiManager valueForKey:@"_shadowViewRegistry"] forKey:@"_shadowViewRegistry"];
|
|
@@ -52,7 +55,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
52
55
|
[self setValue:[bridge.uiManager valueForKey:@"_rootViewTags"] forKey:@"_rootViewTags"];
|
|
53
56
|
[self setValue:[bridge.uiManager valueForKey:@"_observerCoordinator"] forKey:@"_observerCoordinator"];
|
|
54
57
|
[self setValue:[bridge.uiManager valueForKey:@"_componentDataByName"] forKey:@"_componentDataByName"];
|
|
55
|
-
|
|
58
|
+
|
|
56
59
|
_blockSetter = false;
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -68,12 +71,12 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
68
71
|
BOOL isUIViewRegistry = ((id)registry == (id)[self valueForKey:@"_viewRegistry"]);
|
|
69
72
|
id<RCTComponent> container;
|
|
70
73
|
NSArray<id<RCTComponent>> *permanentlyRemovedChildren;
|
|
71
|
-
if(isUIViewRegistry) {
|
|
72
|
-
container = registry[containerTag];
|
|
74
|
+
if(isUIViewRegistry) {
|
|
75
|
+
container = registry[containerTag];
|
|
73
76
|
for(id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
74
77
|
[container removeReactSubview:toRemoveChild];
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
|
|
77
80
|
permanentlyRemovedChildren = [super _childrenToRemoveFromContainer:container atIndices:removeAtIndices];
|
|
78
81
|
if(permanentlyRemovedChildren != nil) {
|
|
79
82
|
for(id<RCTComponent> permanentlyRemovedChild in permanentlyRemovedChildren) {
|
|
@@ -84,7 +87,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
|
-
|
|
90
|
+
|
|
88
91
|
[super _manageChildren:containerTag
|
|
89
92
|
moveFromIndices:moveFromIndices
|
|
90
93
|
moveToIndices:moveToIndices
|
|
@@ -92,7 +95,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
92
95
|
addAtIndices:addAtIndices
|
|
93
96
|
removeAtIndices:removeAtIndices
|
|
94
97
|
registry:registry];
|
|
95
|
-
|
|
98
|
+
|
|
96
99
|
if(isUIViewRegistry) {
|
|
97
100
|
NSMutableDictionary<NSNumber *, id<RCTComponent>> *viewRegistry = [self valueForKey:@"_viewRegistry"];
|
|
98
101
|
for(id<RCTComponent> toRemoveChild in _toBeRemovedRegister[containerTag]) {
|
|
@@ -103,7 +106,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
103
106
|
[container insertReactSubview:toRemoveChild atIndex:lastIndex];
|
|
104
107
|
viewRegistry[toRemoveChild.reactTag] = toRemoveChild;
|
|
105
108
|
}
|
|
106
|
-
|
|
109
|
+
|
|
107
110
|
for (UIView *removedChild in permanentlyRemovedChildren) {
|
|
108
111
|
[self callAnimationForTree: removedChild parentTag:containerTag];
|
|
109
112
|
}
|
|
@@ -115,7 +118,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
115
118
|
REASnapshot* snapshot = [[REASnapshot alloc] init:view];
|
|
116
119
|
_parentMapper[view.reactTag] = parentTag;
|
|
117
120
|
[_animationsManager onViewRemoval:view before:snapshot];
|
|
118
|
-
|
|
121
|
+
|
|
119
122
|
for(UIView* subView in view.reactSubviews) {
|
|
120
123
|
[self callAnimationForTree:subView parentTag:view.reactTag];
|
|
121
124
|
}
|
|
@@ -123,7 +126,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
123
126
|
|
|
124
127
|
// Overrided https://github.com/facebook/react-native/blob/v0.65.0/React/Modules/RCTUIManager.m#L530
|
|
125
128
|
- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView
|
|
126
|
-
{
|
|
129
|
+
{
|
|
127
130
|
NSHashTable<RCTShadowView *> *affectedShadowViews = [NSHashTable weakObjectsHashTable];
|
|
128
131
|
[rootShadowView layoutWithAffectedShadowViews:affectedShadowViews];
|
|
129
132
|
|
|
@@ -232,7 +235,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
232
235
|
if (view.isHidden != isHidden) {
|
|
233
236
|
view.hidden = isHidden;
|
|
234
237
|
}
|
|
235
|
-
|
|
238
|
+
|
|
236
239
|
REASnapshot* snapshotBefore = [[REASnapshot alloc] init:view];
|
|
237
240
|
if (creatingLayoutAnimation) {
|
|
238
241
|
// Animate view creation
|
|
@@ -278,7 +281,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
278
281
|
[view reactSetFrame:frame];
|
|
279
282
|
completion(YES);
|
|
280
283
|
}
|
|
281
|
-
|
|
284
|
+
|
|
282
285
|
if(isNew) {
|
|
283
286
|
REASnapshot* snapshot = [[REASnapshot alloc] init:view];
|
|
284
287
|
[_animationsManager onViewCreate:view after:snapshot];
|
|
@@ -287,7 +290,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
287
290
|
REASnapshot* snapshotAfter = [[REASnapshot alloc] init:view];
|
|
288
291
|
[_animationsManager onViewUpdate:view before:snapshotBefore after:snapshotAfter];
|
|
289
292
|
}
|
|
290
|
-
|
|
293
|
+
|
|
291
294
|
}
|
|
292
295
|
|
|
293
296
|
[_animationsManager removeLeftovers];
|
|
@@ -319,7 +322,7 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
319
322
|
if(tag == nil) {
|
|
320
323
|
return;
|
|
321
324
|
}
|
|
322
|
-
|
|
325
|
+
|
|
323
326
|
[_toBeRemovedRegister[tag] removeObject:view];
|
|
324
327
|
if(_toBeRemovedRegister[tag].count == 0) {
|
|
325
328
|
[_toBeRemovedRegister removeObjectForKey:tag];
|
|
@@ -328,9 +331,11 @@ std::weak_ptr<reanimated::Scheduler> _scheduler;
|
|
|
328
331
|
[view.reactSuperview removeReactSubview:view];
|
|
329
332
|
id<RCTComponent> parentView = viewRegistry[tag];
|
|
330
333
|
[parentView removeReactSubview:view];
|
|
334
|
+
#if __has_include(<RNScreens/RNSScreen.h>)
|
|
331
335
|
if ([view isKindOfClass:[RNSScreenView class]]) {
|
|
332
336
|
[parentView didUpdateReactSubviews];
|
|
333
337
|
}
|
|
338
|
+
#endif
|
|
334
339
|
[viewRegistry removeObjectForKey:view.reactTag];
|
|
335
340
|
}
|
|
336
341
|
|
|
@@ -24,7 +24,16 @@ JSIExecutor::RuntimeInstaller REAJSIExecutorRuntimeInstaller(
|
|
|
24
24
|
|
|
25
25
|
[bridge moduleForClass:[RCTEventDispatcher class]];
|
|
26
26
|
RCTEventDispatcher *eventDispatcher = [REAEventDispatcher new];
|
|
27
|
+
#if RNVERSION >= 66
|
|
28
|
+
RCTCallableJSModules *callableJSModules = [RCTCallableJSModules new];
|
|
29
|
+
[bridge setValue:callableJSModules forKey:@"_callableJSModules"];
|
|
30
|
+
[callableJSModules setBridge:bridge];
|
|
31
|
+
[eventDispatcher setValue:callableJSModules forKey:@"_callableJSModules"];
|
|
32
|
+
[eventDispatcher setValue:bridge forKey:@"_bridge"];
|
|
33
|
+
[eventDispatcher initialize];
|
|
34
|
+
#else
|
|
27
35
|
[eventDispatcher setBridge:bridge];
|
|
36
|
+
#endif
|
|
28
37
|
[bridge updateModuleWithInstance:eventDispatcher];
|
|
29
38
|
_bridge_reanimated = bridge;
|
|
30
39
|
const auto runtimeInstaller = [bridge, runtimeInstallerToWrap](facebook::jsi::Runtime &runtime) {
|
package/lib/reanimated2/index.js
CHANGED
|
@@ -17,7 +17,9 @@ export class LightSpeedInRight extends ComplexAnimationBuilder {
|
|
|
17
17
|
animations: {
|
|
18
18
|
opacity: delayFunction(delay, withTiming(1, { duration: duration })),
|
|
19
19
|
transform: [
|
|
20
|
-
{
|
|
20
|
+
{
|
|
21
|
+
translateX: delayFunction(delay, animation(0, Object.assign(Object.assign({}, config), { duration: duration * 0.7 }))),
|
|
22
|
+
},
|
|
21
23
|
{
|
|
22
24
|
skewX: delayFunction(delay, withSequence(withTiming('10deg', { duration: duration * 0.7 }), withTiming('-5deg', { duration: duration * 0.15 }), withTiming('0deg', { duration: duration * 0.15 }))),
|
|
23
25
|
},
|
|
@@ -52,7 +54,7 @@ export class LightSpeedInLeft extends ComplexAnimationBuilder {
|
|
|
52
54
|
opacity: delayFunction(delay, withTiming(1, { duration: duration })),
|
|
53
55
|
transform: [
|
|
54
56
|
{
|
|
55
|
-
translateX: delayFunction(delay, animation(0, config)),
|
|
57
|
+
translateX: delayFunction(delay, animation(0, Object.assign(Object.assign({}, config), { duration: duration * 0.7 }))),
|
|
56
58
|
},
|
|
57
59
|
{
|
|
58
60
|
skewX: delayFunction(delay, withSequence(withTiming('-10deg', { duration: duration * 0.7 }), withTiming('5deg', { duration: duration * 0.15 }), withTiming('0deg', { duration: duration * 0.15 }))),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.3.0-beta.
|
|
3
|
+
"version": "2.3.0-beta.2",
|
|
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",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@types/babel__generator": "^7.6.2",
|
|
93
93
|
"@types/babel__traverse": "^7.0.15",
|
|
94
94
|
"@types/jest": "^26.0.15",
|
|
95
|
-
"@types/react-native": "^0.
|
|
95
|
+
"@types/react-native": "^0.65.1",
|
|
96
96
|
"@typescript-eslint/eslint-plugin": "^4.15.1",
|
|
97
97
|
"@typescript-eslint/parser": "^4.15.1",
|
|
98
98
|
"babel-eslint": "^10.0.3",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"lint-staged": "^10.2.11",
|
|
113
113
|
"prettier": "^2.2.1",
|
|
114
114
|
"react": "17.0.2",
|
|
115
|
-
"react-native": "0.
|
|
115
|
+
"react-native": "0.66.0-rc.4",
|
|
116
116
|
"react-native-codegen": "^0.0.7",
|
|
117
117
|
"react-native-gesture-handler": "^1.6.1",
|
|
118
118
|
"react-test-renderer": "17.0.2",
|
|
@@ -649,6 +649,15 @@ declare module 'react-native-reanimated' {
|
|
|
649
649
|
pageY: number;
|
|
650
650
|
};
|
|
651
651
|
|
|
652
|
+
export function getRelativeCoords(
|
|
653
|
+
ref: RefObject<Component>,
|
|
654
|
+
x: number,
|
|
655
|
+
y: number
|
|
656
|
+
): {
|
|
657
|
+
x: number;
|
|
658
|
+
y: number;
|
|
659
|
+
};
|
|
660
|
+
|
|
652
661
|
export function scrollTo(
|
|
653
662
|
ref: RefObject<ReactNativeScrollView | ScrollView>,
|
|
654
663
|
x: number,
|
package/src/reanimated2/index.ts
CHANGED
|
@@ -28,7 +28,12 @@ export class LightSpeedInRight
|
|
|
28
28
|
animations: {
|
|
29
29
|
opacity: delayFunction(delay, withTiming(1, { duration: duration })),
|
|
30
30
|
transform: [
|
|
31
|
-
{
|
|
31
|
+
{
|
|
32
|
+
translateX: delayFunction(
|
|
33
|
+
delay,
|
|
34
|
+
animation(0, { ...config, duration: duration * 0.7 })
|
|
35
|
+
),
|
|
36
|
+
},
|
|
32
37
|
{
|
|
33
38
|
skewX: delayFunction(
|
|
34
39
|
delay,
|
|
@@ -72,7 +77,10 @@ export class LightSpeedInLeft
|
|
|
72
77
|
opacity: delayFunction(delay, withTiming(1, { duration: duration })),
|
|
73
78
|
transform: [
|
|
74
79
|
{
|
|
75
|
-
translateX: delayFunction(
|
|
80
|
+
translateX: delayFunction(
|
|
81
|
+
delay,
|
|
82
|
+
animation(0, { ...config, duration: duration * 0.7 })
|
|
83
|
+
),
|
|
76
84
|
},
|
|
77
85
|
{
|
|
78
86
|
skewX: delayFunction(
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { measure } from './NativeMethods';
|
|
3
|
+
import { RefObjectFunction } from './hook/useAnimatedRef';
|
|
4
|
+
|
|
5
|
+
export interface ComponentCoords {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getRelativeCoords(
|
|
11
|
+
parentRef: RefObjectFunction<Component>,
|
|
12
|
+
x: number,
|
|
13
|
+
y: number
|
|
14
|
+
): ComponentCoords {
|
|
15
|
+
'worklet';
|
|
16
|
+
const parentCoords = measure(parentRef);
|
|
17
|
+
return {
|
|
18
|
+
x: x - parentCoords.x,
|
|
19
|
+
y: y - parentCoords.y,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
Binary file
|
|
Binary file
|