-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature request: whileHover and whileTap props #1
Comments
Thanks @vbylen! Yes, that would great to have, and I think should be fairly easy to add. Would you like to submit a PR to add one or both of those? whileTap should be very straightforward, but would you expect whileHover to only work in react-native-web? |
Actually I changed my mind, I'll add |
Ok done, I added I'll leave the issue open for adding |
That was exceptionally quick 💯 In regards to the Luckily for us the one and only @nandorojo has figured out all off this stuff already. So we could go based off these files from hoverable.tsx And then incorporating them in From there it should be just a simple matter of following the same procedure that was used to add the Does this sound good to you? |
@vbylen Added in 1.3.1. I looked at those solutions and did some experimenting, and it seems like it's as easy as adding onMouseEnter/onMouseLeave to the Pressable. I tested with nesting and it seems to work just fine. Do you see any scenarios where it's not working right? |
there are cases where opening a modal or clicking something doesn’t fire onMouseLeave. That’s why moti also sets hover to false when you click a different element |
Gotcha, ok. Thanks @nandorojo. I'll test for that and try to fix it. |
Hi there @jmeistrich, just discovered this library and looks like a great stuff! I immediately look for how to do interaction with this, and amazingly already covered with |
Good point! I will look into passing the Pressable props through. |
Hi guys, I'm not sure I understand how to use this prop in a react native component with a touchable ? Thanks, Théo |
@jmeistrich yes I also thought that, since interactions in react-native have their specific components. I looked at
|
@panjiesw After some experimenting I think requiring using a separate I'm experimenting now with adding a prop named |
I don’t recommend trying to hack interactables into every component. RN just wasn’t built that way like the Web.
https://twitter.com/fernandotherojo/status/1523493591988928513?s=21&t=BZSO0ix-oOoov6xFCG7vZg I find the container component to be a necessary piece of interaction animations. However, it’s untenable for a View to have a wrapper everywhere. That’s why I recommend splitting the Pressable into its own component. |
@jmeistrich that could work too I think. @nandorojo comment above also shed light to me regarding interactables, might worth a consideration |
Yes you're right @nandorojo. I've been doing mostly web development recently so I was thinking too much like web. In version 2.0.0 I added a Motion.Pressable. <Motion.Pressable>
<Motion.View
whileHover={{ scale: 1.2 }}
whileTap={{ y: 20 }}
/>
</Motion.Pressable> |
Just a little update: I am leaving this open until this is fixed:
I have not had a chance to investigate and find a broken case in action yet. If this is bothering anyone and you can help provide a repo that reproduces that bug I will fix it. Or a PR with a fix works too :). |
Hi Jay,
Congratulations on hitting it out of the ballpark with
legend-motion
.One of my favorite features from
framer-motion
are thewhileTap
andwhileHover
props.Is this something you would consider adding too?
Thanks!
The text was updated successfully, but these errors were encountered: