4

我正在使用本机反应来创建一个iOSAndroid应用程序。

我已经为我的导航抽屉使用了react-native- drawer。这在iOS和中都可以正常工作Android

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

Slack 带有视图寻呼机的导航抽屉

这是我的实现。

主.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 应用程序中,导航抽屉始终默认打开。

iOS 应用程序的屏幕截图

我在这里想念什么?

4

0 回答 0