从一开始显示字符串React Native TextInput

时间:2019-11-01 15:05:25

标签: react-native native-base

显示TextInput中的值时出现问题,当前显示的是字符串的最后一部分。即,给定以下字符串1 - This is a pretty long string,它显示的是ong string而不是1 - This is

我尝试通过selection作为道具,但无法按预期工作。仅在再次聚焦输入时才“容纳”字符串。

selection={{start:0, end:0}}

PS:我不想截断字符串,只是显示开始。

这是我的输入(这是NativeBase的输入,但它确实具有与ReactNative的TextInput相同的道具)

        <Input
          ref={getRef}
          testID={`input-${testID}`}
          value={value}
          placeholder={placeholder}
          onChangeText={onChangeText}
          style={styles.input}//this styling is only for fontSize/color
          onFocus={onFocus}
          onBlur={onBlur}
          keyboardType={keyboardType}
          maxLength={maxLength}
          disabled={disabled}
        />

0 个答案:

没有答案