FaridSafi / react-native-gifted-form

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

Programmatic Submit #99

Closed sambwest closed 7 years ago

sambwest commented 7 years ago

Hi @cooperka,

Glad to see someone is taking control of this repo. Any chance I can get the following merged in?

1) Moved error generation to GiftedManager so that the form may be submitted programmatically

// submit action
() => {
    var validationResults = GiftedFormManager.validate(this._form.props.formName);
    if (validationResults.isValid) {
        // do processing
        return;
    }

    // get the generation errors
    var errors = GiftedFormManager.getValidationErrors(validationResults);

    // update the form's state with the errors
     this._form.setState({errors});
}

2) Exposed the google places response details in GooglePlacesWidget

This is just to give access to the underlying response as there are elements I personally required and there is no halm in exposing them.

cooperka commented 7 years ago

Hi @sambwest, thanks for the PR, this looks great! I'll just need to test it before merging of course, which will hopefully be this weekend if I can make the time. I've got it on my to-do list.

sambwest commented 7 years ago

Thanks @cooperka!

cooperka commented 7 years ago

FYI I removed your second commit (da999c3, suppress keyboardShouldPersistTaps error) and manually added it to master. It's out of the scope of this PR so I wanted to separate them. Thanks for that as well!

cooperka commented 7 years ago

Wait a minute... that's the opposite of what we want! I've reverted that commit now. The latest version of React Native expects 'always', not true.

cooperka commented 7 years ago

To be clear, this PR was merged successfully. I just excluded your second commit.

sambwest commented 7 years ago

Yeah no problem, understood. Thanks @cooperka another one off the list!