-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic form content #11
Comments
Hello @fisch0920, I can't test your code right now but I think your onValueChange is overwritten by https://github.com/FaridSafi/react-native-gifted-form/blob/master/widgets/SwitchWidget.js#L61 onValueChange={(value) => {
this._onChange(value);
this.props.onChange(value);
}} then to do onChange={(value) => {
this.setState({ hasCustomMessage: value })
}} then to do something similar for TextAreaWidget If it works, please submit a pull request |
Hey @FaridSafi, thanks for the quick feedback and I know what you mean. I've already changed my fork to allow onValueChange overrides in addition to calling WidgetMixin._onChange, but the base issue remains that updating the parent state doesn't update the cloned modal's child states. |
If I change ContainerMixin as follows, dynamic content within the form itself and modals works as expected. From:
To:
Note that this is just making the childrenWithProps cloning dynamic instead of only at mount time. This change is necessary for my use case to function properly as I want to rely on external state to update the form's contents, not just the form's internal state representation. @FaridSafi what do you think of this change? Will it have any unexpected side effects? |
Looks good, can you enable it as an option (something like |
Also, I think you should use widgetStyles prop instead of style for the TextAreaWidget widgetStyles={{
textArea: styles.customMessage
}} |
First off this library is really great.
I ran into an issue where Modals with custom content dependent on container state aren't re-rendered due to the ModalWidget cloning the elements once at mount time. I was hoping to have a more dynamic modal which would show / hide a TextAreaWidget dependent on the value of a SwitchWidget ala below:
Any idea how to make the modal contents more dynamic?
Thanks!
The text was updated successfully, but these errors were encountered: