Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition for React Native components? #11

Open
athenawisdoms opened this issue Apr 8, 2023 · 0 comments
Open

Transition for React Native components? #11

athenawisdoms opened this issue Apr 8, 2023 · 0 comments

Comments

@athenawisdoms
Copy link

Is it possible to use Motion to animate the transitions of react-native components like TextInput and Pressable?

For example, lets say we have a TextInput component and a Pressablecomponent inside a <View className="flex"> container. TextInput has className="flex-grow" so when the Pressable component is hidden, its width will grow if the Pressable is removed/hidden. How can Motion be used to animate this transition?

Tried the following

import { createMotionComponent } from "@legendapp/motion";
import {
  Pressable,
  TextInput,
} from "react-native";

const AnimatedPressable = createMotionComponent(Pressable);
const AnimatedTextInput = createMotionComponent(TextInput);

...

<View className="flex flex-row ....">
  <AnimatedTextInput/>
  <AnimatedPressable className="flex-grow ...">
    <Something />
  </AnimatedPressable>
</View>

but the console is throwing a warning mesesages like:

WARN measure cannot find view with tag #1839

Packages used:

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant