I have a Pressable with a Text inside and i want to change the color of the text when the pressable is pressed (it is ok for Pressable's backgourndcolor but not for Text) I tried something like :
<Pressable
style={({ pressed }) => [
{
backgroundColor: pressed
? colors.PRIMARY_COLOR_DARK
: colors.MAIN_BACKGROUND,
},
styles.playVideosButton,
]}
onPress={() => console.log("Dossier")}>
{({ pressed }) => {
<Text
style={[
{
color: pressed
? colors.WHITE_TEXT
: colors.PRIMARY_COLOR_DARK,
},
styles.buttonText,
]}>
Lancer les vidéos
</Text>;
}}
</Pressable>
With this code Text desappears
Apologies after more thorough testing the original script worked - as long as there are no color changes inside styles.buttonText.