Я использую Native v0.58.3 и не могу заставить работать навигацию.
Кажется, я не могу понять, почему она не работает, и я не могу найтиошибка при отладке и просмотре документов.Я получаю сообщение об ошибке:
null не является объектом (оценка 'rngesturehandlermodule.state')
при запуске этого кода:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen';
import {Platform, StyleSheet, Text, View, Image, ScrollView, Navigator, Button, TouchableOpacity, borderRadius} from 'react-native';
import {createStackNavigator, createAppNavigator} from 'react-navigation';
import TimeLine from './Screens/TimeLine';
import Home from './Screens/Home';
const RootStack = createStackNavigator(
{
Home: { screen: Home },
TimeLine: { screen: TimeLine },
},
{
initialRouteName: 'Home',
}
);
type Props = {};
export default class App extends Component<Props> {
render() {
return <RootStack />;
}
}
import React, {Component} from 'react';
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen';
import {Platform, StyleSheet, Text, View, Image, ScrollView, Navigator, Button, TouchableOpacity, borderRadius} from 'react-native';
import {createStackNavigator, createAppNavigator, StackNavigator} from 'react-navigation';
const styles = StyleSheet.create({
container: {flex: 1},
Button: {
backgroundColor: '#992632',
marginTop: hp('6.665%'),
marginBottom: hp('6,665%'),
marginRight: wp('4%'),
marginLeft: wp('4%'),
height: hp('20%'),
borderRadius: 150,
}
});
export class Home extends Component {
render() {
return (
<View style={{
backgroundColor: '#0a6ca3',
height: hp('100%'),
}}>
<TouchableOpacity
onPress={() => this.props.navigation.navigate('TimeLine')}
style={styles.Button}>
<Text style = {{fontSize: 75, color: 'white', textAlign: 'center', marginTop: hp('4.5%')}}> Tidslinje </Text>
</TouchableOpacity>
<TouchableOpacity
onPress={function(){
console.log('Rasmus')
}}
style={styles.Button}>
<Text style = {{fontSize: 75, color: 'white', textAlign: 'center', marginTop: hp('4.5%')}}> Diskussion </Text>
</TouchableOpacity>
<TouchableOpacity
onPress={function(){
console.log('Rasmus')
}}
style={styles.Button}>
<Text style = {{fontSize: 75, color: 'white', textAlign: 'center', marginTop: hp('4.5%')}}> Demokrati </Text>
</TouchableOpacity>
</View>
)
}
}
export default Home;