FaridSafi / react-native-gifted-form

📝 « One React-Native form component to rule them all »
MIT License
1.44k stars 214 forks source link

GiftedForm: SubmitWidget #105

Open pheakdeyyi opened 7 years ago

pheakdeyyi commented 7 years ago

Everything works great as I have it right now. I have a textfield, a googleplace, date selector, and radio slection inside the form. At the bottom, I added the submitWidget, the onSubmit works, I am able to see the eventTitle and eventDate populated but the button itself has a loading bar. How can I stop it?

I'm going to just pass my 4 data elements in State to another component.

GiftedForm.SubmitWidget title="Create" widgetStyles={{ submitButton: { backgroundColor: '#1faadb', }, }} onSubmit={(isValid, values, validationResults, postSubmit = null, modalNavigator = null) => { if (isValid === true) { this.setState({ eventTitle: values.eventTitle }); this.setState({ eventDate: moment(values.eventDate).format('MM-DD-YYYY') }); } }} />

eliasturbay commented 7 years ago

@pheakdeyyi use postSubmit(); to stop it after you have saved or posted your data. Or use postSubmit(['An error occurred, please try again']); if you found an error in the process