React原生抽屉始终在iOS中打开

时间:2017-02-03 19:07:10

标签: react-native navigation-drawer react-native-ios

我正在使用react native创建iOSAndroid应用。

我已将react-native-drawer用于导航抽屉。这适用于iOSAndroid

我正在尝试在导航抽屉中获取一个视图寻呼机,以便我可以在导航抽屉中向左/向右滑动,类似于Slack移动应用。

Slack's navigation drawer with view pager

这是我的实施。

Main.js

constructor(props, context) {
    super(props, context);
    this.state = {
      drawerType: 'overlay',
      openDrawerOffset: .15,
      closedDrawerOffset:0,
      panOpenMask: .4,
      panCloseMask: .4,
      relativeDrag: false,
      tweenEasing: 'linear',
      disabled: false,
      tweenHandlerPreset: null,
      acceptDoubleTap: false,
      acceptTap: false,
      acceptPan: true,
      tapToClose: false,
      negotiatePan: false,
      rightSide: false,
    };
 }

...

<Drawer
    ref={c => this.drawer = c}
    type={this.state.drawerType}
    animation={this.state.animation}
    openDrawerOffset={this.state.openDrawerOffset}
    closedDrawerOffset={this.state.closedDrawerOffset}
    panOpenMask={this.state.panOpenMask}
    panCloseMask={this.state.panCloseMask}
    relativeDrag={this.state.relativeDrag}
    panThreshold={this.state.panThreshold}
    content={ <NavigationDrawer/> }
    disabled={this.state.disabled}
    tweenDuration={this.state.tweenDuration}
    tweenEasing={this.state.tweenEasing}
    acceptDoubleTap={this.state.acceptDoubleTap}
    acceptTap={this.state.acceptTap}
    acceptPan={this.state.acceptPan}
    tapToClose={this.state.tapToClose}
    negotiatePan={this.state.negotiatePan}
    changeVal={this.state.changeVal}
    side={this.state.rightSide ? 'right' : 'left'}
    >

    <MainContainer/>

</Drawer>

NavigationDrawer.js

render() {

    let {height, width} = Dimensions.get('window');

    return (
      <View style={styles.controlPanel}>
      <IndicatorViewPager style={ {height: height} } removeClippedSubviews={false} indicator={this._renderDotIndicator()}>
          <View style = {{backgroundColor : 'green'}}></View>
          <View style = {{backgroundColor : 'red'}}></View>
      </IndicatorViewPager>
      </View>
    );
 }

在Android应用中,它按预期工作。但在iOS应用程序中,默认情况下导航抽屉始终处于打开状态。

Screenshot of the iOS app

我在这里缺少什么?

0 个答案:

没有答案