-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Composer - add animated bottom border #4325
Conversation
Your Render PR Server URL is https://social-app-pr-4325.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cpemirkf7o1s739kf090. |
|
const onScrollViewLayout = useCallback( | ||
(evt: LayoutChangeEvent) => { | ||
runOnUI(showHideBottomBorder)({ | ||
newScrollViewHeight: evt.nativeEvent.layout.height, | ||
}) | ||
}, | ||
[showHideBottomBorder], | ||
) |
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.
In these cases, the preferred method seems to be to just update the SharedValue
from this callback, and make hasScrolledBottom
a derived value with useDerivedValue
. Makes it a little easier and lets us avoid the showHideBottomBorder
function all together.
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.
fwiw i remember bumping into issues with useDerivedValue in the past and having to rewrite those but i don’t remember why. so just worth checking that it works well if we switch it
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.
ooo, yea do check then. it shouldn't necessarily matter since either from the JS thread is async so if this is more reliable it seems fine, unsure if the suggestion in their docs is just for code cleanliness or if there's some other reason as well.
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 didn't see a way to derive a value from multiple inputs?
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.
Should just be able to use it like so, and the returned value will update once one or multiple of the shared values changes
const hasScrolledBottom = useDerivedValue(() => {
return withTiming(
contentHeight.value - contentOffset.value > scrollViewHeight.value ? 1 : 0,
)
})
Ahh! The I think if we floor the |
Simulator.Screen.Recording.-.iPhone.15.-.2024-06-03.at.09.38.08.mp4