react-native-gifted-form icon indicating copy to clipboard operation
react-native-gifted-form copied to clipboard

edit field editable programmically

Open Dannnyho opened this issue 6 years ago • 1 comments

Is there any way to edit field editable programmically? I want to add a "edit" button to enable the all field editable = true

Dannnyho avatar Apr 18 '18 04:04 Dannnyho

Hi,

You can do it by editing the containers state.

constructor(params) {
        super(params);
        this.state = {
            emailEditable: false
        }
    }

Then on the field:

<GiftedForm.TextInputWidget
  name='email'
  title='Email:'
  editable={this.state.emailEditable}
/>

Then in your button:

_toggleEditable() {
  this.setState({emailEditable: !this.state.emailEditable});
}

sambwest avatar Jun 01 '18 20:06 sambwest