Permalink
Browse files

add peeking feature in AndroidViewPage(RN)

Reviewed By: sahrens

Differential Revision: D5340198

fbshipit-source-id: b2986a320a39225882d4289b193e1d22e9e7547e
  • Loading branch information...
Kaibin Yin authored and facebook-github-bot committed Jul 1, 2017
1 parent ecd5829 commit c42080eaaf20710728975aec0180a81cfffb36f3
@@ -75,6 +75,7 @@ class ViewPagerAndroid extends React.Component {
onPageScrollStateChanged?: Function,
onPageSelected?: Function,
pageMargin?: number,
peekEnabled?: boolean,
keyboardDismissMode?: 'none' | 'on-drag',
scrollEnabled?: boolean,
};
@@ -137,6 +138,12 @@ class ViewPagerAndroid extends React.Component {
* The default value is true.
*/
scrollEnabled: PropTypes.bool,
/**
* Whether enable showing peekFraction or not. If this is true, the preview of
* last and next page will show in current screen. Defaults to false.
*/
peekEnabled: PropTypes.bool,
};
componentDidMount() {
@@ -120,4 +120,9 @@ public void removeViewAt(ReactViewPager parent, int index) {
public void setPageMargin(ReactViewPager pager, float margin) {
pager.setPageMargin((int) PixelUtil.toPixelFromDIP(margin));
}
@ReactProp(name = "peekEnabled", defaultBoolean = false)
public void setPeekEnabled(ReactViewPager pager, boolean peekEnabled) {
pager.setClipToPadding(!peekEnabled);
}
}

0 comments on commit c42080e

Please sign in to comment.