我在FlatList中有ListHeaderComponent,并且在更改状态后,我的ListHeaderComponent并未更改。 这是我的标头组件
<FlatList
horizontal
showsHorizontalScrollIndicator={false}
data={this.state.data}
keyExtractor={(x, i) => i.toString()}
onEndReachedThreshold={0.5}
initialNumToRender={7}
maxToRenderPerBatch={10}
removeClippedSubviews={true}
ListHeaderComponent={this.flatlistHeader}
renderItem={({ item }) =>
<View style={styles.container}>
<TouchableOpacity
activeOpacity={1}
onPress={() => this.changeBackground(item.bg)}
style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}
>
<Image
resizeMode='contain'
source={{ uri: `${item.bg}` }}
style={{ borderRadius: 6, position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}
/>
</TouchableOpacity>
</View>
}
/>
如您所见,我想在观看奖励视频后更改状态。 为什么ListHeaderComponent不更新? 谢谢!
编辑:FlatList组件
$.ajax({
url: "ajax/datatable-adminventas.ajax.php",
method: "GET",
dataType: "json",
data: {fechaInicial: moment().format('YYYY-MM-DD'),
fechaFinal: moment().format('YYYY-MM-DD')},
success: function(respuesta){
console.log(respuesta);
}
});