-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
[v4] BottomSheetContainerComponent fails to set containerOffset on app reopen after backButton dismiss #1292
Labels
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
This fix worked for us too |
@gorhom can you add this fix please? |
VictorPulzz
referenced
this issue
Sep 26, 2023
Fix worked, please add it to the project. |
Same here. Worked with that fix. 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug
When an app is dismissed via back button and is not cleared from recently opened apps and relaunched again by clicking an app shortcut, it FCs with an error "TypeError: Cannot add new property 'value'" in
BottomSheetContainer.js
. It appears that the containerOffset by the time it reopens is not a sharedValue, but a default objectINITIAL_CONTAINER_OFFSET
becauseuseReactiveShearedValue.ts@46
returns it as is in the first ever render cycle:when it comes to being added a value in
BottomSheetContainer>handleContainerLayout
it has the following shape :So react throws error for trying to mutate it:
The solution would be to validate it's a SharedValue before trying to set it or change the mechanism of useReactiveSharedValue. And please do avoid casting as it's masking a problem.
Environment info
Steps To Reproduce
Describe what you expected to happen:
Fix
components/bottomSheetContainer/BottomSheetContainer.tsx
:const handleContainerLayout = useCallback( function handleContainerLayout({ nativeEvent: { layout: { height }, }, }: LayoutChangeEvent) { containerHeight.value = height; containerRef.current?.measure( (_x, _y, _width, _height, _pageX, pageY) => { + if(!containerOffset.value) return; containerOffset.value = { top: pageY, left: 0, right: 0, bottom: Math.max( 0, WINDOW_HEIGHT - (pageY + height + (StatusBar.currentHeight ?? 0)) ), }; } ); print({ component: BottomSheetContainer.displayName, method: 'handleContainerLayout', params: { height, }, }); }, [containerHeight, containerOffset, containerRef] );
patch-package patch
Reproducible sample code
none
The text was updated successfully, but these errors were encountered: