'TypeError: ‘undefined’ is not an object (evaluating)
I'm started react-native tutorial on youtube, and I get error this one.
TypeError: ‘undefined’ is not an object
This is File it is showing from:
<Touchable>
<Image
source={require(‘../assets/badalboupic.jpg)} />
<Text >
TafTun AutoMechanics
<Text />
</Touchable>
Please help. Thank You!
Solution 1:[1]
This Occurs in Safari: when you read a property or call a method on an undefined object .Initialize state with reasonable default values in the constructor. –
Solution 2:[2]
It should be like this :
<TouchableWithoutFeedback>
<>
<Image source={require('../assets/badalboupic.jpg')} />
<Text >TafTun AutoMechanics</Text>
</>
</TouchableWithoutFeedback>
- You missed a quote in your
Imagesource - In react native,forward slashes are placed before words in closing tags,not after
- You have to choose between a
TouchableWithoutFeedback,TouchableOpacity,TouchableHighlightor aPressableelement.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | zpodavay |
| Solution 2 |
