react-native: shadow props of parent shouldn't inherit to children element...
Issue Description
take a look at this screenshot…
take a look at row3
text… it inherit shadow props from parent component <View />
…
Steps to Reproduce / Code Snippets
<View
key={id}
style={styles.box}
shadowOffset={{height: 10}}
shadowColor='black'
shadowOpacity={0.5}
>
<Text style={styles.text}>{title}</Text>
</View>
Expected Results
shadow props of parent shouldn’t inherit to children element…
Additional Information
- React Native version: latest
- Platform(s) (iOS, Android, or both?): ios
- Operating System (macOS, Linux, or Windows?): mac
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 17 (2 by maintainers)
Same here.
edit: Found a “fix” for my use case. The trick is to set a background color to the component on which you set the shadow. In the top example that would be:
Unfortunately this only works with coloured backgrounds – when setting a transparent background with RGBA or ‘transparent’ is doesn’t help.
@ericnakagawa I can reproduce this with transparent or RBGA backgrounds on my view using RN 0.43.4
Can we re-open this issue? On React-Native 0.55.0 and experiencing this bug as well.
Can we reopen this? Child element still seem to inherit their parent’s shadows.
Please re-open this issue. I am experiencing this on 0.55.2 . Thankfully @sanderfish provided a temporary fix.