react-native-gifted-form
react-native-gifted-form copied to clipboard
How do you populate a form?
Great form library. I was wondering how you go about populating the form with initial values? Say that I want to use the form as an "edit" form. I don't see a clear way to populate the form with initial values. Thanks for the help!
Hello, you can use the defaults prop
defaults={{
username: 'Farid',
'gender{M}': true,
password: 'abcdefg',
country: 'FR',
birthday: new Date(((new Date()).getFullYear() - 18)+''),
}}
Ah yes I see that now. Awesome, thanks again.
You are welcome. I keep this issue open to help people to find this information until I improve docs
@FaridSafi -> It is possible to fetch a rest api and a populate a form?
defaults={{ username: api.name, }}
...
?
I have the same doubt @andrebassi and @FaridSafi.
Form is not populating while using rest Api. Only it populate based on the initial value.
Que : How to populate the form using REST Api?