小编Iva*_*alo的帖子

FlatList 列表项背景颜色

是否可以将 FlatList 的背景颜色设置为透明?

我有应用程序背景图像并想将其用作屏幕背景。

但是FlatList中的ListItem似乎需要设置一些颜色。同样的问题也适用于标题。

    <FlatList
      style={styles.root}
      data={contacts}
      getItemLayout={this.getItemLayout}
      ItemSeparatorComponent={this.renderSeparator}
      keyExtractor={this.extractItemKey}
      renderItem={this.renderItem}
      enableEmptySections />

renderItem = ({ item }) => {
        return (
        <TouchableOpacity onPress={this.onPress}>
          <View style={styles.container}>
            <Avatar type='circle' style={styles.avatar} img={this.getAvatar(image, gender)} />
           <View style={{flexDirection: 'column'}}>
             <Text style={styles.text}>{`${lastName} ${firstName}`}</Text>
             <Text style={styles.phone}>{`${mobilePhone}`}</Text>
           </View>
          </View>
         </TouchableOpacity>
        );
    }
Run Code Online (Sandbox Code Playgroud)

像这里的东西:

在此输入图像描述

javascript reactjs react-native react-native-flatlist

2
推荐指数
1
解决办法
1万
查看次数