React native 使用边框和始终聚焦的方式响应本机文本输入

React native 使用边框和始终聚焦的方式响应本机文本输入,react-native,React Native,我正在尝试实现这种类型的文本输入,有人知道如何实现吗?您可以创建这样的自定义输入,您必须切换到道具,目前我已经硬编码了值 const CustomTextInput = () => { return ( <View style={{ paddingTop: 10 }}> <Text style={{ position: 'absolute', top: 0, left: 1


我正在尝试实现这种类型的文本输入,有人知道如何实现吗?

您可以创建这样的自定义输入,您必须切换到道具,目前我已经硬编码了值

const CustomTextInput = () => {
  return (
    <View style={{ paddingTop: 10 }}>
      <Text
        style={{
          position: 'absolute',
          top: 0,
          left: 10,
          zIndex: 100,
          backgroundColor: 'white',
          paddingHorizontal: 20,
        }}>
        Phone
      </Text>
      <View
        style={{
          borderWidth: 1,
          borderColor: 'red',
          flexDirection: 'row',
          borderRadius: 10,
          paddingHorizontal:5,
          paddingTop: 5,
        }}>
        <AntDesign
          name="star"
          size={20}
          color="black"
          style={{ marginRight: 5 }}
        />
        <TextInput value="12313" />
      </View>
    </View>
  );
};
constCustomTextInput=()=>{
返回(
电话

您可以随意更改样式

你可以尝尝这里的小吃

您尝试过任何代码吗?您必须使用包装器进行一些自定义样式。您所说的始终聚焦是什么意思?是的,我尝试过react native paper TextInput,但在这里我无法更改边框颜色和边框宽度Try react native TextInput effects和react native material TextField您可以更改react native paper的颜色使用“最小边界半径”、“边界宽度”和“边界颜色”对我来说总是很有用