When executing the code below in the expo app, it works however with the following warning message: Warning: Failed child context type: Invalid child context virtualizedCell.cellKey
of type number
supplied to CellRenderer
, expected string
.
import React, { Component } from 'react'
import {
Text,
View,
StyleSheet
} from 'react-native'
import List from './src/components/List'
export default class App extends Component {
render () {
return (
<View style={[{flex: 1}, styles.container]}>
<List />
</View>
)
}
}
const styles = StyleSheet.create({
container: {
backgroundColor: 'black'
}
})
.........
class List extends Component {
_renderItem(item) {
return (
<Image style={{width: 120, height: 180}} source={{uri: item.image}} />
)
}
_renderItem(item) {
return (
<Image style={{width: 120, height: 180}} source={{uri: item.image}} />
)
}
render () {
return (
<View style={{flex: 1}}>
<View>
<Text style={styles.text}>My List</Text>
<FlatList
horizontal
ItemSeparatorComponent ={() => <View style={{width: 5}}/>}
renderItem={({item}) => this._renderItem(item)}
data={shows_first}
/>
</View>
<View>
<Text style={styles.text}>Top Picks For You</Text>
<FlatList
horizontal
ItemSeparatorComponent ={() => <View style={{width: 5}}/>}
renderItem={({item}) => this._renderItem(item)}
data={shows_second}
/>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
text: {
color: 'white'
}
})
export default List