diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-05-30 07:44:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 05:44:20 +0100 |
commit | c4abaa1abcde54f15133b2e2b546f0d54a3a1d07 (patch) | |
tree | 996d1adcdc3ae1fa6a3c4a959e2a0df8d02235e6 /src/view/com/composer/KeyboardAccessory.tsx | |
parent | fba4a9ca023b5acfe8ae51e1839d4e5e305ea967 (diff) | |
download | voidsky-c4abaa1abcde54f15133b2e2b546f0d54a3a1d07.tar.zst |
Use `<Modal>` for Composer (#3588)
* use <Modal> to display composer * trigger `onPressCancel` on modal cancel * remove android top padding * use light statusbar on ios * use KeyboardStickyView from r-n-keyboard-controller * make extra bottom padding ios-only * make cancelRef optional * scope legacy modals * don't change bg color on ios * use fullScreen instead of formSheet * adjust padding on keyboardaccessory to account for new buttons * Revert "use KeyboardStickyView from r-n-keyboard-controller" This reverts commit 426c812904f427bdd08107cffc32e4be1d9b83bc. * fix insets * tweaks and merge * revert 89f51c72 * nit * import keyboard provider --------- Co-authored-by: Hailey <me@haileyok.com> Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'src/view/com/composer/KeyboardAccessory.tsx')
-rw-r--r-- | src/view/com/composer/KeyboardAccessory.tsx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/view/com/composer/KeyboardAccessory.tsx b/src/view/com/composer/KeyboardAccessory.tsx new file mode 100644 index 000000000..983a87dae --- /dev/null +++ b/src/view/com/composer/KeyboardAccessory.tsx @@ -0,0 +1,34 @@ +import React from 'react' +import {View} from 'react-native' +import {KeyboardStickyView} from 'react-native-keyboard-controller' +import {useSafeAreaInsets} from 'react-native-safe-area-context' + +import {isWeb} from '#/platform/detection' +import {atoms as a, useTheme} from '#/alf' + +export function KeyboardAccessory({children}: {children: React.ReactNode}) { + const t = useTheme() + const {bottom} = useSafeAreaInsets() + + const style = [ + a.flex_row, + a.py_xs, + a.pl_sm, + a.pr_xl, + a.align_center, + a.border_t, + t.atoms.border_contrast_medium, + t.atoms.bg, + ] + + // todo: when iPad support is added, it should also not use the KeyboardStickyView + if (isWeb) { + return <View style={style}>{children}</View> + } + + return ( + <KeyboardStickyView offset={{closed: -bottom}} style={style}> + {children} + </KeyboardStickyView> + ) +} |