diff --git a/src/components/dialogs/GifSelect.tsx b/src/components/dialogs/GifSelect.tsx
index ffd8130db5..64ad2624a4 100644
--- a/src/components/dialogs/GifSelect.tsx
+++ b/src/components/dialogs/GifSelect.tsx
@@ -37,7 +37,7 @@ export function GifSelectDialog({
onSelectGif: onSelectGifProp,
}: {
controlRef: React.RefObject<{open: () => void}>
- onClose: () => void
+ onClose?: () => void
onSelectGif: (gif: Gif) => void
}) {
const control = Dialog.useDialogControl()
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index 49a498ccee..75e2e9f3a2 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -497,10 +497,6 @@ export const ComposePost = ({
openEmojiPicker?.(textInput.current?.getCursorPosition())
}, [openEmojiPicker])
- const focusTextInput = useCallback(() => {
- textInput.current?.focus()
- }, [])
-
const onSelectGif = useCallback((gif: Gif) => {
dispatch({type: 'embed_add_gif', gif})
}, [])
@@ -569,6 +565,7 @@ export const ComposePost = ({
dispatch({type: 'update_labels', labels: nextLabels})
}}
hasMedia={hasMedia || Boolean(extLink)}
+ Portal={Portal.Portal}
/>
{canPost ? (
diff --git a/src/view/com/composer/labels/LabelsBtn.tsx b/src/view/com/composer/labels/LabelsBtn.tsx
index 4458c9c701..1f9a7e93bc 100644
--- a/src/view/com/composer/labels/LabelsBtn.tsx
+++ b/src/view/com/composer/labels/LabelsBtn.tsx
@@ -4,12 +4,12 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {ShieldExclamation} from '#/lib/icons'
-import {isNative} from '#/platform/detection'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import * as ToggleButton from '#/components/forms/ToggleButton'
import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
+import {PortalComponent} from '#/components/Portal'
import {Text} from '#/components/Typography'
const ADULT_CONTENT_LABELS = ['sexual', 'nudity', 'porn']
@@ -18,10 +18,12 @@ export function LabelsBtn({
labels,
hasMedia,
onChange,
+ Portal,
}: {
labels: string[]
hasMedia: boolean
onChange: (v: string[]) => void
+ Portal: PortalComponent
}) {
const control = Dialog.useDialogControl()
const t = useTheme()
@@ -52,9 +54,7 @@ export function LabelsBtn({
msg`Opens a dialog to add a content warning to your post`,
)}
onPress={() => {
- if (isNative && Keyboard.isVisible()) {
- Keyboard.dismiss()
- }
+ Keyboard.dismiss()
control.open()
}}>
@@ -63,122 +63,143 @@ export function LabelsBtn({
) : null}
-
+
-
-
-
- Add a content warning
-
-
-
-
-
- Adult Content
-
-
-
-
- {hasMedia ? (
- <>
- {
- onChange(values)
- LayoutAnimation.configureNext(
- LayoutAnimation.Presets.easeInEaseOut,
- )
- }}>
-
-
- Suggestive
-
-
-
-
- Nudity
-
-
-
-
- Porn
-
-
-
-
-
- {labels.includes('sexual') ? (
- Pictures meant for adults.
- ) : labels.includes('nudity') ? (
- Artistic or non-erotic nudity.
- ) : labels.includes('porn') ? (
- Sexual activity or erotic nudity.
- ) : (
-
- If none are selected, suitable for all ages.
-
- )}
-
- >
- ) : (
-
-
-
-
- Not Applicable.
- {' '}
- This warning is only available for posts with media
- attached.
-
-
-
- )}
-
-
-
-
-
+
>
)
}
+
+function DialogInner({
+ labels,
+ onChange,
+ hasAdultSelection,
+ hasMedia,
+ removeAdultLabel,
+}: {
+ labels: string[]
+ onChange: (v: string[]) => void
+ hasAdultSelection: boolean
+ hasMedia: boolean
+ removeAdultLabel: () => void
+}) {
+ const {_} = useLingui()
+ const control = Dialog.useDialogContext()
+ const t = useTheme()
+
+ return (
+
+
+
+ Add a content warning
+
+
+
+
+
+ Adult Content
+
+
+
+
+ {hasMedia ? (
+ <>
+ {
+ onChange(values)
+ LayoutAnimation.configureNext(
+ LayoutAnimation.Presets.easeInEaseOut,
+ )
+ }}>
+
+
+ Suggestive
+
+
+
+
+ Nudity
+
+
+
+
+ Porn
+
+
+
+
+
+ {labels.includes('sexual') ? (
+ Pictures meant for adults.
+ ) : labels.includes('nudity') ? (
+ Artistic or non-erotic nudity.
+ ) : labels.includes('porn') ? (
+ Sexual activity or erotic nudity.
+ ) : (
+ If none are selected, suitable for all ages.
+ )}
+
+ >
+ ) : (
+
+
+
+
+ Not Applicable.
+ {' '}
+ This warning is only available for posts with media attached.
+
+
+
+ )}
+
+
+
+
+
+ )
+}
diff --git a/src/view/com/composer/photos/SelectGifBtn.tsx b/src/view/com/composer/photos/SelectGifBtn.tsx
index d13df0a110..74f9acdc63 100644
--- a/src/view/com/composer/photos/SelectGifBtn.tsx
+++ b/src/view/com/composer/photos/SelectGifBtn.tsx
@@ -11,7 +11,7 @@ import {GifSelectDialog} from '#/components/dialogs/GifSelect'
import {GifSquare_Stroke2_Corner0_Rounded as GifIcon} from '#/components/icons/Gif'
type Props = {
- onClose: () => void
+ onClose?: () => void
onSelectGif: (gif: Gif) => void
disabled?: boolean
}