Skip to content

Commit

Permalink
add peeking feature in AndroidViewPage(RN)
Browse files Browse the repository at this point in the history
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 c42080e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Libraries/Components/ViewPager/ViewPagerAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ViewPagerAndroid extends React.Component {
onPageScrollStateChanged?: Function,
onPageSelected?: Function,
pageMargin?: number,
peekEnabled?: boolean,
keyboardDismissMode?: 'none' | 'on-drag',
scrollEnabled?: boolean,
};
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.