I have two simple components :
const AddUserInfo = () => {
const scroll = useRef(null)
return (
<View style={ styles.container }>
<View style={ styles.slider }>
<ScrollView
ref={scroll}
horizontal= {true}
snapToInterval= {width}
decelerationRate= "fast"
showsHorizontalScrollIndicator= {false}
bounces= {false}
>
<Animated.View style={{flex: 1, width: width }}>
<Slider1 style={{flex: 4}}/>
<Animated.View style={{flex: 2, justifyContent: 'flex-end', alignItems: 'center'}}>
<TouchableOpacity style={styles.buttonCircle} onPress={() => {
if(scroll.current) {
scroll.current.scrollTo({ x: width, y: 0, animated: true });
}
}}/>
</Animated.View>
</Animated.View>
and this one :
const Slider1 = () => {
const [pseudo, setPseudo] = useState("")
return (
<Animated.View style={{flex: 4}}>
<TextInput
mode="outlined"
value={pseudo}
label="Pseudo"
placeholder="Pseudo"
onChangeText= {(pseudo) => setPseudo(pseudo)}
/>
</Animated.View>
)
}
In order to keep everything clean, they are in different files. What i'm trying to do here is to get the 'pseudo' value from the Slider1 component and being able to use it into the AddUserInfo component.
What is the best way to do it ?
Thanks for your help !