Ver código fonte

Send screen popped event only for rnn components (#6221)

* Send popped event only for rnn components

* Add native viewcontroller push and pop e2e
Yogev Ben David 4 anos atrás
pai
commit
0b7507d75f
Nenhuma conta vinculada ao e-mail do autor do commit

+ 7
- 0
e2e/ExternalComponent.test.js Ver arquivo

46
     await elementById(TestIDs.MODAL_BTN).tap();
46
     await elementById(TestIDs.MODAL_BTN).tap();
47
     await expect(elementByLabel('External Component')).toBeVisible();
47
     await expect(elementByLabel('External Component')).toBeVisible();
48
   });
48
   });
49
+
50
+  test(':ios: Push and pop native component', async () => {
51
+    await elementById(TestIDs.PUSH_BTN).tap();
52
+    await elementById(TestIDs.PUSH_NATIVE_BTN).tap();
53
+    await elementById(TestIDs.POP_NATIVE_BTN).tap();
54
+    await expect(elementByLabel('This is an external component')).toBeVisible();
55
+  });
49
 });
56
 });

+ 4
- 0
lib/ios/RNNComponentViewController.m Ver arquivo

80
 									isFocused:searchController.searchBar.isFirstResponder];
80
 									isFocused:searchController.searchBar.isFirstResponder];
81
 }
81
 }
82
 
82
 
83
+- (void)screenPopped {
84
+    [_eventEmitter sendScreenPoppedEvent:self.layoutInfo.componentId];
85
+}
86
+
83
 - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
87
 - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
84
 	[self.eventEmitter sendOnSearchBarCancelPressed:self.layoutInfo.componentId];
88
 	[self.eventEmitter sendOnSearchBarCancelPressed:self.layoutInfo.componentId];
85
 }
89
 }

+ 1
- 5
lib/ios/StackControllerDelegate.m Ver arquivo

15
 
15
 
16
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
16
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
17
     if (_presentedViewController && ![navigationController.viewControllers containsObject:_presentedViewController]) {
17
     if (_presentedViewController && ![navigationController.viewControllers containsObject:_presentedViewController]) {
18
-        [self sendScreenPoppedEvent:_presentedViewController];
18
+        [_presentedViewController screenPopped];
19
     }
19
     }
20
     
20
     
21
     _presentedViewController = viewController;
21
     _presentedViewController = viewController;
22
 }
22
 }
23
 
23
 
24
-- (void)sendScreenPoppedEvent:(UIViewController *)poppedScreen {
25
-    [_eventEmitter sendScreenPoppedEvent:poppedScreen.layoutInfo.componentId];
26
-}
27
-
28
 - (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
24
 - (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
29
 								  animationControllerForOperation:(UINavigationControllerOperation)operation
25
 								  animationControllerForOperation:(UINavigationControllerOperation)operation
30
 											   fromViewController:(UIViewController*)fromVC
26
 											   fromViewController:(UIViewController*)fromVC

+ 2
- 0
lib/ios/UIViewController+LayoutProtocol.h Ver arquivo

40
 
40
 
41
 - (void)componentDidDisappear;
41
 - (void)componentDidDisappear;
42
 
42
 
43
+- (void)screenPopped;
44
+
43
 @property (nonatomic, retain) RNNBasePresenter* presenter;
45
 @property (nonatomic, retain) RNNBasePresenter* presenter;
44
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
46
 @property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
45
 @property (nonatomic, strong) RNNNavigationOptions* options;
47
 @property (nonatomic, strong) RNNNavigationOptions* options;

+ 4
- 0
lib/ios/UIViewController+LayoutProtocol.m Ver arquivo

147
     return 0;
147
     return 0;
148
 }
148
 }
149
 
149
 
150
+- (void)screenPopped {
151
+    
152
+}
153
+
150
 - (void)onChildWillAppear {
154
 - (void)onChildWillAppear {
151
 	[self.presenter applyOptions:self.resolveOptions];
155
 	[self.presenter applyOptions:self.resolveOptions];
152
 	[self.parentViewController onChildWillAppear];
156
 	[self.parentViewController onChildWillAppear];

+ 1
- 1
playground/ios/NavigationTests/RNNExternalViewControllerTests.m Ver arquivo

1
 #import <XCTest/XCTest.h>
1
 #import <XCTest/XCTest.h>
2
 #import <OCMock/OCMock.h>
2
 #import <OCMock/OCMock.h>
3
 #import <ReactNativeNavigation/RNNExternalViewController.h>
3
 #import <ReactNativeNavigation/RNNExternalViewController.h>
4
-#import <ReactNativeNavigation/RNNCustomViewController.h>
4
+#import "RNNCustomViewController.h"
5
 
5
 
6
 @interface RNNExternalViewControllerTest : XCTestCase
6
 @interface RNNExternalViewControllerTest : XCTestCase
7
 
7
 

+ 20
- 6
playground/ios/playground.xcodeproj/project.pbxproj Ver arquivo

11
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
11
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
12
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
12
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
13
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
14
+		5007B4312472CA390002AA4E /* RNNNativeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4302472CA390002AA4E /* RNNNativeViewController.m */; };
15
+		5007B4342472CBD40002AA4E /* RNNCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4322472CBD30002AA4E /* RNNCustomViewController.m */; };
16
+		5007B4352472D3C90002AA4E /* RNNNativeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4302472CA390002AA4E /* RNNNativeViewController.m */; };
17
+		5007B4362472D3CC0002AA4E /* RNNCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4322472CBD30002AA4E /* RNNCustomViewController.m */; };
18
+		5007B4382472D9A20002AA4E /* RNNCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4322472CBD30002AA4E /* RNNCustomViewController.m */; };
19
+		5007B4392472D9A70002AA4E /* RNNNativeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5007B4302472CA390002AA4E /* RNNNativeViewController.m */; };
14
 		500E9FE72406A52100C61231 /* BottomTabPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 500E9FE62406A4E200C61231 /* BottomTabPresenterTest.m */; };
20
 		500E9FE72406A52100C61231 /* BottomTabPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 500E9FE62406A4E200C61231 /* BottomTabPresenterTest.m */; };
15
 		501C86B9239FE9C400E0B631 /* UIImage+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 501C86B8239FE9C400E0B631 /* UIImage+Utils.m */; };
21
 		501C86B9239FE9C400E0B631 /* UIImage+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 501C86B8239FE9C400E0B631 /* UIImage+Utils.m */; };
16
 		5022EDCD2405522000852BA6 /* RNNBottomTabsPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E58D263A2385888C003F36BA /* RNNBottomTabsPresenterTest.m */; };
22
 		5022EDCD2405522000852BA6 /* RNNBottomTabsPresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E58D263A2385888C003F36BA /* RNNBottomTabsPresenterTest.m */; };
17
 		5022EDCE2405524700852BA6 /* RNNBottomTabsAppearancePresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5022EDCB240551EE00852BA6 /* RNNBottomTabsAppearancePresenterTest.m */; };
23
 		5022EDCE2405524700852BA6 /* RNNBottomTabsAppearancePresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5022EDCB240551EE00852BA6 /* RNNBottomTabsAppearancePresenterTest.m */; };
18
-		50451D35204451A900695F00 /* RNNCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50451D34204451A800695F00 /* RNNCustomViewController.m */; };
19
 		50647FE323E3196800B92025 /* RNNExternalViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 50647FE223E3196800B92025 /* RNNExternalViewControllerTests.m */; };
24
 		50647FE323E3196800B92025 /* RNNExternalViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 50647FE223E3196800B92025 /* RNNExternalViewControllerTests.m */; };
20
 		50650A23242FB0F800688104 /* CommandsHandlerCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 50650A22242FB0F800688104 /* CommandsHandlerCreator.m */; };
25
 		50650A23242FB0F800688104 /* CommandsHandlerCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 50650A22242FB0F800688104 /* CommandsHandlerCreator.m */; };
21
 		5078DF39242BE8AA007B0B4F /* TestingAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5078DF38242BE8AA007B0B4F /* TestingAppDelegate.m */; };
26
 		5078DF39242BE8AA007B0B4F /* TestingAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5078DF38242BE8AA007B0B4F /* TestingAppDelegate.m */; };
99
 		4A3340545EAAF11C1F146864 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
104
 		4A3340545EAAF11C1F146864 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
100
 		4AE37ACF6BFBAB211EE8E7E9 /* Pods-NavigationIOS12Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationIOS12Tests.release.xcconfig"; path = "Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests.release.xcconfig"; sourceTree = "<group>"; };
105
 		4AE37ACF6BFBAB211EE8E7E9 /* Pods-NavigationIOS12Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationIOS12Tests.release.xcconfig"; path = "Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests.release.xcconfig"; sourceTree = "<group>"; };
101
 		4C14E49C47AA48BEDE90A218 /* Pods-SnapshotTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SnapshotTests.debug.xcconfig"; path = "Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests.debug.xcconfig"; sourceTree = "<group>"; };
106
 		4C14E49C47AA48BEDE90A218 /* Pods-SnapshotTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SnapshotTests.debug.xcconfig"; path = "Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests.debug.xcconfig"; sourceTree = "<group>"; };
107
+		5007B42F2472CA390002AA4E /* RNNNativeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNNativeViewController.h; sourceTree = "<group>"; };
108
+		5007B4302472CA390002AA4E /* RNNNativeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNNativeViewController.m; sourceTree = "<group>"; };
109
+		5007B4322472CBD30002AA4E /* RNNCustomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNCustomViewController.m; sourceTree = "<group>"; };
110
+		5007B4332472CBD40002AA4E /* RNNCustomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNCustomViewController.h; sourceTree = "<group>"; };
102
 		500E9FE62406A4E200C61231 /* BottomTabPresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BottomTabPresenterTest.m; sourceTree = "<group>"; };
111
 		500E9FE62406A4E200C61231 /* BottomTabPresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BottomTabPresenterTest.m; sourceTree = "<group>"; };
103
 		501C86B7239FE9C400E0B631 /* UIImage+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Utils.h"; sourceTree = "<group>"; };
112
 		501C86B7239FE9C400E0B631 /* UIImage+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Utils.h"; sourceTree = "<group>"; };
104
 		501C86B8239FE9C400E0B631 /* UIImage+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Utils.m"; sourceTree = "<group>"; };
113
 		501C86B8239FE9C400E0B631 /* UIImage+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Utils.m"; sourceTree = "<group>"; };
105
 		5022EDCB240551EE00852BA6 /* RNNBottomTabsAppearancePresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBottomTabsAppearancePresenterTest.m; sourceTree = "<group>"; };
114
 		5022EDCB240551EE00852BA6 /* RNNBottomTabsAppearancePresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBottomTabsAppearancePresenterTest.m; sourceTree = "<group>"; };
106
 		50364D69238E7ECC000E62A2 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
115
 		50364D69238E7ECC000E62A2 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
107
 		50364D6B238E7F0A000E62A2 /* ReactNativeNavigation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ReactNativeNavigation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
116
 		50364D6B238E7F0A000E62A2 /* ReactNativeNavigation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ReactNativeNavigation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
108
-		50451D33204451A800695F00 /* RNNCustomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNNCustomViewController.h; path = ../../../lib/ios/RNNCustomViewController.h; sourceTree = "<group>"; };
109
-		50451D34204451A800695F00 /* RNNCustomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNNCustomViewController.m; path = ../../../lib/ios/RNNCustomViewController.m; sourceTree = "<group>"; };
110
 		50647FE223E3196800B92025 /* RNNExternalViewControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNExternalViewControllerTests.m; sourceTree = "<group>"; };
117
 		50647FE223E3196800B92025 /* RNNExternalViewControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNExternalViewControllerTests.m; sourceTree = "<group>"; };
111
 		50650A21242FB0F800688104 /* CommandsHandlerCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommandsHandlerCreator.h; sourceTree = "<group>"; };
118
 		50650A21242FB0F800688104 /* CommandsHandlerCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommandsHandlerCreator.h; sourceTree = "<group>"; };
112
 		50650A22242FB0F800688104 /* CommandsHandlerCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommandsHandlerCreator.m; sourceTree = "<group>"; };
119
 		50650A22242FB0F800688104 /* CommandsHandlerCreator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommandsHandlerCreator.m; sourceTree = "<group>"; };
211
 			children = (
218
 			children = (
212
 				13B07FAF1A68108700A75B9A /* AppDelegate.h */,
219
 				13B07FAF1A68108700A75B9A /* AppDelegate.h */,
213
 				13B07FB01A68108700A75B9A /* AppDelegate.m */,
220
 				13B07FB01A68108700A75B9A /* AppDelegate.m */,
214
-				50451D33204451A800695F00 /* RNNCustomViewController.h */,
215
-				50451D34204451A800695F00 /* RNNCustomViewController.m */,
221
+				5007B42F2472CA390002AA4E /* RNNNativeViewController.h */,
222
+				5007B4302472CA390002AA4E /* RNNNativeViewController.m */,
223
+				5007B4332472CBD40002AA4E /* RNNCustomViewController.h */,
224
+				5007B4322472CBD30002AA4E /* RNNCustomViewController.m */,
216
 				5078DF37242BE8AA007B0B4F /* TestingAppDelegate.h */,
225
 				5078DF37242BE8AA007B0B4F /* TestingAppDelegate.h */,
217
 				5078DF38242BE8AA007B0B4F /* TestingAppDelegate.m */,
226
 				5078DF38242BE8AA007B0B4F /* TestingAppDelegate.m */,
218
 				13B07FB51A68108700A75B9A /* Images.xcassets */,
227
 				13B07FB51A68108700A75B9A /* Images.xcassets */,
925
 			isa = PBXSourcesBuildPhase;
934
 			isa = PBXSourcesBuildPhase;
926
 			buildActionMask = 2147483647;
935
 			buildActionMask = 2147483647;
927
 			files = (
936
 			files = (
928
-				50451D35204451A900695F00 /* RNNCustomViewController.m in Sources */,
937
+				5007B4312472CA390002AA4E /* RNNNativeViewController.m in Sources */,
929
 				5078DF39242BE8AA007B0B4F /* TestingAppDelegate.m in Sources */,
938
 				5078DF39242BE8AA007B0B4F /* TestingAppDelegate.m in Sources */,
939
+				5007B4342472CBD40002AA4E /* RNNCustomViewController.m in Sources */,
930
 				13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
940
 				13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
931
 				13B07FC11A68108700A75B9A /* main.m in Sources */,
941
 				13B07FC11A68108700A75B9A /* main.m in Sources */,
932
 			);
942
 			);
936
 			isa = PBXSourcesBuildPhase;
946
 			isa = PBXSourcesBuildPhase;
937
 			buildActionMask = 2147483647;
947
 			buildActionMask = 2147483647;
938
 			files = (
948
 			files = (
949
+				5007B4362472D3CC0002AA4E /* RNNCustomViewController.m in Sources */,
950
+				5007B4352472D3C90002AA4E /* RNNNativeViewController.m in Sources */,
939
 				507C80E8242A1E6F00F765F7 /* AppDelegate.m in Sources */,
951
 				507C80E8242A1E6F00F765F7 /* AppDelegate.m in Sources */,
940
 				507C80EC242BC6FB00F765F7 /* LayoutCreator.m in Sources */,
952
 				507C80EC242BC6FB00F765F7 /* LayoutCreator.m in Sources */,
941
 				507C80E7242914C800F765F7 /* StackOptionsTest.m in Sources */,
953
 				507C80E7242914C800F765F7 /* StackOptionsTest.m in Sources */,
959
 			isa = PBXSourcesBuildPhase;
971
 			isa = PBXSourcesBuildPhase;
960
 			buildActionMask = 2147483647;
972
 			buildActionMask = 2147483647;
961
 			files = (
973
 			files = (
974
+				5007B4392472D9A70002AA4E /* RNNNativeViewController.m in Sources */,
975
+				5007B4382472D9A20002AA4E /* RNNCustomViewController.m in Sources */,
962
 				E58D265B2385888C003F36BA /* UIViewController+RNNOptionsTest.m in Sources */,
976
 				E58D265B2385888C003F36BA /* UIViewController+RNNOptionsTest.m in Sources */,
963
 				E58D26532385888C003F36BA /* RNNSideMenuPresenterTest.m in Sources */,
977
 				E58D26532385888C003F36BA /* RNNSideMenuPresenterTest.m in Sources */,
964
 				50BCB27623F1A2B100D6C8E5 /* TopBarAppearancePresenterTest.m in Sources */,
978
 				50BCB27623F1A2B100D6C8E5 /* TopBarAppearancePresenterTest.m in Sources */,

+ 1
- 1
playground/ios/playground/AppDelegate.m Ver arquivo

4
 #import <React/RCTBundleURLProvider.h>
4
 #import <React/RCTBundleURLProvider.h>
5
 
5
 
6
 #import <ReactNativeNavigation/ReactNativeNavigation.h>
6
 #import <ReactNativeNavigation/ReactNativeNavigation.h>
7
-#import <ReactNativeNavigation/RNNCustomViewController.h>
7
+#import "RNNCustomViewController.h"
8
 
8
 
9
 @implementation AppDelegate
9
 @implementation AppDelegate
10
 
10
 

lib/ios/RNNCustomViewController.h → playground/ios/playground/RNNCustomViewController.h Ver arquivo


lib/ios/RNNCustomViewController.m → playground/ios/playground/RNNCustomViewController.m Ver arquivo

1
 #import "RNNCustomViewController.h"
1
 #import "RNNCustomViewController.h"
2
+#import "RNNNativeViewController.h"
2
 
3
 
3
 @implementation RNNCustomViewController {
4
 @implementation RNNCustomViewController {
4
 	NSString* _text;
5
 	NSString* _text;
16
 	[self addTestLabel];
17
 	[self addTestLabel];
17
 	[self addDismissModalButton];
18
 	[self addDismissModalButton];
18
 	[self addNavigationBarButtons];
19
 	[self addNavigationBarButtons];
20
+	[self addPushButton];
19
 	
21
 	
20
 	[[self view] setBackgroundColor:UIColor.whiteColor];
22
 	[[self view] setBackgroundColor:UIColor.whiteColor];
21
 }
23
 }
22
 
24
 
23
-- (void)dismissModal {
24
-	[self dismissViewControllerAnimated:YES completion:nil];
25
-}
26
-
27
 - (void)addDismissModalButton {
25
 - (void)addDismissModalButton {
28
 	UIButton* dismissModalButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.center.x - 70, 300, 140, 50)];
26
 	UIButton* dismissModalButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.center.x - 70, 300, 140, 50)];
29
 	dismissModalButton.backgroundColor = UIColor.systemBlueColor;
27
 	dismissModalButton.backgroundColor = UIColor.systemBlueColor;
33
 	[self.view addSubview:dismissModalButton];
31
 	[self.view addSubview:dismissModalButton];
34
 }
32
 }
35
 
33
 
34
+- (void)addPushButton {
35
+	UIButton* pushNativeVCButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.center.x - 70, 370, 140, 50)];
36
+	pushNativeVCButton.backgroundColor = UIColor.systemBlueColor;
37
+	pushNativeVCButton.accessibilityIdentifier = @"PUSH_NATIVE_BTN";
38
+	[pushNativeVCButton setTitle:@"Push Native VC" forState:UIControlStateNormal];
39
+	[pushNativeVCButton addTarget:self action:@selector(pushNativeVC) forControlEvents:UIControlEventTouchDown];
40
+	[self.view addSubview:pushNativeVCButton];
41
+}
42
+
36
 - (void)addTestLabel {
43
 - (void)addTestLabel {
37
 	UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
44
 	UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
38
 	label.textAlignment = NSTextAlignmentCenter;
45
 	label.textAlignment = NSTextAlignmentCenter;
49
 	self.navigationItem.rightBarButtonItem = rightButton;
56
 	self.navigationItem.rightBarButtonItem = rightButton;
50
 }
57
 }
51
 
58
 
59
+- (void)dismissModal {
60
+	[self dismissViewControllerAnimated:YES completion:nil];
61
+}
62
+
63
+- (void)pushNativeVC {
64
+	RNNNativeViewController* nativeVC = [[RNNNativeViewController alloc] init];
65
+	[self.navigationController pushViewController:nativeVC animated:NO];
66
+}
67
+
52
 - (void)rightButtonPressed {
68
 - (void)rightButtonPressed {
53
 	
69
 	
54
 }
70
 }

+ 5
- 0
playground/ios/playground/RNNNativeViewController.h Ver arquivo

1
+#import <UIKit/UIKit.h>
2
+
3
+@interface RNNNativeViewController : UIViewController
4
+
5
+@end

+ 28
- 0
playground/ios/playground/RNNNativeViewController.m Ver arquivo

1
+#import "RNNNativeViewController.h"
2
+
3
+@interface RNNNativeViewController ()
4
+
5
+@end
6
+
7
+@implementation RNNNativeViewController
8
+
9
+- (void)viewDidLoad {
10
+    [super viewDidLoad];
11
+	self.view.backgroundColor = UIColor.whiteColor;
12
+	[self addPopButton];
13
+}
14
+
15
+- (void)addPopButton {
16
+	UIButton* popNativeVCButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.center.x - 70, 370, 140, 50)];
17
+	popNativeVCButton.backgroundColor = UIColor.systemBlueColor;
18
+	popNativeVCButton.accessibilityIdentifier = @"POP_NATIVE_BTN";
19
+	[popNativeVCButton setTitle:@"Pop" forState:UIControlStateNormal];
20
+	[popNativeVCButton addTarget:self action:@selector(pop) forControlEvents:UIControlEventTouchDown];
21
+	[self.view addSubview:popNativeVCButton];
22
+}
23
+
24
+- (void)pop {
25
+	[self.navigationController popViewControllerAnimated:NO];
26
+}
27
+
28
+@end

+ 2
- 0
playground/src/testIDs.js Ver arquivo

149
   EXTERNAL_DISMISS_MODAL_BTN: 'EXTERNAL_DISMISS_MODAL_BTN',
149
   EXTERNAL_DISMISS_MODAL_BTN: 'EXTERNAL_DISMISS_MODAL_BTN',
150
   EXTERNAL_TOP_BAR_RIGHT_BTN: 'EXTERNAL_TOP_BAR_RIGHT_BTN',
150
   EXTERNAL_TOP_BAR_RIGHT_BTN: 'EXTERNAL_TOP_BAR_RIGHT_BTN',
151
   GOTO_SHARED_ELEMENT_SCREEN: 'GOTO_SHARED_ELEMENT_SCREEN',
151
   GOTO_SHARED_ELEMENT_SCREEN: 'GOTO_SHARED_ELEMENT_SCREEN',
152
+  PUSH_NATIVE_BTN: 'PUSH_NATIVE_BTN',
153
+  POP_NATIVE_BTN: 'POP_NATIVE_BTN',
152
 
154
 
153
   // Elements
155
   // Elements
154
   SCROLLVIEW_ELEMENT: `SCROLLVIEW_ELEMENT`,
156
   SCROLLVIEW_ELEMENT: `SCROLLVIEW_ELEMENT`,