我是使用
以下是我的代码:
这段代码输出的结果如下所示:
当输入框获得焦点时,它会变成如下所示:
我需要去掉TextInput底部的边框,请问有什么办法可以做到吗?
编辑01
有趣的是,如果我这样做:
然后,我得到了以下输出:但我只想修改底部边框的颜色,并保持尖尖的颜色不变。谢谢!最初的回答。
react-native
和react-native-paper
技术。以下是我的代码:
import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import { Button, TextInput } from 'react-native-paper';
export default class Header extends Component {
state = {
text: '',
};
render() {
return (
<View style={styles.container}>
<TextInput value={this.state.text} style={styles.input} />
<Button mode="contained" style={styles.button}>Add Todo</Button>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'stretch',
height: 40,
},
input: {
flex: 1,
height: 40,
justifyContent: "center",
},
button: {
flex: 0,
height: 40,
justifyContent: "center",
backgroundColor: "#54c084",
},
});
这段代码输出的结果如下所示:
![enter image description here](https://istack.dev59.com/7BSzs.webp)
![enter image description here](https://istack.dev59.com/pYIRx.webp)
编辑01
有趣的是,如果我这样做:
<TextInput value={this.state.text} style={styles.input} theme={{ colors: {primary: "#f00"} }} />
然后,我得到了以下输出:但我只想修改底部边框的颜色,并保持尖尖的颜色不变。谢谢!最初的回答。