Skip to content

Conversation

@muttli
Copy link
Contributor

@muttli muttli commented Jun 6, 2019

Purpose

Remove the forced 70% opacity overlay to allow more flexibility - for instance if you want 90% instead.

Use

When declaring overlay background, you could feed it rgba(255, 255, 255, 0.9) to achieve a white overlay that is only slightly transparent.

@osdnk
Copy link
Contributor

osdnk commented Jul 7, 2019

@Famousfrank
Thanks! Can you tell sth more about these changes? Maybe attach some screenshot or snack?

@muttli
Copy link
Contributor Author

muttli commented Jul 8, 2019

@osdnk currently, If I supply a flat black background color to the overlay

<DrawerLayout
  drawerPosition={DrawerLayout.positions.Right}
  overlayColor="rgba(0, 0, 0, 1)"
  drawerType="slide"
  renderNavigationView={ ... }
>
  {props.children}
</DrawerLayout>

The result will be that the overlay has a black background color with a 70% opacity.

If I supply rgba(0, 0, 0, 5) the result will be an overlay with 35% opacity because of the 0.7 multiplier.

My suggestion is to remove the 0.7 setting (set it to 1), to allow people to set the background color themselves. For instance, if I want a red background at 90% opacity, I can just give rgba(255, 0, 0, 0.9) to the overlay and it will be red 90% opacity.

Given to the plugin: rgba(255, 0, 0, 1) (solid red color) with the force 0.7 opacity multiplier in place.
70opacity

Given to the plugin: rgba(255, 0, 0, 0.9) (red at 90% opacity) with the force 0.7 opacity multiplier removed:
90opacity

The red is to make it even more clear what is happening. In my case I need a white 90% overlay, and while I can live with 70%, being able to set it at 90% will just make it a bit nicer.

@muttli
Copy link
Contributor Author

muttli commented Jul 8, 2019

Tried to illustrate it better with this image:

Group 2

Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please take a look at my inline comment?

Also, this seem to be a relatively small change and I'd prefer to keep such changes backward compatible. One suggestion would be to change default color from black to rgba(0,0,0,0.7) (semitransparent black) which should yield a similar end effect unless you set overlayColor which I think is much less frequent.

const overlayOpacity = this._openValue.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.7],
outputRange: [0, 1],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if there is point in interpolating [0,1] to [0,1]. Would see this only making sense if we support overshooting (such that _openValue is greater than 1) but I don't think we do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, this is just used for the animation right? This is basically what forced the 70% opacity. If the goal would be to allow people to define their own overlay background (even solids) this needs to be 1. Am I misunderstanding something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this seem to be a relatively small change and I'd prefer to keep such changes backward compatible. One suggestion would be to change default color from black to rgba(0,0,0,0.7) (semitransparent black) which should yield a similar end effect unless you set overlayColor which I think is much less frequent.

Good point! Updated the default color.

Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks 🙌

@kmagiera kmagiera merged commit 0f31a2f into software-mansion:master Jul 29, 2019
jordmccord pushed a commit to jordmccord/react-native-gesture-handler that referenced this pull request Sep 18, 2019
…n#629)

## Purpose

Remove the forced 70% opacity overlay to allow more flexibility - for instance if you want 90% instead.

## Use

When declaring overlay background, you could feed it `rgba(255, 255, 255, 0.9)` to achieve a white overlay that is only slightly transparent.

(cherry picked from commit 0f31a2f)
janicduplessis pushed a commit to janicduplessis/react-native-gesture-handler that referenced this pull request Feb 16, 2020
…n#629)

## Purpose

Remove the forced 70% opacity overlay to allow more flexibility - for instance if you want 90% instead.

## Use

When declaring overlay background, you could feed it `rgba(255, 255, 255, 0.9)` to achieve a white overlay that is only slightly transparent.
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

Successfully merging this pull request may close these issues.

3 participants