从导航栏

时间:2017-10-23 19:47:23

标签: react-native react-navigation

我有一个React Native应用程序,它使用react-navigation在嵌套导航器中嵌套了一个堆栈导航器。我正在下面显示的屏幕上工作。

enter image description here

我希望能够从导航栏向下滑动并显示搜索菜单​​。我已经使用绝对定位向下放置了向下箭头并添加了一个平移响应器,但是平底响应器没有检测到任何内容。

检测导航栏上的向下滑动操作的最佳方法是什么?

编辑:这里要求的是我已经尝试过的代码: AppContainer.js:

export const MainNavigator = DrawerNavigator(
{
    ScreensStack: {screen: ScreensStack},
},
{
    drawerWidth: 235,
    drawerPosition: 'right',
    contentComponent: (props) => (
        <Drawer
            navigation = {props.navigation}
        />
    ),
}

);

export default class AppContainer extends React.Component {

render() {
    return (
        <View style = {{flex: 1}}>
            <SlideDownMenuHandle2 />
            <MainNavigator />
        </View>
    );
}

}

SlideDownMenuHandle2:

导出默认类SlideDownMenuHandle2扩展了React.Component {

render() {
    return (
        <Image
            style = {slideDownMenuStyles2.image}
            source = {Navigation.NAVIGATION_IMAGES.DOWN_ARROW_ICON_ORANGE}
        /> 
    );
}


componentWillMount() {
    this.panResponder = PanResponder.create(
        {
            onStartShouldSetPanResponder: () => {console.log('onStartShouldSetPanResponder'); return true;},

            onMoveShouldSetPanResponder: () => {console.log('onMoveShouldSetPanResponder'); return true;},

            onPanResponderMove: this.handlePanResponderMove.bind(this),
            onPanResponderRelease: this.handlePanResponderEnd.bind(this),
            onPanResponderTerminate: this.handlePanResponderEnd.bind(this),
            onPanResponderStart: this.handlePanResponderStart.bind(this),
        }
    );
}


handlePanResponderStart(e, gestureState) {
    console.log('START');
}


handlePanResponderMove(e, gestureState) {
    console.log('MOVE');
}


handlePanResponderEnd(e, gestureState) {
    console.log('END');
}

}

0 个答案:

没有答案