UNPKG

1.77 kBPlain TextView Raw
1#import "RNSScreenNavigationContainer.h"
2#import "RNSScreen.h"
3#import "RNSScreenContainer.h"
4
5#ifdef RCT_NEW_ARCH_ENABLED
6#import <React/RCTFabricComponentsPlugins.h>
7#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
8#import <react/renderer/components/rnscreens/Props.h>
9
10namespace react = facebook::react;
11#endif // RCT_NEW_ARCH_ENABLED
12
13@implementation RNSContainerNavigationController
14
15@end
16
17@implementation RNSScreenNavigationContainerView
18
19- (void)setupController
20{
21 self.controller = [[RNSContainerNavigationController alloc] init];
22 [(RNSContainerNavigationController *)self.controller setNavigationBarHidden:YES animated:NO];
23 [self addSubview:self.controller.view];
24}
25
26- (void)updateContainer
27{
28 for (RNSScreenView *screen in self.reactSubviews) {
29 if (screen.activityState == RNSActivityStateOnTop) {
30 // there should never be more than one screen with `RNSActivityStateOnTop`
31 // since this component should be used for `tabs` and `drawer` navigators
32 [(RNSContainerNavigationController *)self.controller setViewControllers:@[ screen.controller ] animated:NO];
33 [screen notifyFinishTransitioning];
34 }
35 }
36
37 [self maybeDismissVC];
38}
39
40#pragma mark-- Fabric specific
41#ifdef RCT_NEW_ARCH_ENABLED
42+ (react::ComponentDescriptorProvider)componentDescriptorProvider
43{
44 return react::concreteComponentDescriptorProvider<react::RNSScreenNavigationContainerComponentDescriptor>();
45}
46#endif
47
48@end
49
50#ifdef RCT_NEW_ARCH_ENABLED
51Class<RCTComponentViewProtocol> RNSScreenNavigationContainerCls(void)
52{
53 return RNSScreenNavigationContainerView.class;
54}
55#endif
56
57@implementation RNSScreenNavigationContainerManager
58
59RCT_EXPORT_MODULE()
60
61- (UIView *)view
62{
63 return [[RNSScreenNavigationContainerView alloc] init];
64}
65
66@end