fateh999/react-native-paper-form-builder

Set Default Value on TextInput

Closed this issue · 1 comments

Hi, I faced a problem where I cannot set a default value to the TextInput.

  <FormBuilder
        control={control}
        setFocus={setFocus}
        formConfigArray={[
          {
            name: 'text',
            type: 'text',
            defaultValue: 'erererere',   <-- not working
            rules: {
              required: {
                value: true,
                message: 'Name is required',
              },
            },
            textInputProps: {
             text: '123'
            },
          },
        ]}
      />

Any idea what I had done wrongly? Thanks in advanced!

You can use useForm({
defaultValues:{
text: 'some value'
}
});