useStableCallback causing troubles in New Architecture #2009
pavel-krasnov
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am developing a New Architecture app and trying to use this library. I noticed that when I use the
BottomSheetScrollView
component, theonContentSizeChange
callback is not called. A short investigation led me to how this callback is passed to the underlying React NativeScrollView
component. It is done using theuseStableCallback
hook, which is intended to not cause rerenders when the callback reference changes. Also I noticed the comment which was left two years after @gorhom had implemented the hook in this library saying that you probably don't need to useuseEffect
to update the callback reference. This appers to be so true - looks like by the time theuseEffect
is called, the New Architecture version of theonContentSizeChange
has been already called and thus the callback, which was undefined in the time of calling, couldn't be called. I replaceduseEffect
with simply settings the ref value in the hook body and everything started to work.So I would like to ask you for an opinion if such a change can be introduced to the library any time soon.
Beta Was this translation helpful? Give feedback.
All reactions