16 lines
600 B
TypeScript
16 lines
600 B
TypeScript
import type { PropsWithChildren } from "react"
|
|
import { KeyboardAvoidingView, Platform } from "react-native"
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
|
|
/** RN modals have their own window; protect their actions from navigation and IME. */
|
|
export function AndroidSheet({ children }: PropsWithChildren) {
|
|
if (Platform.OS !== "android") return children
|
|
return (
|
|
<KeyboardAvoidingView behavior="height" style={{ flex: 1 }}>
|
|
<SafeAreaView edges={["bottom", "left", "right"]} style={{ flex: 1 }}>
|
|
{children}
|
|
</SafeAreaView>
|
|
</KeyboardAvoidingView>
|
|
)
|
|
}
|