如何在React-native中将图像用于下拉列表?

问题描述

我想知道是否可以用图标/图像之类的文件替换“句号”行吗?也许不包含此软件包,但无论如何。简而言之,我想用图像替换下划线文本。我找不到任何可以做的...谢谢您的帮助

我有这个:

enter image description here

当我单击它时,会给我这个信息:

enter image description here

使用此代码

<View style={[styles.centeredView,{marginTop:0}]}>
              <MaterialDropdown
                label={i18n.t("mytrips.date.date")}
                data={data_dropdown}
                baseColor="#212121"
                labelFontSize={17}
                textColor="#212121"
                itemColor="#212121"
                selectedItemColor="#000"
                backgroundColor="transparent"
                pickerStyle={styles.dropdownPickerStyle}
                affixTextStyle={{ fontFamily: "FunctionLH" }}
                itemTextStyle={{ fontFamily: "FunctionLH" }}
                labelTextStyle={{ fontFamily: "FunctionLH" }}
                containerStyle={[styles.dropdownContainerStyle,{borderWidth: 0}]}
                itemCount={10}
                dropdownPosition={-4.5}
                labelExtractor={({ label }) => label}
                valueExtractor={({ value }) => value}
                propsExtractor={({ props },index) => props}
                onChangeText={(value) => this.choiceAction(value)}
                useNativeDriver={true}
                  </View>}
              />
            </View>

解决方法

在放置了材料的同一个容器中,制作另一个Image元素并将其设为绝对

<View>
   ....
   <MaterialDropDown ......
   <Image style={{position:'absolute',right:16,top:0,bottom:0} source={{your_drop_down_image}/>