Search code examples
react-nativereact-native-elements

react-native-elements, help center input text within FormInput


I'm using forms from react-native-elements and would like to center the input text. I've tried, alignSelf: 'center' as well as flex: 1, justifyContent: 'center', alignItems: 'center' without any luck. All text continues to remain left aligned.

a

JFYI, I'm making adjustments to the inputStyle prop.

<FormInput 
  ...
  inputStyle={styles.formInputText}
/>

Solution

  • Try the textAlign attribute

    <FormInput 
      ...
      inputStyle={styles.formInputText}
      textAlign={'center'}
    />
    

    Also, you may want to upgrade your package as it looks like FormInput has been deprecated according to the docs...

    <FormInput /> is only available in v0.19.1 and below. <Input /> is only available in v1.0.0-beta1 and higher.