react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

v4 | Not working with Reanimate v3 | Cannot read property toString of undefined

Open rado196 opened this issue 3 years ago • 9 comments

Bug

I'm using React Native with Fabric, and for fabric, I need to install react-native-reanimated ^3.0.0-rc.0 to get it to work,

Environment info

Library Version
@gorhom/bottom-sheet 4.4.2
react-native 0.69.1
react-native-reanimated 3.0.0-rc.0
react-native-gesture-handler 2.5.0

Steps To Reproduce

It happened when the screen with BottomSheet is rendered.

Reproducible sample code

import styles from './styles';
import React, { forwardRef, useCallback, useEffect, useRef } from 'react';
import { View } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';

const SwipeableModal = forwardRef(function (
  { children, points = ['25%', '50%'] },
  ref
) {
  const refModal = useRef();

  const onChange = useCallback((index) => {
    console.log('SwipeableModal.onChange: ', index);
  }, []);

  useEffect(() => {
    ref.current = {
      open: () => refModal.current?.snapToIndex(1),
      close: () => refModal.current?.close(),
    };
  }, []);

  return (
    <View style={styles.container}>
      <BottomSheet
        ref={refModal}
        enablePanDownToClose={true}
        snapPoints={points}
        index={1}
        onChange={onChange}
      >
        {children}
      </BottomSheet>
    </View>
  );
});

export default SwipeableModal;

Simulator Screen Shot - iPhone 13 - 2022-07-15 at 18 49 44

rado196 avatar Jul 15 '22 15:07 rado196

Observing same issue with Reanimated 2.8.0 (Expo) on web.

hirvesh avatar Jul 21 '22 14:07 hirvesh

I am also experiencing this issue when using Expo on the web. Any guidance would be much appreciated. Thanks!

gmiller1763 avatar Aug 04 '22 22:08 gmiller1763

I think you need to somehow extend your webpack.config.js to also run react-native-reaanimated/plugin on @gorhom/bottom-sheet . See my solution for bare project here https://github.com/software-mansion/react-native-reanimated/issues/2994#issuecomment-1211247103

RobertSasak avatar Aug 10 '22 20:08 RobertSasak

Observing same issue with Reanimated 2.8.0

tanlucvo avatar Aug 11 '22 18:08 tanlucvo

does this lib even support for the web, i found nothing on the doc

Albert-Gao avatar Aug 15 '22 23:08 Albert-Gao

does this lib even support for the web, i found nothing on the doc

It seems to be the case https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support/

devalnor avatar Aug 16 '22 09:08 devalnor

@devalnor thanks, got it now, so it depends on reanimated, if reanimated supports, than this lib supports :D

Albert-Gao avatar Aug 16 '22 10:08 Albert-Gao

import BottomSheet from '@gorhom/bottom-sheet/src'; import like this fixes the issue. it seems metro issue

numandev1 avatar Aug 25 '22 07:08 numandev1

I get this error too on web for Expo web using reanimated 2.10.0 and I have added the required snippet for web support.

createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: ["@gorhom"],
      },
    },
    argv,
  );

scottmas avatar Aug 31 '22 04:08 scottmas

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.

github-actions[bot] avatar Sep 30 '22 09:09 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Oct 06 '22 09:10 github-actions[bot]

Hi @gorhom , Simulator Screen Shot - iPhone 12 mini - 2023-03-06 at 15 40 56

Can't install reanimated v3 with Bottom Sheet v4

anisurrahman072 avatar Mar 06 '23 09:03 anisurrahman072

same issue as above 👆👆👆👆👆

kaiyes avatar Mar 06 '23 10:03 kaiyes

Can't install reanimated v3 with Bottom Sheet v4 Facing the same issue!

vdr-mm-quan avatar Jul 28 '23 08:07 vdr-mm-quan

import BottomSheet from '@gorhom/bottom-sheet/src'; import like this fixes the issue. it seems metro issue

This worked for me! Upgraded to expo SKD 49 and react reanimated 3.3.0 caused sheet not to open at all, now it works again

Sofronijev avatar Aug 05 '23 20:08 Sofronijev