leecade / leecade/react-native-swiper
Image cannot show when used with Flatlist as ListHeaderComponent
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Which OS ?
It cannot show image in Android , but ios is not problem
Version
Which versions are you using:
- react-native-swiper v?
- react-native v0.?.?
"react-native-swiper": "1.5.13",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
In my app,used TabNavigator:
const Tabs = TabNavigator({
HomeModuleCMPT: {
screen: HomeModuleCMPT,
navigationOptions: {
tabBarLabel: 'Home',
tabBarIcon: ({tintColor}) => (<Image source={require('./../../../resource/mainModule/home.png')}
style={[{tintColor: tintColor},styles.icon]}/>),
}
},
in the HomeModuleCMPT, use FlatList:
<FlatList
ref={(flatList)=>this.flatList=flatList}
renderItem={this._renderItem}
keyExtractor={this._keyExtractor}
data={data}
ListHeaderComponent={this._header}
getItemLayout={(data,index)=>(
{length: ITEM_HEIGHT, offset: (ITEM_HEIGHT+2) * index, index}
)}
_header = () => {
return <Swiper
horizontal = {true}
showsPagination={false}
loadMinimal
loadMinimalSize={1}
loop={true}
autoplay={this.props.autoplay}
style={styles.swiper}
height={styles.swiper.height}
autoplayTimeout={2}
dot={}
activeDot={}
>
{
this.state.slideList.map((item, i) =>
this.renderItem(item, i)
)
}
;
}
renderItem(item, i) {
return (
<TouchableOpacity style={styles.imageWrap} activeOpacity={0.5} onPress={()=>this.onPress(i)} key={i}>
<CustomCachedImage
component={Image}
indicator={Progress.Bar}
style={styles.image} source={{uri: item.image}}/>
)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Android case using FlatList with Swiper as ListHeaderComponent and the reported React Native and react-native-swiper versions. Start at the FlatList/ListHeaderComponent and Swiper integration points, then compare Android and iOS image rendering. Done means the header images display correctly on Android without breaking the existing iOS behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100