Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
feat: add keyboardDismissMode prop to TabViewPagerAndroid (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
matihabbas authored and satya164 committed Feb 21, 2018
1 parent fb2cf1f commit 39b01a0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/TabViewPagerAndroid.js
Expand Up @@ -14,7 +14,9 @@ type PageScrollEvent = {

type PageScrollState = 'dragging' | 'settling' | 'idle';

type Props<T> = PagerRendererProps<T>;
type Props<T> = PagerRendererProps<T> & {
keyboardDismissMode: 'none' | 'on-drag',
};

export default class TabViewPagerAndroid<T: *> extends React.Component<
Props<T>
Expand All @@ -23,6 +25,7 @@ export default class TabViewPagerAndroid<T: *> extends React.Component<

static defaultProps = {
canJumpToTab: () => true,
keyboardDismissMode: 'on-drag',
};

constructor(props: Props<T>) {
Expand Down Expand Up @@ -108,7 +111,12 @@ export default class TabViewPagerAndroid<T: *> extends React.Component<
_setRef = (el: ?ViewPagerAndroid) => (this._viewPager = el);

render() {
const { children, navigationState, swipeEnabled } = this.props;
const {
children,
navigationState,
swipeEnabled,
keyboardDismissMode,
} = this.props;
const content = React.Children.map(children, (child, i) => (
<View
key={navigationState.routes[i].key}
Expand All @@ -128,7 +136,7 @@ export default class TabViewPagerAndroid<T: *> extends React.Component<
return (
<ViewPagerAndroid
key={navigationState.routes.length}
keyboardDismissMode="on-drag"
keyboardDismissMode={keyboardDismissMode}
initialPage={initialPage}
scrollEnabled={swipeEnabled !== false}
onPageScroll={this._handlePageScroll}
Expand Down

0 comments on commit 39b01a0

Please sign in to comment.