Support horizontal bounces for PagerScoll to make it looks like iOS component#722
Support horizontal bounces for PagerScoll to make it looks like iOS component#722satya164 merged 7 commits intosatya164:1.0from
Conversation
satya164
left a comment
There was a problem hiding this comment.
Thanks for the PR. Can you rename bouncesEnabled to just bounces to be consistent with RN's ScrollView naming?
src/TypeDefinitions.js
Outdated
| export type PagerCommonProps<T> = { | ||
| animationEnabled?: boolean, | ||
| swipeEnabled?: boolean, | ||
| bouncesEnabled?: boolean, |
There was a problem hiding this comment.
I think this should be in PagerScroll's props because it's not a common prop. We also need to add it to the propTypes
There was a problem hiding this comment.
I have added bounces prop to PropTypes file. But I can't only set bounces type for PagerScroll because this prop should be able to be use for TabView.
TabView's type is
type Props<T> = PagerCommonProps<T> &
PagerExtraProps & {
navigationState: NavigationState<T>,
onIndexChange: (index: number) => mixed,
initialLayout?: Layout,
renderPager: (props: *) => React.Node,
renderScene: (props: SceneRendererProps<T> & Scene<T>) => React.Node,
renderTabBar: (props: SceneRendererProps<T>) => React.Node,
tabBarPosition: 'top' | 'bottom',
useNativeDriver?: boolean,
style?: ViewStyleProp,
};
And PagerScoll's type is
type Props<T> = PagerRendererProps<T>
export type PagerRendererProps<T> = PagerCommonProps<T> & {
layout: Layout & {
measured: boolean,
},
navigationState: NavigationState<T>,
panX: Animated.Value,
offsetX: Animated.Value,
jumpTo: (key: string) => mixed,
useNativeDriver: boolean,
children: Node,
};
The shared type of TabView and PagerScroll is PagerCommonProps. I can only set bounces type in PagerCommonProps to pass flowtype validation.
But PagerAndroid will not be affect because bounces is optional and no effect on Android.
|
hi @satya164 . should I need to update the branch? And is this PR ready to be merged? |
Motivation
Currently the Pager bounce is disabled and it looks like an Android Pager not iOS scrollview.
Support horizontal bounces for
PagerScollto make it looks like an iOS component.bouncesEnabledprops is defaultfalseto avoid affecting existing users.This PR is for v1.0 because most developers are still using this version.
I will create another PR for v2.0 as soon as possible.
Test plan