Closed CptMaumau closed 2 years ago
@computerjazz would it be possible to add something like onPageWillChange
? So that I can update my value before the pager starts a new render.
At the individual page level you can listen to animated values passed to your PageComponent
: https://github.com/computerjazz/react-native-infinite-pager/blob/main/src/index.tsx#L308-L310
You could use pageAnim
or focusAnim
in a useAnimatedReaction
to trigger some side effect when the values pass some threshold (maybe using Math,round()
).
Or pass in a pageCallbackNode
and do the same thing at the parent level: https://github.com/computerjazz/react-native-infinite-pager/blob/main/src/index.tsx#L47
It works!! Thank you for the feedback!
Hi, I'm trying to update a value in
onPageChange
so it matches the current page but the new value renders really late. From my tests I think it's due to my update being queued behind all the pages rendering, any idea how I could improve this? The value has to be outside the pager.