我无法使用本机ScrollView进行水平滚动。此外,我正在尝试触发onScroll上的导航。基本上我想要实现的是每当我滚动或拉动屏幕上的按钮时导航。我做错了什么?
MyFullCode:
import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Text,
ScrollView,
Button,
View
} from 'react-native'
import { StackNavigator } from 'react-navigation'
import Slider from 'react-native-slider'
class Home extends Component{
static navigationOptions = {
title:'Home'
};
render(){
return(
<View style={styles.container}>
<Text>Home</Text>
<ScrollView
onScroll={() => this.props.navigation.navigate("Login")}>
>
<Button
title="Login"
</Button>
</ScrollView>
</View>
)
}
}
class Login extends Component{
static navigationOptions = {
title:'Login'
};
render(){
return(
<View>
<Text>home</Text>
</View>
)
}
}
const App = StackNavigator({
Home:{ screen: Home},
Login:{ screen:Login}
});
var styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
Button:{
}
});
export default App