oblador / react-native-animatable

Standard set of easy to use animations and declarative transitions for React Native
MIT License
9.82k stars 701 forks source link

Does not accepts Functional Components #308

Open Uttu316 opened 4 years ago

Uttu316 commented 4 years ago

The createAnimatableComponent does not accept Functional components. It is asking to change the functional component to class component. Solove this Issue.

gunnx commented 4 years ago

Following the guide here: https://dev-yakuza.github.io/en/react-native/react-native-animatable/

get the same Invariant Violation: createAnimatedComponent does not support stateless functional components; use a class component instead.

Lzadhito commented 3 years ago

maybe you can use createAnimatableComponent to the used components first (?)

const SomeComponent = (props) => {
.
.
.
  const AnimatedView = createAnimatableComponent(View);

  const renderWelcomeText = () => (
    <AnimatedView animation="fadeIn">
        <Text style={styles.welcomeText}>Welcome!</Text>
        <Text style={styles.usernameText}>{username}</Text>
    </AnimatedView>
  );
.
.
.
}

export default SomeComponent;