简体   繁体   中英

Add web view 2 times

I have a question. I want to put 2 webviews in one FlatList and between them I want to put view block. How I can do this? I tried to put flex 1, and it just showed data of the last webview. Help me please

  <FlatList data={this.state.dataSource} ItemSeparatorComponent = {this.FlatListItemSeparator} renderItem={({item}) => <View style={{flex: 1}}> <MyWebView style={{flex: 1}} source={{html: `1` }} /> <View> // here will be block </View> <MyWebView style={{flex: 1}} source={{html: `2` }} /> </View> } keyExtractor={item => item.id} /> 

You need to use flex:1 for between component or give according to your requirement.

  <View style={{flex:1}}>
     <WebView style={{flex:1}}
       source={{`any html code`}}
      />
      <View style={{flex:1}}>
        <Text>{your text}</Text>
       </View>
      <WebView 
        source={{`any html code`}}
       />
   </View>

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