[Android] Elevation inside a FlatList doesn't work
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 8.6.0 Yarn: 1.1.0 npm: 5.4.2 Watchman: 4.9.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: 2.3 AI-162.3871768
Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.1 => 0.49.1
Target Platform: Android 8.0.0/7.0.0
Steps to Reproduce
Having a shadow inside a flat list(in footerComponent, headerComponent, emptyListComponent and Item) using elevation for android shows nothing, while using shadow props for iOS works perfectly.
Expected Behavior
There should be a shadow in android.
Actual Behavior
No shadow is shown.
Reproducible Demo
renderItem = ({ item }) => {
return (
<View style={{
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 1.5,
elevation: 3,
borderWidth: 1,
borderColor: '#ccc',
flex: 1,
height: 42,
backgroundColor: '#fff',
}} />
);
}
render() {
return (
<FlatList
data={this.props.data}
keyExtractor={item => item.id}
renderItem={this.renderItem}
/>
);
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:7
Top Results From Across the Web
React Native elevation StyleSheet not working in FlatList
Most issues like this are caused by styling that is applied to your surrounding view or the row that you are trying to...
Read more >Displaying a List in React Native: Map Method or FlatList ...
FlatList is a React Native component that only loads items that are currently visible on the screen and it deletes items as they...
Read more >FlatList - React Native
A performant interface for rendering basic, flat lists, supporting the most handy features:
Read more >8 ways to optimize React native FlatList performance
2. Don't use 1080P HD images in the list ... It is a known issue that android can't handle 1080P HD images in...
Read more >React Native (Android) doesn't render overflow styles… |
To start, this is how I solved this issue. It may not be the best way or the right way, but it solved...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
give margin to renderItem View…
I am using flatlist and it give shadow to all contents of my view that is text inside views … Please suggest what should i do