React Native ios - 更改TextInput填充不起作用

时间:2017-08-25 07:28:30

标签: react-native

我想在TextInput时更改onFocus()的填充,但我失败了。有谁知道为什么?

以下是我的代码。

constructor(props) {
    super(props);
    this.state = {
        textInputStyle: {
            paddingLeft: 0,
        }
    };
};

setPadding = () => {
this.setState({
    textInputStyle: {
        paddingLeft: 40,
        }
    })
};

render() {
    return (
               <TextInput
                   style={this.state.textInputStyle}
                   onFocus={this.setPadding}
                />
    );
};

This is the screenShot

0 个答案:

没有答案