Skip to content

Commit b9f0351

Browse files
krozniataPiotr Trocki
andauthored
feat(ios): add fabric support on iOS (#607)
* feat(ios): add fabric support on iOS * fix import * fix: fix import * fix: remove shouldCallOnPageSelected * fix: fix pager view init with options Co-authored-by: Piotr Trocki <[email protected]>
1 parent a686e87 commit b9f0351

File tree

9 files changed

+409
-101
lines changed

9 files changed

+409
-101
lines changed

fabricexample/src/App.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
*/
88

99
import * as React from 'react';
10-
import { Image, StyleSheet, Text, View, SafeAreaView } from 'react-native';
11-
10+
import { Image, StyleSheet, Text, View } from 'react-native';
1211
import ViewPager from 'react-native-pager-view';
1312
import { PAGES, createPage } from './utils';
1413
import { Button } from './component/Button';
@@ -106,7 +105,7 @@ export default class App extends React.Component<{}, State> {
106105
render() {
107106
const { page, pages, animationsAreEnabled, dotsVisible } = this.state;
108107
return (
109-
<SafeAreaView style={styles.container}>
108+
<View style={styles.container}>
110109
<ViewPager
111110
style={styles.viewPager}
112111
initialPage={0}
@@ -115,6 +114,8 @@ export default class App extends React.Component<{}, State> {
115114
onPageSelected={this.onPageSelected}
116115
onPageScrollStateChanged={this.onPageScrollStateChanged}
117116
pageMargin={10}
117+
layoutDirection="ltr"
118+
overdrag={false}
118119
// Lib does not support dynamically orientation change
119120
orientation="horizontal"
120121
showPageIndicator={dotsVisible}
@@ -165,7 +166,7 @@ export default class App extends React.Component<{}, State> {
165166
progress={this.state.progress}
166167
/>
167168
</View>
168-
</SafeAreaView>
169+
</View>
169170
);
170171
}
171172
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifdef RCT_NEW_ARCH_ENABLED
2+
3+
#import <UIKit/UIKit.h>
4+
#import <Foundation/Foundation.h>
5+
#import <React/RCTViewComponentView.h>
6+
#import "UIViewController+CreateExtension.h"
7+
8+
NS_ASSUME_NONNULL_BEGIN
9+
10+
@interface RNCPagerViewComponentView : RCTViewComponentView <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate>
11+
12+
@property(strong, nonatomic, readonly) UIPageViewController *nativePageViewController;
13+
@property(nonatomic, strong) NSMutableArray<UIViewController *> *nativeChildrenViewControllers;
14+
@property(nonatomic) NSInteger initialPage;
15+
@property(nonatomic) NSInteger currentIndex;
16+
@property(nonatomic) NSString* layoutDirection;
17+
@property(nonatomic) BOOL overdrag;
18+
19+
- (void)setPage:(NSInteger)number;
20+
- (void)setPageWithoutAnimation:(NSInteger)number;
21+
22+
@end
23+
24+
NS_ASSUME_NONNULL_END
25+
26+
#endif

0 commit comments

Comments
 (0)