react-native - react-native 多选更改选择文本颜色
问题描述
我是 react-native 的新手,我正在尝试将多选组件添加到我的应用程序中,我的代码如下:
<SectionedMultiSelect
items={this.state.days}
uniqueKey="id"
hideSearch={true}
subKey="day"
selectText="Select Days"
selectToggle={{ color: '#f79334' }}
showDropDowns={true}
readOnlyHeadings={true}
onSelectedItemsChange={this.onSelectedItemsChangeHomeRepair}
selectedItems={this.state.selectedDaysHomeRepair}
showChips={false}
theme = {
{
Colors:{
selectToggleTextColor:'#053075',
text:'#053075'
}
}
}
/>
有谁知道如何将颜色应用于“选择日期”文本。谢谢
解决方案
您可以使用该renderSelectText
道具并使用您的自定义样式传递您自己的文本组件。
<SectionedMultiSelect
items={this.state.days}
uniqueKey="id"
hideSearch={true}
subKey="day"
renderSelectText={() => <Text style={{ color: 'red', fontSize: 24 }}>Select Days</Text>}
selectToggle={{ color: '#f79334' }}
showDropDowns={true}
readOnlyHeadings={true}
onSelectedItemsChange={this.onSelectedItemsChangeHomeRepair}
selectedItems={this.state.selectedDaysHomeRepair}
showChips={false}
theme = {
{
Colors: {
selectToggleTextColor:'#053075',
text:'#053075'
}
}
}
/>
看看如何在此处的示例中使用它。
推荐阅读
- java - 如何使用 Apache Commons 解压缩 BZIP(不是 BZIP2)
- xml - 如何在lxml中获取范围内的元素
- azure-functions - Azure 函数/WebJobs 扩展如何注册 http 端点?
- angular - 何时使用@ViewChild、@Input 和@Output?
- powershell - 用于“监视”新文件的目录并移动到新位置的 Powershell 脚本
- java - 调用私有静态 void 方法
- iis - IIS Rewrite 模块不会在第一次加载页面时重定向
- c# - 关闭对话框后无法关注任何控件
- python - 如何获取导致特定总和的 top-x 元素
- r - 在R中的getURL函数中隐藏密码