add peeking feature in AndroidViewPage(RN)
Reviewed By: sahrens Differential Revision: D5340198 fbshipit-source-id: b2986a320a39225882d4289b193e1d22e9e7547e
This commit is contained in:
parent
ecd5829bf8
commit
c42080eaaf
|
@ -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 class ReactViewPagerManager extends ViewGroupManager<ReactViewPager> {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue