如何在 React-native 中使用图像作为下拉菜单?
How to use an image for a dropdown in React-native?
我想知道是否可以用 icon/image 之类的文件替换行 'periods' ?也许不是这个包,但无论如何。简而言之,我想用图像替换下划线文本。我找不到任何可以做的...感谢您的帮助
我有这个:
当我点击它时,它会给我这个:
使用此代码:
<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>
在您有 material 下拉菜单的同一个容器中制作另一个图像元素并使其成为绝对元素
<View>
....
<MaterialDropDown ......
<Image style={{position:'absolute',right:16, top:0,bottom:0} source={{your_drop_down_image}/>
我想知道是否可以用 icon/image 之类的文件替换行 'periods' ?也许不是这个包,但无论如何。简而言之,我想用图像替换下划线文本。我找不到任何可以做的...感谢您的帮助
我有这个:
当我点击它时,它会给我这个:
使用此代码:
<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>
在您有 material 下拉菜单的同一个容器中制作另一个图像元素并使其成为绝对元素
<View>
....
<MaterialDropDown ......
<Image style={{position:'absolute',right:16, top:0,bottom:0} source={{your_drop_down_image}/>