小编Utk*_*mir的帖子

React Native Paper Text Input - 调整初始状态下的标签颜色

我想在初始状态(不是 onFocus)调整概述的react-native-paper TextInput 标签颜色。这是我的 OutlinedInput 组件:

import * as React from 'react';
import { TextInput } from 'react-native-paper';

const OutlinedInput = (props) => {
  return (
    <TextInput
      mode='outlined'
      label={props.label}
      placeholder={props.placeholder}
      placeholderTextColor='white'
      secureTextEntry={props.secureTextEntry}
      multiline={props.multiline}
      keyboardType={props.keyboardType}
      value={props.value}
      onChangeText={(value) => props.onChangeText(value)}
      style={props.style}
      theme={props.theme}
    />
  );
};

export default OutlinedInput;
Run Code Online (Sandbox Code Playgroud)

在我的 Register 组件中,我在其中创建了一个 OutlinedInput 组件:

<View style={{ justifyContent: 'center', alignItems: 'center' }}>
  <OutlinedInput
    label={'User Name'}
    value={userName}
    onChangeText={(userName) => setUserName(userName)}
    style={{ color: 'white', backgroundColor: 'rgb(35,39,42)',
            borderRadius: 5, width: '75%', height: '5%' 
    }}
    theme={{ colors: { …
Run Code Online (Sandbox Code Playgroud)

label textinput react-native react-native-paper

5
推荐指数
1
解决办法
6764
查看次数

React Material UI ListItem 单击

我想创建一个国家/地区列表,其中的 ListItems 是可单击的,并且每个 ListItem 在单击时在文本附近都有一个图标。我创建了一个列表并实现了列表的可点击属性。但是,当我单击列表中的一个列表项时,我无法一次性选择其他项目,它首先取消选择前一个项目,然后选择另一个项目。这是我的实现中包含的代码部分:

\n
class CountryList extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {clicked: false};\n    this.handleClick = this.handleClick.bind(this);\n  }\n\n  handleClick() {\n    this.setState(state => ({\n      clicked: !state.clicked\n    }));\n  }\n\n  render()\xc2\xa0{\n    const {classes} = this.props;\n    const { clicked } = this.state;\n\n    let listItems = myList.map((item) =>\n      <>\n        <ListItem className={ clicked ? classes.listItemClicked : classes.listItemNotClicked }\n          onClick={this.handleClick} classes={classes.ListItem} button key={item.id}>\n        \n            {clicked ? \n            <ListItemIcon><DoneIcon style={{ color: \'rgb(239, 239, 239)\', fontSize: \'2.2rem\' }}/></ListItemIcon>\n           : <ListItemIcon><DoneIcon style={{ display: \'none\', color: \'rgb(239, …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs material-ui

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