Browse Source

Use `onHide` callback from react-mortal

master
meriadec 7 years ago
parent
commit
713bc067dc
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 2
      package.json
  2. 4
      src/components/base/Modal/index.js
  3. 7
      src/components/modals/AddAccount/index.js
  4. 4
      src/components/modals/Receive.js
  5. 4
      src/components/modals/Send.js
  6. 4
      src/components/modals/SettingsAccount.js
  7. 14
      yarn.lock

2
package.json

@ -69,7 +69,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-i18next": "^7.3.4",
"react-mortal": "^3.0.1",
"react-mortal": "^3.1.0",
"react-motion": "^0.5.2",
"react-qr-reader": "^2.0.1",
"react-redux": "^5.0.6",

4
src/components/base/Modal/index.js

@ -20,6 +20,7 @@ import Icon from 'components/base/Icon'
type Props = {
isOpened?: boolean,
onClose: Function,
onHide?: Function,
preventBackdropClick?: boolean,
render: Function,
data?: any,
@ -109,11 +110,12 @@ export class Modal extends PureComponent<Props> {
}
render() {
const { preventBackdropClick, isOpened, onClose, render, data } = this.props
const { preventBackdropClick, isOpened, onClose, onHide, render, data } = this.props
return (
<Mortal
isOpened={isOpened}
onClose={onClose}
onHide={onHide}
motionStyle={(spring, isVisible) => ({
opacity: spring(isVisible ? 1 : 0, springConfig),
y: spring(isVisible ? 0 : 20, springConfig),

7
src/components/modals/AddAccount/index.js

@ -265,12 +265,12 @@ class AddAccountModal extends PureComponent<Props, State> {
})
}
handleClose = () => {
clearTimeout(this._timeout)
handleClose = () => clearTimeout(this._timeout)
handleHide = () =>
this.setState({
...defaultState,
})
}
addAccount = ({ id, name, ...data }) => {
const { inputValue } = this.state
@ -297,6 +297,7 @@ class AddAccountModal extends PureComponent<Props, State> {
name={MODAL_ADD_ACCOUNT}
preventBackdropClick={step !== 'chooseWallet'}
onClose={this.handleClose}
onHide={this.handleHide}
render={({ onClose }) => (
<ModalBody onClose={onClose} flow={3}>
<Text fontSize={4} color="steel">

4
src/components/modals/Receive.js

@ -47,7 +47,7 @@ class ReceiveModal extends PureComponent<Props, State> {
[key]: value,
})
handleClose = () =>
handleHide = () =>
this.setState({
...defaultState,
})
@ -59,7 +59,7 @@ class ReceiveModal extends PureComponent<Props, State> {
return (
<Modal
name={MODAL_RECEIVE}
onClose={this.handleClose}
onHide={this.handleHide}
render={({ data, onClose }) => {
const account = this.getAccount(data)
return (

4
src/components/modals/Send.js

@ -140,7 +140,7 @@ class Send extends PureComponent<Props, State> {
step,
})
handleClose = () =>
handleHide = () =>
this.setState({
...defaultState,
})
@ -153,7 +153,7 @@ class Send extends PureComponent<Props, State> {
return (
<Modal
name={MODAL_SEND}
onClose={this.handleClose}
onHide={this.handleHide}
render={({ data, onClose }) => (
<Fragment>
<ModalBody p={2}>

4
src/components/modals/SettingsAccount.js

@ -113,7 +113,7 @@ class SettingsAccount extends PureComponent<Props, State> {
push('/')
}
handleClose = () =>
handleHide = () =>
this.setState({
...defaultState,
})
@ -124,7 +124,7 @@ class SettingsAccount extends PureComponent<Props, State> {
return (
<Modal
name={MODAL_SETTINGS_ACCOUNT}
onClose={this.handleClose}
onHide={this.handleHide}
render={({ data, onClose }) => {
const account = this.getAccount(data)
return (

14
yarn.lock

@ -7430,14 +7430,14 @@ react-modal@^3.1.10:
prop-types "^15.5.10"
warning "^3.0.0"
react-mortal@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/react-mortal/-/react-mortal-3.0.1.tgz#be8477513deb08ceb22ba8ae4b52220dc5c741ff"
react-mortal@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-mortal/-/react-mortal-3.1.0.tgz#8dc4eaa0cf267a3614a07e8cef5e130840942fb3"
dependencies:
prop-types "^15.6.0"
react "^16.1.1"
react "^16.2.0"
react-motion "^0.5.0"
react-portal "^4.0.0"
react-portal "^4.1.2"
react-motion@^0.5.0, react-motion@^0.5.2:
version "0.5.2"
@ -7451,7 +7451,7 @@ react-onclickoutside@^6.5.0:
version "6.7.1"
resolved "https://registry.yarnpkg.com/react-onclickoutside/-/react-onclickoutside-6.7.1.tgz#6a5b5b8b4eae6b776259712c89c8a2b36b17be93"
react-portal@^4.0.0:
react-portal@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/react-portal/-/react-portal-4.1.2.tgz#7f28f3c8c2ed5c541907c0ed0f24e8996acf627f"
dependencies:
@ -7560,7 +7560,7 @@ react-treebeard@^2.1.0:
shallowequal "^0.2.2"
velocity-react "^1.3.1"
react@^16.0.0, react@^16.1.1, react@^16.2.0:
react@^16.0.0, react@^16.2.0:
version "16.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba"
dependencies:

Loading…
Cancel
Save