Skip to content

Commit 03fe6b1

Browse files
authored
fix(ios): fix keyboard behavior on fabric (#634)
* fix(ios): fix keyboard behavior on fabric * fix: revert change
1 parent d5015d7 commit 03fe6b1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ios/Fabric/RNCPagerViewComponentView.mm

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ @interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageView
1919
@end
2020

2121
@implementation RNCPagerViewComponentView {
22+
LayoutMetrics _layoutMetrics;
2223
UIScrollView *scrollView;
2324
}
2425

@@ -66,15 +67,10 @@ - (instancetype)initWithFrame:(CGRect)frame
6667
return self;
6768
}
6869

69-
-(void)layoutSubviews {
70-
[super layoutSubviews];
71-
72-
[_nativePageViewController setViewControllers:@[[_nativeChildrenViewControllers objectAtIndex:_currentIndex]] direction: [self isLtrLayout] ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];
73-
}
74-
7570
- (void)willMoveToSuperview:(UIView *)newSuperview {
7671
if (newSuperview != nil) {
7772
[self initializeNativePageViewController];
73+
[self goTo:_currentIndex animated:NO];
7874
}
7975
}
8076

@@ -90,7 +86,7 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
9086
[[_nativeChildrenViewControllers objectAtIndex:index].view removeFromSuperview];
9187
[_nativeChildrenViewControllers objectAtIndex:index].view = nil;
9288
[_nativeChildrenViewControllers removeObjectAtIndex:index];
93-
89+
9490
NSInteger maxPage = _nativeChildrenViewControllers.count - 1;
9591

9692
if (self.currentIndex >= maxPage) {
@@ -99,6 +95,13 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
9995
}
10096

10197

98+
-(void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics {
99+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:_layoutMetrics];
100+
self.contentView.frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame());
101+
_layoutMetrics = layoutMetrics;
102+
}
103+
104+
102105
-(void)prepareForRecycle {
103106
[super prepareForRecycle];
104107

0 commit comments

Comments
 (0)