question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Elevation inside a FlatList doesn't work

See original GitHub issue

Is 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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

6reactions
ahmedcs2600commented, Feb 6, 2018

give margin to renderItem View…

0reactions
ChandniSharmacommented, Nov 4, 2018

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 simulator screen shot - iphone x - 2018-11-04 at 10 57 03

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found