react-native-navigation 7.23.1-snapshot.440 → 7.23.1-snapshot.449
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/lib/ios/AnimationObserver.h +17 -0
- package/lib/ios/AnimationObserver.m +41 -0
- package/lib/ios/RNNCommandsHandler.m +14 -4
- package/lib/ios/RNNComponentViewController.m +2 -0
- package/lib/ios/RNNExternalViewController.m +2 -0
- package/lib/ios/RNNSwizzles.m +20 -0
- package/lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
typedef void (^RNNAnimationEndedBlock)(void);
|
|
4
|
+
|
|
5
|
+
@interface AnimationObserver : NSObject
|
|
6
|
+
|
|
7
|
+
+ (AnimationObserver *)sharedObserver;
|
|
8
|
+
|
|
9
|
+
@property(nonatomic) BOOL isAnimating;
|
|
10
|
+
|
|
11
|
+
- (void)registerAnimationEndedBlock:(RNNAnimationEndedBlock)block;
|
|
12
|
+
|
|
13
|
+
- (void)beginAnimation;
|
|
14
|
+
|
|
15
|
+
- (void)endAnimation;
|
|
16
|
+
|
|
17
|
+
@end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#import "AnimationObserver.h"
|
|
2
|
+
|
|
3
|
+
@implementation AnimationObserver {
|
|
4
|
+
NSMutableArray<RNNAnimationEndedBlock> *_animationEndedBlocks;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
- (instancetype)init {
|
|
8
|
+
self = [super init];
|
|
9
|
+
_animationEndedBlocks = [NSMutableArray array];
|
|
10
|
+
return self;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
+ (AnimationObserver *)sharedObserver {
|
|
14
|
+
static AnimationObserver *_sharedObserver = nil;
|
|
15
|
+
static dispatch_once_t onceToken;
|
|
16
|
+
dispatch_once(&onceToken, ^{
|
|
17
|
+
_sharedObserver = [[AnimationObserver alloc] init];
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return _sharedObserver;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
- (void)registerAnimationEndedBlock:(RNNAnimationEndedBlock)block {
|
|
24
|
+
[_animationEndedBlocks addObject:block];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (void)beginAnimation {
|
|
28
|
+
_isAnimating = YES;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)endAnimation {
|
|
32
|
+
_isAnimating = NO;
|
|
33
|
+
|
|
34
|
+
for (RNNAnimationEndedBlock block in _animationEndedBlocks) {
|
|
35
|
+
block();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[_animationEndedBlocks removeAllObjects];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "RNNCommandsHandler.h"
|
|
2
|
+
#import "AnimationObserver.h"
|
|
2
3
|
#import "RNNAssert.h"
|
|
3
4
|
#import "RNNComponentViewController.h"
|
|
4
5
|
#import "RNNConvert.h"
|
|
@@ -200,12 +201,16 @@ static NSString *const setDefaultOptions = @"setDefaultOptions";
|
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
203
|
} else {
|
|
203
|
-
|
|
204
|
+
BOOL animated = [optionsWithDefault.animations.push.enable withDefault:YES];
|
|
205
|
+
BOOL waitForRender = optionsWithDefault.animations.push.shouldWaitForRender;
|
|
206
|
+
newVc.waitForRender = waitForRender;
|
|
204
207
|
__weak UIViewController *weakNewVC = newVc;
|
|
205
208
|
[newVc setReactViewReadyCallback:^{
|
|
209
|
+
if (animated && !waitForRender)
|
|
210
|
+
[[AnimationObserver sharedObserver] beginAnimation];
|
|
206
211
|
[fromVC.stack push:weakNewVC
|
|
207
212
|
onTop:fromVC
|
|
208
|
-
animated:
|
|
213
|
+
animated:animated
|
|
209
214
|
completion:^{
|
|
210
215
|
[self->_layoutManager removePendingViewController:weakNewVC];
|
|
211
216
|
[self->_eventEmitter sendOnNavigationCommandCompletion:push
|
|
@@ -366,14 +371,19 @@ static NSString *const setDefaultOptions = @"setDefaultOptions";
|
|
|
366
371
|
[_layoutManager addPendingViewController:newVc];
|
|
367
372
|
|
|
368
373
|
__weak UIViewController *weakNewVC = newVc;
|
|
369
|
-
|
|
374
|
+
BOOL animated = [withDefault.animations.showModal.enter.enable withDefault:YES];
|
|
375
|
+
BOOL waitForRender = [withDefault.animations.showModal.enter shouldWaitForRender];
|
|
376
|
+
newVc.waitForRender = waitForRender;
|
|
370
377
|
newVc.modalPresentationStyle = [RNNConvert
|
|
371
378
|
UIModalPresentationStyle:[withDefault.modalPresentationStyle withDefault:@"default"]];
|
|
372
379
|
newVc.modalTransitionStyle = [RNNConvert
|
|
373
380
|
UIModalTransitionStyle:[withDefault.modalTransitionStyle withDefault:@"coverVertical"]];
|
|
381
|
+
|
|
382
|
+
if (animated && !waitForRender)
|
|
383
|
+
[[AnimationObserver sharedObserver] beginAnimation];
|
|
374
384
|
[newVc setReactViewReadyCallback:^{
|
|
375
385
|
[self->_modalManager showModal:weakNewVC
|
|
376
|
-
animated:
|
|
386
|
+
animated:animated
|
|
377
387
|
completion:^(NSString *componentId) {
|
|
378
388
|
[self->_layoutManager removePendingViewController:weakNewVC];
|
|
379
389
|
[self->_eventEmitter sendOnNavigationCommandCompletion:showModal
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "RNNComponentViewController.h"
|
|
2
|
+
#import "AnimationObserver.h"
|
|
2
3
|
|
|
3
4
|
@implementation RNNComponentViewController {
|
|
4
5
|
NSArray *_reactViewConstraints;
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
|
|
37
38
|
- (void)viewDidAppear:(BOOL)animated {
|
|
38
39
|
[super viewDidAppear:animated];
|
|
40
|
+
[[AnimationObserver sharedObserver] endAnimation];
|
|
39
41
|
[self.reactView componentDidAppear];
|
|
40
42
|
[self componentDidAppear];
|
|
41
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "RNNExternalViewController.h"
|
|
2
|
+
#import "AnimationObserver.h"
|
|
2
3
|
|
|
3
4
|
@implementation RNNExternalViewController {
|
|
4
5
|
UIViewController *_boundViewController;
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
|
|
50
51
|
- (void)viewDidAppear:(BOOL)animated {
|
|
51
52
|
[super viewDidAppear:animated];
|
|
53
|
+
[[AnimationObserver sharedObserver] endAnimation];
|
|
52
54
|
[self.eventEmitter sendComponentDidAppear:self.layoutInfo.componentId
|
|
53
55
|
componentName:self.layoutInfo.name
|
|
54
56
|
componentType:ComponentTypeScreen];
|
package/lib/ios/RNNSwizzles.m
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#import "RNNSwizzles.h"
|
|
10
|
+
#import "AnimationObserver.h"
|
|
10
11
|
@import ObjectiveC;
|
|
11
12
|
@import UIKit;
|
|
12
13
|
|
|
13
14
|
static id (*__SWZ_initWithEventDispatcher_orig)(id self, SEL _cmd, id eventDispatcher);
|
|
14
15
|
static void (*__SWZ_setFrame_orig)(id self, SEL _cmd, CGRect frame);
|
|
16
|
+
static void (*__SWZ_didMoveToWindow_orig)(id self, SEL _cmd);
|
|
15
17
|
|
|
16
18
|
static void __RNN_setFrame_orig(UIScrollView *self, SEL _cmd, CGRect frame) {
|
|
17
19
|
CGPoint originalOffset = self.contentOffset;
|
|
@@ -37,6 +39,16 @@ static void __RNN_setFrame_orig(UIScrollView *self, SEL _cmd, CGRect frame) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
static void __RNN_didMoveToWindow(UIView *self, SEL _cmd) {
|
|
43
|
+
if (![[AnimationObserver sharedObserver] isAnimating] || !self.window) {
|
|
44
|
+
__SWZ_didMoveToWindow_orig(self, _cmd);
|
|
45
|
+
} else {
|
|
46
|
+
[[AnimationObserver sharedObserver] registerAnimationEndedBlock:^{
|
|
47
|
+
__SWZ_didMoveToWindow_orig(self, _cmd);
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
@implementation RNNSwizzles
|
|
41
53
|
|
|
42
54
|
- (id)__swz_initWithEventDispatcher:(id)eventDispatcher {
|
|
@@ -72,6 +84,14 @@ static void __RNN_setFrame_orig(UIScrollView *self, SEL _cmd, CGRect frame) {
|
|
|
72
84
|
m1 = class_getInstanceMethod(cls, @selector(setFrame:));
|
|
73
85
|
__SWZ_setFrame_orig = (void *)method_getImplementation(m1);
|
|
74
86
|
method_setImplementation(m1, (IMP)__RNN_setFrame_orig);
|
|
87
|
+
|
|
88
|
+
cls = NSClassFromString(@"RCTBaseTextInputView");
|
|
89
|
+
if (cls == NULL) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
Method m4 = class_getInstanceMethod(cls, NSSelectorFromString(@"didMoveToWindow"));
|
|
93
|
+
__SWZ_didMoveToWindow_orig = (void *)method_getImplementation(m4);
|
|
94
|
+
method_setImplementation(m4, (IMP)__RNN_didMoveToWindow);
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
@end
|
|
@@ -355,6 +355,8 @@
|
|
|
355
355
|
50D3A37723BB5CD900717F95 /* OptionsArrayParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 50D3A37523BB5CD900717F95 /* OptionsArrayParser.m */; };
|
|
356
356
|
50D4656D23CE2553005A84B2 /* Transition.h in Headers */ = {isa = PBXBuildFile; fileRef = 50D4656B23CE2553005A84B2 /* Transition.h */; };
|
|
357
357
|
50D4656E23CE2553005A84B2 /* Transition.m in Sources */ = {isa = PBXBuildFile; fileRef = 50D4656C23CE2553005A84B2 /* Transition.m */; };
|
|
358
|
+
50DD9154274FC6E200B4C917 /* AnimationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 50DD9152274FC6E200B4C917 /* AnimationObserver.h */; };
|
|
359
|
+
50DD9155274FC6E200B4C917 /* AnimationObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 50DD9153274FC6E200B4C917 /* AnimationObserver.m */; };
|
|
358
360
|
50DE2E45238EA14E005CD5F4 /* NSArray+utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 50DE2E43238EA14E005CD5F4 /* NSArray+utils.h */; };
|
|
359
361
|
50DE2E46238EA14E005CD5F4 /* NSArray+utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 50DE2E44238EA14E005CD5F4 /* NSArray+utils.m */; };
|
|
360
362
|
50E02BD821A6EE0F00A43942 /* SideMenuOpenMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50E02BD621A6EE0F00A43942 /* SideMenuOpenMode.h */; };
|
|
@@ -885,6 +887,8 @@
|
|
|
885
887
|
50D4656B23CE2553005A84B2 /* Transition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Transition.h; sourceTree = "<group>"; };
|
|
886
888
|
50D4656C23CE2553005A84B2 /* Transition.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Transition.m; sourceTree = "<group>"; };
|
|
887
889
|
50DA74CF232F80FE004A00C1 /* RCTConvert+UIFontWeight.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+UIFontWeight.h"; sourceTree = "<group>"; };
|
|
890
|
+
50DD9152274FC6E200B4C917 /* AnimationObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnimationObserver.h; sourceTree = "<group>"; };
|
|
891
|
+
50DD9153274FC6E200B4C917 /* AnimationObserver.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnimationObserver.m; sourceTree = "<group>"; };
|
|
888
892
|
50DE2E43238EA14E005CD5F4 /* NSArray+utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+utils.h"; sourceTree = "<group>"; };
|
|
889
893
|
50DE2E44238EA14E005CD5F4 /* NSArray+utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+utils.m"; sourceTree = "<group>"; };
|
|
890
894
|
50E02BD521A6E54B00A43942 /* RCTConvert+SideMenuOpenGestureMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+SideMenuOpenGestureMode.h"; sourceTree = "<group>"; };
|
|
@@ -1120,6 +1124,8 @@
|
|
|
1120
1124
|
5053CE7E2175FB1900D0386B /* RNNDefaultOptionsHelper.m */,
|
|
1121
1125
|
C2A57A1A21E815F80066711C /* InteractivePopGestureDelegate.h */,
|
|
1122
1126
|
C2A57A1B21E815F80066711C /* InteractivePopGestureDelegate.m */,
|
|
1127
|
+
50DD9152274FC6E200B4C917 /* AnimationObserver.h */,
|
|
1128
|
+
50DD9153274FC6E200B4C917 /* AnimationObserver.m */,
|
|
1123
1129
|
);
|
|
1124
1130
|
name = Helpers;
|
|
1125
1131
|
sourceTree = "<group>";
|
|
@@ -1931,6 +1937,7 @@
|
|
|
1931
1937
|
50CED44D239EA78700C42EE2 /* TopBarAppearancePresenter.h in Headers */,
|
|
1932
1938
|
50D3A37223B8D77C00717F95 /* SharedElementTransitionOptions.h in Headers */,
|
|
1933
1939
|
50C085F325939F6200B0502C /* RNNButtonBuilder.h in Headers */,
|
|
1940
|
+
50DD9154274FC6E200B4C917 /* AnimationObserver.h in Headers */,
|
|
1934
1941
|
50887C1520ECC5C200D06111 /* RNNButtonOptions.h in Headers */,
|
|
1935
1942
|
5049593E216F5D73006D2B81 /* BoolParser.h in Headers */,
|
|
1936
1943
|
E5F6C3A522DB4D0F0093C2CE /* UIViewController+Utils.h in Headers */,
|
|
@@ -2219,6 +2226,7 @@
|
|
|
2219
2226
|
509416AC23A11CB20036092C /* NullEnum.m in Sources */,
|
|
2220
2227
|
503A8A1A23BCB2ED0094D1C4 /* RNNReactButtonView.m in Sources */,
|
|
2221
2228
|
50570BEB2063E09B006A1B5C /* RNNTitleViewHelper.m in Sources */,
|
|
2229
|
+
50DD9155274FC6E200B4C917 /* AnimationObserver.m in Sources */,
|
|
2222
2230
|
263905E71E4CAC950023D7D3 /* RNNSideMenuChildVC.m in Sources */,
|
|
2223
2231
|
5082CC3423CDC3B800FD2B6A /* HorizontalTranslationTransition.m in Sources */,
|
|
2224
2232
|
50495957216F6B3D006D2B81 /* DictionaryParser.m in Sources */,
|
package/package.json
CHANGED