react-native-bottom-sheet: [v4] TypeError: Cannot convert undefined value to object
Bug
Our App is a production application in the app store, and it’s working fine. but as soon as I updated the react-native-reanimated to the new version, this error happened.
I am not sure if this is related to react-native-reanimated or this library. because all of the other libraries depend on react-native-reanimated are working fine, I am posting this bug report here
LOG new Route: myHouses
ERROR TypeError: Cannot convert undefined value to object
This error is located at:
in AnimatedComponent(View)
in Unknown (created by BottomSheetHandleComponent)
in BottomSheetHandleComponent (created by BottomSheetHandleContainerComponent)
in RCTView (created by View)
in View (created by AnimatedComponent(View))
in AnimatedComponent(View)
in Unknown (created by PanGestureHandler)
in PanGestureHandler (created by BottomSheetHandleContainerComponent)
in BottomSheetHandleContainerComponent (created by BottomSheet)
...
in AppContainer
in appName(RootComponent), js engine: hermes
Error located in
// createAnimatedComponente.tsx (123)
function hasInlineStyles(style: StyleProps): boolean {
return Object.keys(style).some((key) => {
const styleValue = style[key];
return (
isSharedValue(styleValue) ||
(key === 'transform' && isInlineStyleTransform(styleValue))
);
});
}
Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.4.5 |
| react-native | 0.70.7 |
| react-native-reanimated | 3.0.0 |
| react-native-gesture-handler | 2.9.0 |
Steps To Reproduce
- update to
react-native-reanimatedto3.0.0
Describe what you expected to happen:
- Work without any error
Reproducible sample code
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 16
I am using this patch to fix the problem
Looks like this was fixed with release of reanimated 3.0.1 - with this commit https://github.com/software-mansion/react-native-reanimated/commit/e2a5454145ea62ff8ae61be34a21d604b18c8ed1
@mcnaveen Yeah, I found the problem. It seems like
hasInlineStylesreceiving undefined styles. I assign default empty styles in thereact-native-bottom-sheetand it fixes the problem temporarily. but problem is coming from thereact-native-reanimatedand they should fix itthe only way to solve the problem was to modify the code slightly
on file createAnimatedComponent.tsx
find extractSharedValuesMapFromProps replace For
and remove errors of _removeShadowNodeFromRegistry(viewTag);
and that’s it, I hope it helps, it worked for me.