leecade / leecade/react-native-swiper

Swiper as ListHeaderComponent in FlatList not rendering any image or text

Open
#469 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

I am trying to pass swiper as the header for a FlatList. My code work when i remove "" and "". But i want to have swiper imcluded so that i can also swipe between images and make this swiper scroll up when the flatList is scrolled up

  <View>
            <FlatList
                   data = {this.state.mainImages}
                   renderItem = {({item}) => <View><Text>{item.image_slot_id}</Text></View>}
                   KeyExtractor={item => item.imgid}
                   ListHeaderComponent = {() => <RenderImages ImageDetails = {this.state.mainImages}/>}
             />
  </View>

class RenderImages extends React.Component {
constructor(props){
	super(props)
}

renderImagesSwipper() {
	return(
		this.props.ImageDetails.map(function(imgs){
			return(
				<View>
					<Image
						style={{height: 100}}
      					source={{uri: imgs.imgs_url}}
      				/>
				</View>
			)
		})
	)
}

render(){
	return(
	<View style={{height:200, width:400}}>
			<Swiper loop={false} index={0}>
				{this.renderImagesSwipper()}
			</Swiper>
	</View>
	)
}
}

export default RenderImages;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example using FlatList's ListHeaderComponent, RenderImages, and the Swiper wrapper shown in the issue. Check whether the header renders its mapped Image and Text children, then verify the intended behavior: the images can be swiped and the header moves with the FlatList. No test or source file is named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.