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:
@@ -11,7 +11,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
winHeight,
|
||||
replyTo,
|
||||
onPost,
|
||||
onClose,
|
||||
quote,
|
||||
mention,
|
||||
}: {
|
||||
@@ -19,7 +18,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
winHeight: number
|
||||
replyTo?: ComposerOpts['replyTo']
|
||||
onPost?: ComposerOpts['onPost']
|
||||
onClose: () => void
|
||||
quote?: ComposerOpts['quote']
|
||||
mention?: ComposerOpts['mention']
|
||||
}) {
|
||||
@@ -64,7 +62,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
<ComposePost
|
||||
replyTo={replyTo}
|
||||
onPost={onPost}
|
||||
onClose={onClose}
|
||||
quote={quote}
|
||||
mention={mention}
|
||||
/>
|
||||
|
||||
@@ -13,7 +13,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
replyTo,
|
||||
quote,
|
||||
onPost,
|
||||
onClose,
|
||||
mention,
|
||||
}: {
|
||||
active: boolean
|
||||
@@ -21,7 +20,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
replyTo?: ComposerOpts['replyTo']
|
||||
quote: ComposerOpts['quote']
|
||||
onPost?: ComposerOpts['onPost']
|
||||
onClose: () => void
|
||||
mention?: ComposerOpts['mention']
|
||||
}) {
|
||||
const pal = usePalette('default')
|
||||
@@ -47,7 +45,6 @@ export const Composer = observer(function ComposerImpl({
|
||||
replyTo={replyTo}
|
||||
quote={quote}
|
||||
onPost={onPost}
|
||||
onClose={onClose}
|
||||
mention={mention}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -48,7 +48,6 @@ const ShellInner = observer(function ShellInnerImpl() {
|
||||
)}
|
||||
<Composer
|
||||
active={store.shell.isComposerActive}
|
||||
onClose={() => store.shell.closeComposer()}
|
||||
winHeight={0}
|
||||
replyTo={store.shell.composerOpts?.replyTo}
|
||||
quote={store.shell.composerOpts?.quote}
|
||||
|
||||
Reference in New Issue
Block a user