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

[iOS] Not working when open is called inside useEffect

Open MFrat opened this issue 4 years ago • 1 comments

When called inside a useEffect and in iOS, open function does not works properly. In Android works just fine.

  const refRBSheet = useRef();

  useEffect(() => {
    if (signInError) {
      refRBSheet.current.open();
    }
  });

MFrat avatar Sep 06 '20 16:09 MFrat

I solved it by putting a setTimeout and leaving the useEffect dependencies empty

useEffect(() => {

    if (signInError) {
      setTimeout(() => {
        refRBSheet.current.open();
      }, 200)
    }

}, []);

giacomete-nuvem avatar Sep 15 '20 21:09 giacomete-nuvem

Any fix?

muzammil-kt avatar Feb 06 '23 05:02 muzammil-kt