I am new to React Native and presently engaged on a easy Todo app. Nonetheless, I am encountering a difficulty associated to gestures. Particularly, I am getting the next error
NativeViewGestureHandler should be used as a descendant of GestureHandlerRootView. In any other case, the gestures won’t be acknowledged.
Here is the related code for my app.
import { useState } from "react";
import { StyleSheet, Textual content, View, FlatList } from "react-native";
export default perform Index() {
const [todos, setTodos] = useState([
{ text: 'buy coffee', key: '1' },
{ text: 'create an app', key: '2' },
{ text: 'play cricket', key: '3' },
]);
return (
<View type={kinds.container}>
<View type={kinds.content material}>
<View type={kinds.checklist}>
<FlatList
information={todos}
renderItem={({ merchandise }) => (
<Textual content>{merchandise.textual content}</Textual content>
)}
/>
</View>
</View>
</View>
);
}
const kinds = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff'
},
content material: {
padding: 40
},
checklist: {
marginTop: 20
}
});
What I’ve tried:
I’ve wrapped my root element in GestureHandlerRootView however the error persists.
I’ve made positive to put in and hyperlink react-native-gesture-handler accurately.
What am I lacking? How can I repair this error and combine gesture handlers correctly in my app?