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

Overlay

Open noelzappy opened this issue 3 years ago • 2 comments
trafficstars

Is it possible to add a transparent overlay to the screen when the Bottom Sheet is open to a particular snap point?

noelzappy avatar Nov 26 '21 08:11 noelzappy

https://github.com/osdnk/react-native-reanimated-bottom-sheet/blob/master/Example/src/screen/AppleMusic.tsx#L51

let fall = new Animated.Value(1)

https://github.com/osdnk/react-native-reanimated-bottom-sheet/blob/master/Example/src/screen/AppleMusic.tsx#L65-L69

const animatedHeaderContentOpacity = Animated.interpolate(fall, {
  inputRange: [0.75, 1],
  outputRange: [0, 1],
  extrapolate: Animated.Extrapolate.CLAMP,
})

https://github.com/osdnk/react-native-reanimated-bottom-sheet/blob/master/Example/src/screen/AppleMusic.tsx#L202-L219

const renderShadow = () => {
  // `react-native-reanimated` v2: Animated.interpolateNode
  const animatedShadowOpacity = Animated.interpolate(fall, {
    inputRange: [0, 1],
    outputRange: [0.5, 0],
  })

  return (
    <AnimatedView
      pointerEvents="none"
      style={[
        styles.shadowContainer,
        {
          opacity: animatedShadowOpacity,
        },
      ]}
    />
  )
}

https://github.com/osdnk/react-native-reanimated-bottom-sheet/blob/master/Example/src/screen/AppleMusic.tsx#L293

<BottomSheet
      ...
      callbackNode={fall}
      ...
/>
{renderShadow()}

patlux avatar Dec 01 '21 09:12 patlux

thanks needed an overlay as well!

JamieGarcia123 avatar Jan 13 '22 16:01 JamieGarcia123