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

View elevation results in shadow growing longer for Android #20501

Closed
SupriyaKalghatgi opened this issue Aug 2, 2018 · 11 comments
Closed

View elevation results in shadow growing longer for Android #20501

SupriyaKalghatgi opened this issue Aug 2, 2018 · 11 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@SupriyaKalghatgi
Copy link

SupriyaKalghatgi commented Aug 2, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 28.73 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 23.0.1, 26.0.1, 26.0.3
API Levels: 23, 26
IDEs:
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1

Description

The shadow grows for each subsequent view. Happens only on Android

Reproducible Demo

<View style={{ padding: 5}}>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
  <View style={{elevation: 3, marginBottom: 15, borderWidth: 0.5, borderColor: '#ccc' }}><Text>Text</Text></View>
</View>

image

Snack URL: https://snack.expo.io/HJLli4eS7

@SupriyaKalghatgi
Copy link
Author

@hramos Any fix for this? Its been more than a month

@SupriyaKalghatgi
Copy link
Author

#20792

@hramos
Copy link
Contributor

hramos commented Sep 24, 2018

@SupriyaKalghatgi do you have a pull request that fixes this?

@SupriyaKalghatgi
Copy link
Author

nope

@krakz999
Copy link

krakz999 commented Oct 9, 2018

It works as intended. Material design elevation uses 2 type of lights, a key light (imagine it as the sun) and ambient light, which results in a combined lighting. The farther the object from the key light, the larger the shadow grows because of the virtual distance from the key light.

https://material.io/design/environment/light-shadows.html#

If you need a custom shadow, I recommend creating an own solution using react-native-svg or 9 patch.

@paour
Copy link

paour commented Oct 10, 2018

@krakz999 if that were the case, a single tall card would have the same shadow as the last in a series of cards. Scrolling would also dynamically change the shadows.

@paour
Copy link

paour commented Oct 10, 2018

And indeed they do!

@mjmasn
Copy link
Contributor

mjmasn commented Oct 12, 2018

@krakz999 but don't the two animations at the bottom of that page contradict that?

When a surface changes shape or scale, but its elevation remains the same, its shadow should not change

Don't really see it as a problem, just noticed the increasing shadow side as I scrolled some items in a list and was curious as to whether it was intentional or not.

@dagatsoin
Copy link

@SupriyaKalghatgi have you any idea of why there are "shadow corners" in each View ? I manage to make dissapear when setting height and width. But it seems very weird.

@stale
Copy link

stale bot commented Aug 2, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 2, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Aug 9, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

7 participants