From ef17ca59a5043067d8890d8cd23983adb5442f66 Mon Sep 17 00:00:00 2001 From: apanizo Date: Tue, 2 Oct 2018 17:10:56 +0200 Subject: [PATCH] Updating SafeOwnersForm to change initial values of the form --- .../open/components/SafeOwnersForm/index.jsx | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/routes/open/components/SafeOwnersForm/index.jsx b/src/routes/open/components/SafeOwnersForm/index.jsx index 0269726b..942cae15 100644 --- a/src/routes/open/components/SafeOwnersForm/index.jsx +++ b/src/routes/open/components/SafeOwnersForm/index.jsx @@ -23,6 +23,7 @@ type Props = { classes: Object, otherAccounts: string[], errors: Object, + // updateInitialProps: () => void, } type State = { @@ -68,6 +69,19 @@ class SafeOwners extends React.Component { numOwners: 3, } + // eslint-disable-next-line + onRemoveRow = (index: number) => () => { + /* + this.props.updateInitialProps({ + owner0Address: 'moeFeo', + }) + */ + + this.setState(state => ({ + numOwners: state.numOwners - 1, + })) + } + render() { const { classes, errors, otherAccounts } = this.props const { numOwners } = this.state @@ -81,12 +95,8 @@ class SafeOwners extends React.Component { - - NAME - - - ADDRESS - + NAME + ADDRESS { [...Array(Number(numOwners))].map((x, index) => { @@ -124,7 +134,7 @@ class SafeOwners extends React.Component { { index > 0 && - + } @@ -144,16 +154,17 @@ class SafeOwners extends React.Component { const SafeOwnersForm = withStyles(styles)(SafeOwners) -const SafeOwnersPage = () => (controls: React$Node, moe: Object) => { - const { values, errors } = moe +const SafeOwnersPage = ({ updateInitialProps }: Object) => (controls: React$Node, { values, errors }: Object) => ( + + + + + +) - return ( - - - - - - ) -} export default SafeOwnersPage