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

Elevation should be 8 #10

Closed
AlexandrePalo opened this issue Jan 21, 2018 · 3 comments
Closed

Elevation should be 8 #10

AlexandrePalo opened this issue Jan 21, 2018 · 3 comments

Comments

@AlexandrePalo
Copy link

AlexandrePalo commented Jan 21, 2018

Hello,

Thanks for your component.
In order to stay consistent, according to the Material guide concerning elevation the elevation should be 8 and not 2 by default.

So, on android:
{ elevation: 8 }

And on IOS:
{ shadowOpacity: 0.192, shadowRadius: 4.32, shadowOffset: { height: 4.8, } }

Moreover, the elevation value should be a props by itself because can be a major styling props to ensure consistency with other UX components. For android, the props is straight forward. For IOS, formulas are:
shadowOpacity: 0.0015 * elevation + 0.18, shadowRadius: 0.54 * elevation, shadowOffset: { height: 0.6 * elevation, }

I can present a PR if you want :)

Bye

@mxck
Copy link
Owner

mxck commented Jan 23, 2018

@AlexandrePalo hi! Yes, you can make PR. 👍

@satya164
Copy link

@AlexandrePalo where did you get the formula?

@Noitidart
Copy link

Noitidart commented Mar 9, 2021

Hello,

Thanks for your component.
In order to stay consistent, according to the Material guide concerning elevation the elevation should be 8 and not 2 by default.

So, on android:
{ elevation: 8 }

And on IOS:
{ shadowOpacity: 0.192, shadowRadius: 4.32, shadowOffset: { height: 4.8, } }

Moreover, the elevation value should be a props by itself because can be a major styling props to ensure consistency with other UX components. For android, the props is straight forward. For IOS, formulas are:
shadowOpacity: 0.0015 * elevation + 0.18, shadowRadius: 0.54 * elevation, shadowOffset: { height: 0.6 * elevation, }

I can present a PR if you want :)

Bye

What is the shadowOffset width? TypeScript saying its required, but in the above its not provided. I think default is width of 0, as it is CGSize - https://github.com/facebook/react-native/blob/fc24bb4af0706e0dc1efde853a365be771728e44/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm#L137 - and SO says CGSize defaults to 0's - https://stackoverflow.com/questions/22081008/default-values-for-cgfloat-cgsize-minfontsize-etc-in-a-wrapper-function#54565507

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

No branches or pull requests

4 participants