Recently, I embarked on a journey to learn React Native iOS by following a tutorial from raywenderlich.
The versions I am currently using are:
react-native-cli: 2.0.1
react-native: 0.60.5
While working on the Adding Navigation Section, I encountered the following errors:
"you likely forgot to export your component from the file it's defined in and you might have mixed up with default and named imports"
Below is a snippet of my App.js code:
'use strict';
import React, { Component } from 'react';
import { StyleSheet, Text, NavigatorIOS, View } from 'react-native';
class SearchPage extends Component<{}> {
render() {
return <Text style={styles.description}>Search for houses to buy!
</Text>;
}
}
class App extends Component<{}> {
render() {
return (
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'Property Finder',
component: SearchPage,
}}/>
);
}
}
const styles = StyleSheet.create({
description: {
fontSize: 18,
textAlign: 'center',
color: '#656565',
marginTop: 65,
},
container: {
flex: 1,
},
});
export default App;
Code from Index.js file:
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
If anyone can help me identify what I am doing wrong, I would greatly appreciate it! Thank you in advance!