-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add useNativeDriver to shine animations #134
base: master
Are you sure you want to change the base?
Conversation
inputRange: [START_VALUE, END_VALUE], | ||
outputRange: ["0%", "100%"], | ||
outputRange: ["0%", "250%"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why 250%? 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. The width of the animated view is 40% of the parent. In order to Translate over the whole surface of the parent, we need to Translate with 2.5 of itself meaning 100% of the parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing the following error: https://github.com/facebook/react-native/blob/aee88b6843cea63d6aa0b5879ad6ef9da4701846/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java#L132
Looks like % are not valid as a transform value. See the API here: https://reactnative.dev/docs/transforms#transform and I think this is the reason why I didn't rely on this when implementing, hard times 😅 !
Thank you for the effort on this pull requests 😊 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, this is on Android, right? Hmmm... To be fair, I only tested IOS, which was working. I will look into it, when I have some more time 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep that's on android :)
Any update on this @stoica94 ? |
Make
Shine
andShineOverlay
animations run on the native thread. Related to this issue: #99Only remaining animation on the JS side is
Progressive
.I think this is still possible but I would want to start a discussion regarding this. For using
translateX
as the animated prop you need the width of how much to translate.My attempts at converting
Progressive
were making the animation look different from the initial one because theProgressive
View was the same width on all children (Left, Right or Other Media) therefore translating with50%
would look different on lines of different length and it was not possible to find the width of thePlaceHolderLine
orMedia
to translate only by that, as the Animation Consumer was put inside the View and not on the outside.Example
In the picture above, I translated the
AnimatedView
with-20%
, as you can see, in the Left and Right media, this shows a progress of50%
because the View is translated by20%
of its own width.A possible solution would be to define the
AnimationConsumer
inside thePlaceholderLine
andPlaceholderMedia
so that you can pass through that context anonLayout
function that can get the width of the parent.I considered that to be a bit too much of a reimplementation, but that would solve the problem. If you give the alright for that, I would provide a different PR with this.
Until then, here is
Shine
andShineOverlay
😄