简体   繁体   中英

react-native : horizontal scrollview won't work inside flatlist

I have a horizontal scrollview inside my flatlist but it won't scroll.

renderRow = ({ item }) => {   
 return (
  <View style={{width:'100%', backgroundColor:'transparent'}}>
 <ScrollView horizontal={true}>
  //I have multiple images here      
 </ScrollView>
 </View>

      )
    }

This is my flatlist

<FlatList
           keyExtractor={(item, index) => index.toString()}
           data={this.state.data}
           renderItem={this.renderRow}
         />

is it possible to put horizontal scrollview inside flatlist?

Try to add style width:100% in ScrollView

<ScrollView horizontal={true} style={{width:'100%'}}>
  //I have multiple images here      
 </ScrollView>

You can try somethig like this:

<ScrollView horizontal={true} style={{flex: 1}}>
  //Place Mutiple image in ScrollView.    
 </ScrollView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM