mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
improve close
method
This commit is contained in:
parent
6b13136fa6
commit
b5d529a374
@ -132,8 +132,15 @@ export class Drawer extends React.Component {
|
||||
return await this.setState({ locked: false })
|
||||
}
|
||||
|
||||
close = () => {
|
||||
if (this.state.locked) {
|
||||
close = async ({
|
||||
unlock = false
|
||||
} = {}) => {
|
||||
return new Promise(async (resolve) => {
|
||||
if (unlock) {
|
||||
await this.setState({ locked: false })
|
||||
}
|
||||
|
||||
if (this.state.locked && !unlock) {
|
||||
return console.warn("Cannot close a locked drawer")
|
||||
}
|
||||
|
||||
@ -147,7 +154,10 @@ export class Drawer extends React.Component {
|
||||
}
|
||||
|
||||
this.props.controller.close(this.props.id)
|
||||
|
||||
resolve()
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
sendEvent = (...context) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user