react-native-bottom-sheet: [v4] Cannot read property toString of undefined
Bug
After upgrading from 4 to 4.1.5 I get this error message: Cannot read property toString of undefined
.
Tried to debug a bit and it seems like in utils.js
there is one exported function below:
// builds one big hash from multiple worklets' hashes
export function buildWorkletsHash(handlers) {
return Object.values(handlers).reduce((acc, worklet) =>
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
acc + worklet.__workletHash.toString(), '');
}
worklet.__workletHash.toString()
seems to be undefined for me. Console logging worklet.__workletHash
gives me [Function onEnd]
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 4.1.5 |
react-native | 0.66.4 |
react-native-reanimated | 2.3.1 |
react-native-gesture-handler | 2.2.0 |
Steps To Reproduce
- Current version 4
- Upgrade to 4.1.5
Describe what you expected to happen:
- Eveything to work out of the box as with the prev installed version
Reproducible sample code
Please note that everything was working out just perfect until I decided to upgrade the package. I understand this might not be an issue with the lib itself so I will appreciate any ideas and hints on how to debug further to find out what the issue is.
Thanks
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 15
- Comments: 33
Commits related to this issue
- Handle SequenceExpression in babel transform (#3531) ## Description Handle function invocations created via sequence (comma) expressions. E.g. `(0, _reactNativeReanimated.useAnimatedGestureHandler... — committed to software-mansion/react-native-reanimated by scottmas 2 years ago
- Handle SequenceExpression in babel transform (#3531) ## Description Handle function invocations created via sequence (comma) expressions. E.g. `(0, _reactNativeReanimated.useAnimatedGestureHandler... — committed to wordpress-mobile/react-native-reanimated by scottmas 2 years ago
Any update on this…??
Thanks! This fixed it for me. Did add the plugin before but needed to clear the cache too.
I’m getting this too on the web
Edit: Try this: https://github.com/gorhom/react-native-bottom-sheet/issues/11#issuecomment-916025454
Worked for me
import BottomSheet from '@gorhom/bottom-sheet/src';
import like this fixes the issueIf you scrolled a little you would have seen the non-expo solution: https://github.com/gorhom/react-native-bottom-sheet/issues/11#issuecomment-1012062676
Got the same error in Jest. Fixed that and a few other errors with the following mock
@vtrrsl yes I made it work for the new apollo version. the problem is the config apollo provided is not working well for RN.
Here is how I fixed it:
Hope it helps you
Still seeing this - none of these solutions worked.
I just installed this package following the instructions here and tried adding the
BottomSheet
component following the tutorial here and I immediately got this error… Can we please get an official fix for this because I am unable to use this library and it’s great and I’d really like to use it.Hi @thespacemanatee I tried the non-expo solution but isn’t working either. Is it expected to work for react native mobile as the issue you pointed me to is solving it for RN web?
I couldn’t make it work. I cannot completely remove metro.config.js because I use NX and svg-transformer. Nx is a monorepo and does path resolution base on tsconfigs. no ide how to make it work, tried all possible solutions even excluding svg-transformer with no luck
Yes this fix, but typescript validation is broken
ofc don’t forget to clear the metro cache