1 | import React, { ReactElement } from 'react';
|
2 | import type { ViewPagerProps } from './types';
|
3 | /**
|
4 | * Container that allows to flip left and right between child views. Each
|
5 | * child view of the `ViewPager` will be treated as a separate page
|
6 | * and will be stretched to fill the `ViewPager`.
|
7 | *
|
8 | * It is important all children are `<View>`s and not composite components.
|
9 | * You can set style properties like `padding` or `backgroundColor` for each
|
10 | * child. It is also important that each child have a `key` prop.
|
11 | *
|
12 | * Example:
|
13 | *
|
14 | * ```
|
15 | * render: function() {
|
16 | * return (
|
17 | * <ViewPager
|
18 | * style={styles.viewPager}
|
19 | * initialPage={0}>
|
20 | * <View style={styles.pageStyle} key="1">
|
21 | * <Text>First page</Text>
|
22 | * </View>
|
23 | * <View style={styles.pageStyle} key="2">
|
24 | * <Text>Second page</Text>
|
25 | * </View>
|
26 | * </ViewPager>
|
27 | * );
|
28 | * }
|
29 | *
|
30 | * ...
|
31 | *
|
32 | * var styles = {
|
33 | * ...
|
34 | * viewPager: {
|
35 | * flex: 1
|
36 | * },
|
37 | * pageStyle: {
|
38 | * alignItems: 'center',
|
39 | * padding: 20,
|
40 | * }
|
41 | * }
|
42 | * ```
|
43 | */
|
44 | export declare class ViewPager extends React.Component<ViewPagerProps> {
|
45 | private isScrolling;
|
46 | private viewPager;
|
47 | componentDidMount(): void;
|
48 | getInnerViewNode: () => ReactElement;
|
49 | private _onPageScroll;
|
50 | private _onPageScrollStateChanged;
|
51 | private _onPageSelected;
|
52 | /**
|
53 | * A helper function to scroll to a specific page in the ViewPager.
|
54 | * The transition between pages will be animated.
|
55 | */
|
56 | setPage: (selectedPage: number) => void;
|
57 | /**
|
58 | * A helper function to scroll to a specific page in the ViewPager.
|
59 | * The transition between pages will *not* be animated.
|
60 | */
|
61 | setPageWithoutAnimation: (selectedPage: number) => void;
|
62 | /**
|
63 | * A helper function to enable/disable scroll imperatively
|
64 | * The recommended way is using the scrollEnabled prop, however, there might be a case where a
|
65 | * imperative solution is more useful (e.g. for not blocking an animation)
|
66 | */
|
67 | setScrollEnabled: (scrollEnabled: boolean) => void;
|
68 | private _onMoveShouldSetResponderCapture;
|
69 | render(): JSX.Element;
|
70 | }
|