FlatList react native

I have a problem with FlatList, I can't scroll my list ... It's block, and my list is enough fat for scrolling

const tab_ad = [
    {"id": 0, "Price": 100000, "key": 0},
    {"id": 1, "Price": 100000, "key": 1},
    {"id": 2, "Price": 100000, "key": 2},
    {"id": 3, "Price": 100000, "key": 0},
    {"id": 4, "Price": 100000, "key": 1},
    {"id": 5, "Price": 100000, "key": 2},
    {"id": 6, "Price": 100000, "key": 0},
    {"id": 7, "Price": 100000, "key": 1},
    {"id": 8, "Price": 100000, "key": 2},   
]

export default class Event extends Component {
renderItem(item) {
        return (
            <Image source={path_default_picture} style={{width: 50, height: 50, margin: 5}}/>
        );
    }

render() {
    return (
        <View style={{flex: 1}}>
            <FlatList
                horizontal
                data={tab_ad}
                renderItem={(item) => this.renderItem(item)}
                keyExtractor={(item, index) => index}
             />
         </View>
    );
}

react-native-cli: 2.0.1 react-native: 0.49.3

SomeOne can help me ?

FlatList ignores the values that have the same key. I found that after playing a little bit. Most likely the issue is not that the scroll is not enabled but that you have similar values.

Could you please try making sure the key is unique across all the list?

If not, please make a snack with the issue

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue