I have encountered this problem on "Expected a Component class, Got [object Object]". I have lookup all the related problems on Stack, I have followed most of them by Capitalising my objects but the same errors occurred. Some great pointers would be appreciated.
this is my App.js file
import React from 'react';
import { StyleSheet, AppRegistry, Text, View } from 'react-native';
import Login from "./Login";
export default class App extends React.Component {
render() {
return (
<Login />
);
}
}
and my Login.js file
import React from 'react';
import{
StyleSheet,
View,
Text,
Image,
touchableOpacity,
TextInput,
KeyboardAvoidingView
} from 'react-native';
export default class Login extends React.Component{
render(){
return(
<KeyboardAvoidingView
behavior="padding"
style={styles.container}>
<View style={styles.logoContainer}>
</View>
<View style={styles.formContainer}>
<TextInput
underlineColor="transparent"
placeholder="Email"
returnKeyType="next"
keyboardType="email-address"
onSubmitEditing={()=> this.passwordInput.focus()}
style={styles.input}/>
<TextInput
underlineColor="transparent"
placeholder="Password"
secureTextEntry
returnKeyType="go"
ref={(input) => this.passwordInput = input}
style={styles.input}/>
<touchableOpacity
style={styles.buttonContainer}>
<Text style={styles.textButton}>Login</Text>
</touchableOpacity>
</View>
</KeyboardAvoidingView>
);
}
}
It returns an error of Expected a component class, got [object Object]
Thanks in advance. It is either I'm too blind to see my mistake or I did it completely wrong.
Found the bug, I just need to capitalize my components. touchableOpacity
--> TouchableOpacity
Thanks to Andrew Li