代码之家  ›  专栏  ›  技术社区  ›  Filipe José

React Native TextInput-失去焦点后移动到输入的开头

  •  0
  • Filipe José  · 技术社区  · 1 年前

    当组件失去焦点时,我很难将TextInput配置为始终从头显示输入值。

    我有这个:

    current

    我想要这个:

    objective

    这是我的组件:

    export function TextInputField(props: TextInputFieldProps): React.JSX.Element {
        return (
            <View style={{...ModalStyles.inputContainer, width: props.width}}>
                <Text style={ModalStyles.inputLabel}>{props.text}</Text>
                <View style={getTextInputStyle(props)}>
                    <TextInput style={ModalStyles.textInputField}/>
                </View>
            </View>
        )
    }
    

    我正在安卓系统中测试。

    我试着设置 selection 如这里所建议的: How do I make a TextInput show the start of the entered text instead of the end in Android? ,但没有成功。

    0 回复  |  直到 1 年前
    推荐文章