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

Button on backdrop is clickable

Open fasalir opened this issue 4 years ago • 3 comments

How to prevent the user from clicking the button on the backdrop? I want if bottomsheet opened, so user only can interact with bottomsheet content. Thank you

"react": "16.13.1", "react-native": "0.63.4", "reanimated-bottom-sheet": "^1.0.0-alpha.22", "react-native-reanimated": "^1.13.2",

fasalir avatar Jan 22 '21 13:01 fasalir

Nothing about this?

forster007 avatar Apr 03 '21 03:04 forster007

I used <Animated.View> with parameter pointerEvents to handle the backdrop clicks. You can pass undefined value if you want the backdrop to be unclickable, and "none" in the opposite case

import Animated from "react-native-reanimated";

const MyBottomSheet: React.FC = () => {
  const renderBackdrop = () => {
     return (
       <Animated.View
         pointerEvents={isOpened ? undefined : "none"}
         style={{...StyleSheet.absoluteFillObject}}
       />
    );
  };

  return (
    <>
      <BottomSheet
        ...
      />
      {renderBackdrop()}
    </>
  );
}

oramaz avatar Apr 09 '21 16:04 oramaz

I use box-only if bottom-sheet is opened

return (
    <>
      <Animated.View
        pointerEvents={isOpenedBottomSheet ? 'box-only' : 'none'}
        style={[
          styles.shadowContainer,
          {
            opacity: animatedShadowOpacity,
          },
        ]}
      />
      <RNBottomSheet
      ....
       />
    </>
  );

stelmakhivan avatar Apr 14 '21 14:04 stelmakhivan