Aquí quiero establecer el nombre del estado del componente principal del componente secundario mientras está en CHangeText, pero me da "TypeError: setName no es una función. (En 'setName (texto)', 'setName' no está definido)" error
Aquí está mi componente principal
const ProfileCreationScreen = () => { const [name, setName] = useState() const userSignup = async () => { try { firestore().collection('users').doc("androiduser_mobile89").set({ name: name, }); alert("Succesfully Created") } catch (error) { alert(error); } }; return ( <SafeAreaView> <Text>Create your account</Text> <Button mode="contained" onPress={() => userSignup()}> Sign Up </Button> <View style={{ display: "none" }}> <NameScreen setName={setName} /> </View> </SafeAreaView> ) }Aquí está mi componente hijo
export const NameScreen = ({ setName, navigation }) => { return ( <KeyboardAvoidingView enabled behavior="padding" style={styles.container}> <View> <Text style={styles.text}>Full Name</Text> <TextInput style={styles.textField} label="Enter your Full Name" underlineColor="#FF0074" outlineColor="red" value={text} onChangeText={(text) => setName(text)} /> <Button mode="contained" style={styles.btn} onPress={() => alert(text)}> Next </Button> </View> </KeyboardAvoidingView> );