PLT-5572 Add swiping to close all scenes that open from the side (#292)

This commit is contained in:
Chris Duarte 2017-02-23 15:04:59 -08:00 committed by enahum
parent 90ac1fa625
commit 567310b9d6
3 changed files with 10 additions and 5 deletions

View file

@ -101,10 +101,14 @@ class Router extends React.Component {
};
}
// NavigationExperimental only creates the correct panHandlers if the panHandlers prop === undefined
const panHandlers = navigationProps.allowSceneSwipe ? undefined : null; // eslint-disable-line
return (
<NavigationExperimental.Card
{...cardProps}
panHandlers={null}
onNavigateBack={this.props.actions.goBack}
panHandlers={panHandlers}
style={style}
renderScene={this.renderScene}
key={scene.key}
@ -198,7 +202,7 @@ class Router extends React.Component {
panOpenMask={0.1}
panCloseMask={0.2}
panThreshold={0.2}
acceptPan={navigationProps.allowSwipe}
acceptPan={navigationProps.allowMenuSwipe}
negotiatePan={true}
useInteractionManager={true}
>
@ -214,7 +218,7 @@ class Router extends React.Component {
panOpenMask={0.1}
panCloseMask={0.2}
panThreshold={0.2}
acceptPan={navigationProps.allowSwipe}
acceptPan={navigationProps.allowMenuSwipe}
negotiatePan={true}
useInteractionManager={true}
>

View file

@ -41,7 +41,7 @@ export default class Channel extends React.PureComponent {
};
static navigationProps = {
allowSwipe: true,
allowMenuSwipe: true,
renderLeftComponent: (props, emitter) => {
return <ChannelDrawerButton emitter={emitter}/>;
},

View file

@ -53,7 +53,8 @@ const defaults = {
flexDirection: 'row',
alignItems: 'center'
},
allowSwipe: false
allowSceneSwipe: true,
allowMenuSwipe: false
};
export default (stateProps, dispatchProps) => (WrappedComponent) => {