axelra-ag / react-native-animateable-text

🆎 A fork of React Native's <Text/> component that supports Animated Values!
https://www.npmjs.com/package/react-native-animateable-text
MIT License
360 stars 27 forks source link

Reanimated 2 example #14

Closed radko93 closed 3 years ago

radko93 commented 3 years ago

Hi, thanks for working on this library. I was trying to make it work on with Reanimated 2 but I failed.

const [num, setNum] = useState(0);

  const text = useSharedValue(num);

  const animatedText = useDerivedValue(() => `Hello ${text.value}`);
  const animatedProps = useAnimatedProps(() => {
    return {
      text: animatedText.value,
    };
  });

return (
    <Animated.View style={[styles.container, style]}>
      <Touchable onPress={() => setNum(10)} rippleColor={colors.green[700]}>
        <ContentContainer>
          <ButtonIcon name="plus" />
          <AnimateableText
            animatedProps={animatedProps}
            // same other props as Text component
          />
        </ContentContainer>
      </Touchable>
    </Animated.View>
  );

Anything I'm missing. When pressing the touchable the text does not change.

Karthik-B-06 commented 1 month ago

@radko93 were you able to fix this? The onPress is not triggered for me as well