The same issue was already solved in several posts, but non of them helped me (I'm new to React Native, so possibly there is a solution, but I can't find it)
My code uses route and screen. App.js:
import React from 'react';
import { StackNavigator } from 'react-navigation';
import HomeScreen from './screens/HomeScreen.js';
const App = StackNavigator({
Home: { screen: HomeScreen }
});
HomeScreen.js:
import React, { Component } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default class HomeScreen extends Component {
onPressLearnMore() {
}
render() {
return (
<View style={styles.container}>
<Button title="Learn More" onPress={() => this.onPressLearnMore()} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
What is wrong?
The project structure:
