【问题标题】:How to change the selected item style?如何更改所选项目的样式?
【发布时间】:2020-09-17 08:26:38
【问题描述】:

我使用“react-native-material-dropdown”中的 MaterialDropdown,它工作正常,但我想更改所选项目的样式以使其更加可见。 我使用 selectedItemColor 将其设为黑色,但我想将其设为粗体并加下划线...我不知道 "selectedItemStyle" 是如何不起作用的:

             <MaterialDropdown
                data={data_dropdown}
                // pickerStyle={styles.dropdownPickerStyle}
                affixTextStyle={{ fontFamily: "FunctionLH" }}
                itemTextStyle={{ fontFamily: "FunctionLH" }}
                selectedItemStyle={{fontWeight: 'bold', textDecorationLine: 'underline'}}
                selectedItemColor='rgb(0, 0, 0)'
                containerStyle={[styles.dropdownContainerStyle, {opacity: 0}]}
                itemCount={10}
                dropdownPosition={-4.5}
                dropdownOffset={{top: 32, left: 5 }}
                underlineColor='transparent'
                labelExtractor={({ label }) => label}
                valueExtractor={({ value }) => value}
                //propsExtractor={({ props }, index) => props}
                propsExtractor={({value, index}) => { return (value === '*' ? {style: 
                               {borderBottomColor: '#D1D1D1', borderBottomWidth: 1, paddingTop: 5}} : 
                               {style: {}}) }}
                onChangeText={(value) => this.choiceAction(value)}
                useNativeDriver={true}
              />

【问题讨论】:

标签: react-native dropdown selecteditem


【解决方案1】:

通过查看source-code,不支持 selectedItemStyle 作为 react-native-material-dropdown 中的道具。您必须提出拉取请求。

【讨论】:

  • 感谢您抽出宝贵时间回答。我在github问的问题,嗯,我真的不知道怎么做pull request...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-29
  • 2020-01-18
  • 1970-01-01
  • 2020-03-28
相关资源
最近更新 更多