Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay #372

Open
noelzappy opened this issue Nov 26, 2021 · 2 comments
Open

Overlay #372

noelzappy opened this issue Nov 26, 2021 · 2 comments

Comments

@noelzappy
Copy link

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

@patlux
Copy link

patlux commented Dec 1, 2021

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()}

@JamieGarcia123
Copy link

thanks needed an overlay as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants