Skip to content
Discussion options

You must be logged in to vote

Hey @peterjskaltsis!

It seems that we currently don't support dynamic styles on animated components. What can you do instead is passing the function as a child property, leaving the pressable component unstyled and styling the child Animated.View like I did here:

<Pressable>
  {({ pressed }) => (
    <Animated.View
      style={{
        backgroundColor: pressed ? 'green' : 'red',
        transitionDuration: '200ms', // add this if you want a CSS transition
        padding: 12,
        borderWidth: 1,
        borderColor: 'white',
      }}>
      <Text>No styles?</Text>
    </Animated.View>
  )}
</Pressable>

And thank you for asking about that. It seems that we should implement the dedica…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MatiPl01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants