mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-01 14:12:51 +00:00
* fix(app): keep fullscreen composer in the keyboard dock * fix(app): preserve composer caret and scope keyboard actions
19 lines
537 B
TypeScript
19 lines
537 B
TypeScript
import { useEffect } from "react";
|
|
import { BackHandler } from "react-native";
|
|
|
|
/** The hardware back button leaves fullscreen instead of the screen. */
|
|
export function useComposerFullscreenExit(
|
|
active: boolean,
|
|
onExit: () => void,
|
|
): ((node: unknown) => void) | undefined {
|
|
useEffect(() => {
|
|
if (!active) return;
|
|
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
onExit();
|
|
return true;
|
|
});
|
|
return () => subscription.remove();
|
|
}, [active, onExit]);
|
|
return undefined;
|
|
}
|