Fix 1405 handle android back button in composer (#1446)

* handle android back button in composer

* improve backHandler error handling

* simplify composer onClose functionality
This commit is contained in:
Ansh 2023-09-29 10:49:59 +07:00 committed by GitHub
parent 1f60e1a748
commit 04fda0f142
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 17 deletions

View file

@ -44,7 +44,10 @@ const ShellInner = observer(function ShellInnerImpl() {
)
const canGoBack = useNavigationState(state => !isStateAtTabRoot(state))
React.useEffect(() => {
backHandler.init(store)
const listener = backHandler.init(store)
return () => {
listener()
}
}, [store])
return (
@ -68,7 +71,6 @@ const ShellInner = observer(function ShellInnerImpl() {
</View>
<Composer
active={store.shell.isComposerActive}
onClose={() => store.shell.closeComposer()}
winHeight={winDim.height}
replyTo={store.shell.composerOpts?.replyTo}
onPost={store.shell.composerOpts?.onPost}