我有一个FlatList的问题,我无法滚动我的列表......这是块,我的列表足够滚动
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反应原生:0.49.3
SomeOne可以帮助我吗?
1 回答
FlatList忽略具有相同键的值 . 我发现玩了一下之后 . 最有可能的问题不是滚动没有启用,而是你有相似的值 .
您能否尝试确保密钥在所有列表中都是唯一的?
如果没有,请与问题小吃