Invariant Violation: Invariant Violation: Element type is invalid: expected a string (for built-in components) but got: undefined

Invariant Violation: Invariant Violation: Element type is invalid: expected a string (for built-in components) but got: undefined



I'm getting the above error while i'm trying to run my application.



This is the error that pops up when I hover the mouse over the open bracket of render () in App.js file.
Here is the Screenshot



Edit: Added codes



App.js


import React from 'react';
import StyleSheet, Text, View from 'react-native';

import StackNavigator from 'react-navigation';
import Login from 'apps/components/Login';

const NavigationApp = StackNavigator(
Home: screen: Login
,,
navigationOptions:
header: false,


);

export default class App extends React.Component
render()
return (
<NavigationApp />
);




Login.js


import React from 'react';
import StyleSheet, Text, View, TextInput, AsyncStorage,
ToacheableOpacity,KeyboardAvoidingView from 'react-native';
import StackNavigator from 'react-navigation';

export default class Login extends React.Component
constructor (props)
super(props);
this.state=
username:'',
password:'',



componentDidMount()
this._loadInitialState().done();


_loadInitialState = async () =>
var value= await AsyncStorage.getItem('user');
if (value != null)
this.props.navigation.navigate('profile');



render()
return (
<KeyboardAvoidingView behavior='padding' style=styles.wrapper>
<View style=styles.container>
<TextInput style=styles.textInput
placeholder='Usuario' onChangeText=(username)=> this.setState(username)/>

<TextInput style=styles.textInput
placeholder='Clave' onChangeText=(password)=> this.setState(password)/>

<ToacheableOpacity>
style=styles.button onPressthis.login
<Text style=styles.buttonText>Iniciar Seccion</Text>
</ToacheableOpacity>
</View>
</KeyboardAvoidingView>
);


login = () =>
fetch('https://wb382.com/api/mobile/login.php',
method: 'post',
headers:
'Accept': 'application/json',
'Content-Type': 'application/json',
,
body: JSON.Stringify(
username: this.state.usersame,
password: this.state.password,
)
)

.then((response)=>response.json())
.then((res)=>
if (res.success===true)
AsyncStorage.setItem('user',res.user);
this.props.navigation.navigate('profile')
else
alert(res.message);

)



const styles = StyleSheet.create(
wrapper:
flex: 1,
,
container:
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#000',
paddingLeft: 40,
paddingRight: 40,
,
buttonText:
fontSize: 26,
color: '#fff',
,
textInput:
alignSelf: 'stretch',
padding: 16,
marginBotton: 20,
backgroundColor: '#fff',
,
button:
alignSelf: 'stretch',
backgroundColor: '#1fd100',
padding: 20,
alignItems: 'center',

);



I don't know which of these file is producding the error.



To simulate these codes, I'm also hosting my codes at expo.io



https://snack.expo.io/@wilson382/my-first-mobile-app





add your code, not the code image please
– Arup Rakshit
Sep 4 '18 at 20:59




1 Answer
1



Login component has an error in "ToacheableOpacity". In import statement and render method both are wrong written. It is TouchableOpacity. I've edited your demo code, and changing to the right name fixed the error.





thank you so much, that was hard to catch for me.
– wilson382
Sep 5 '18 at 3:30



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)