I receive the following error:
Error: React.Children.only expected to receive a single React element child.
When I use the 'TouchableWithoutFeedback' component with ReactNative:
return (
<TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();}}>
<View style={styles.container}>
<Header />
<Exercises exercises={exercises} handleChange={handleChange} handlePress={handlePress} exercise={exercise}/>
</View>
` </TouchableWithoutFeedback>
);
I am not sure why because everything is wrapper in a View component. Any advice?
Try wrapping the content of View
with a react fragment:
return (
<TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();}}>
<View style={styles.container}>
<>
<Header />
<Exercises exercises={exercises} handleChange={handleChange} handlePress={handlePress} exercise={exercise}/>
</>
</View>
` </TouchableWithoutFeedback>
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.