question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't change mainOverlay opacity in tweenHandler

See original GitHub issue

I want the main content to go dark when the drawer is open by setting the mainOverlay background to black and opacity to 0 and in tweenHandler tried to change the opacity but it doesn’t seem to work:

<Drawer
        ref="navigation"
        type="displace"
        content={<SideMenu />}
        tapToClose={true}
        openDrawerOffset={0.2}
        panCloseMask={0.2}
        styles={{mainOverlay: {backgroundColor: '#000000', opacity: 0}}}
        negotiatePan={true}
        tweenHandler={(ratio) => ({
          mainOverlay: { opacity: ( ratio / 2 )}
        })}
      >

Is this a bug or am I doing it wrong?

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
garrettblandcommented, Sep 20, 2016

Don’t know if anyone is still needing help, but I figured out how to make the area behind the drawer go darker with opacity.

tweenHandler={(ratio) => ({ mainOverlay:{ backgroundColor:"rgba(71, 71, 71,"+ (ratio)/1.5+")"}, })}

I just used rgba (which is supported by react native. Runs on both iOS and Android) and used the ratio to control the opacity. Hope that helps! @rt2zz @Qizly

0reactions
roseniltonreiscommented, Jun 8, 2017

@garrettbland Thank you very much 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make a mainOverlay customizable thru the tweenHandler #113
I have a case where I need to change a color of the overlay, but currently I can change a background color of...
Read more >
Can't change overlay color and opacity in fancybox 2.1.4
I edited the overlay parameters in the helper file that was included in demo.html but I can't get it to work. I've looked...
Read more >
Background Overlay Opacity Issues - WordPress.org
Why is it so painfully impossible to remove the background overlay?! CSS does not help. Server cache has been cleared multiple times. body...
Read more >
Layer opacity and blending modes in Adobe Photoshop
Learn how to use layer opacity and blending modes in Adobe Photoshop ... such as Inner Glow or Color Overlay, without changing layer...
Read more >
Background Image Overlay Opacity in Squarespace 7.1 ...
In this tutorial, I'm going to walk you through changing the background overlay opacity of a section. Here is the exact code I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found