update type imports, remove forwardRef
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, {useContext, useMemo} from 'react'
|
import {createContext, useContext, useMemo} from 'react'
|
||||||
import {type GestureResponderEvent, type View} from 'react-native'
|
import {type GestureResponderEvent, type View} from 'react-native'
|
||||||
|
|
||||||
import {POST_CTRL_HITSLOP} from '#/lib/constants'
|
import {POST_CTRL_HITSLOP} from '#/lib/constants'
|
||||||
@@ -8,30 +8,33 @@ import {Button, type ButtonProps} from '#/components/Button'
|
|||||||
import {type Props as SVGIconProps} from '#/components/icons/common'
|
import {type Props as SVGIconProps} from '#/components/icons/common'
|
||||||
import {Text, type TextProps} from '#/components/Typography'
|
import {Text, type TextProps} from '#/components/Typography'
|
||||||
|
|
||||||
const PostControlContext = React.createContext<{
|
const PostControlContext = createContext<{
|
||||||
big?: boolean
|
big?: boolean
|
||||||
active?: boolean
|
active?: boolean
|
||||||
color?: {color: string}
|
color?: {color: string}
|
||||||
}>({})
|
}>({})
|
||||||
|
|
||||||
// Base button style, which the the other ones extend
|
// Base button style, which the the other ones extend
|
||||||
export const PostControlButton = React.forwardRef<
|
export function PostControlButton({
|
||||||
View,
|
ref,
|
||||||
ButtonProps & {
|
onPress,
|
||||||
|
onLongPress,
|
||||||
|
children,
|
||||||
|
big,
|
||||||
|
active,
|
||||||
|
activeColor,
|
||||||
|
...props
|
||||||
|
}: ButtonProps & {
|
||||||
|
ref?: React.Ref<View>
|
||||||
active?: boolean
|
active?: boolean
|
||||||
big?: boolean
|
big?: boolean
|
||||||
color?: string
|
color?: string
|
||||||
activeColor?: string
|
activeColor?: string
|
||||||
}
|
}) {
|
||||||
>(
|
|
||||||
(
|
|
||||||
{onPress, onLongPress, children, big, active, activeColor, ...props},
|
|
||||||
ref,
|
|
||||||
) => {
|
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
|
|
||||||
const ctx = React.useMemo(
|
const ctx = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
big,
|
big,
|
||||||
active,
|
active,
|
||||||
@@ -94,9 +97,7 @@ export const PostControlButton = React.forwardRef<
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
)
|
|
||||||
PostControlButton.displayName = 'PostControlButton'
|
|
||||||
|
|
||||||
export function PostControlButtonIcon({
|
export function PostControlButtonIcon({
|
||||||
icon: Comp,
|
icon: Comp,
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import {
|
|||||||
type CommonNavigatorParams,
|
type CommonNavigatorParams,
|
||||||
type NavigationProp,
|
type NavigationProp,
|
||||||
} from '#/lib/routes/types'
|
} from '#/lib/routes/types'
|
||||||
import {shareText} from '#/lib/sharing'
|
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
||||||
import {toShareUrl} from '#/lib/strings/url-helpers'
|
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||||
@@ -58,7 +57,6 @@ import {
|
|||||||
PostInteractionSettingsDialog,
|
PostInteractionSettingsDialog,
|
||||||
usePrefetchPostInteractionSettings,
|
usePrefetchPostInteractionSettings,
|
||||||
} from '#/components/dialogs/PostInteractionSettingsDialog'
|
} from '#/components/dialogs/PostInteractionSettingsDialog'
|
||||||
import {ArrowOutOfBox_Stroke2_Corner0_Rounded as Share} from '#/components/icons/ArrowOutOfBox'
|
|
||||||
import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom'
|
import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom'
|
||||||
import {BubbleQuestion_Stroke2_Corner0_Rounded as Translate} from '#/components/icons/Bubble'
|
import {BubbleQuestion_Stroke2_Corner0_Rounded as Translate} from '#/components/icons/Bubble'
|
||||||
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
|
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
|
||||||
@@ -85,7 +83,6 @@ import {
|
|||||||
useReportDialogControl,
|
useReportDialogControl,
|
||||||
} from '#/components/moderation/ReportDialog'
|
} from '#/components/moderation/ReportDialog'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
import {useDevMode} from '#/storage/hooks/dev-mode'
|
|
||||||
import * as bsky from '#/types/bsky'
|
import * as bsky from '#/types/bsky'
|
||||||
|
|
||||||
let PostMenuItems = ({
|
let PostMenuItems = ({
|
||||||
@@ -131,7 +128,6 @@ let PostMenuItems = ({
|
|||||||
const hideReplyConfirmControl = useDialogControl()
|
const hideReplyConfirmControl = useDialogControl()
|
||||||
const {mutateAsync: toggleReplyVisibility} =
|
const {mutateAsync: toggleReplyVisibility} =
|
||||||
useToggleReplyVisibilityMutation()
|
useToggleReplyVisibilityMutation()
|
||||||
const [devModeEnabled] = useDevMode()
|
|
||||||
|
|
||||||
const postUri = post.uri
|
const postUri = post.uri
|
||||||
const postCid = post.cid
|
const postCid = post.cid
|
||||||
@@ -390,14 +386,6 @@ let PostMenuItems = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onShareATURI = () => {
|
|
||||||
shareText(postUri)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onShareAuthorDID = () => {
|
|
||||||
shareText(postAuthor.did)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onReportMisclassification = () => {
|
const onReportMisclassification = () => {
|
||||||
const url = `https://docs.google.com/forms/d/e/1FAIpQLSd0QPqhNFksDQf1YyOos7r1ofCLvmrKAH1lU042TaS3GAZaWQ/viewform?entry.1756031717=${toShareUrl(
|
const url = `https://docs.google.com/forms/d/e/1FAIpQLSd0QPqhNFksDQf1YyOos7r1ofCLvmrKAH1lU042TaS3GAZaWQ/viewform?entry.1756031717=${toShareUrl(
|
||||||
href,
|
href,
|
||||||
@@ -485,11 +473,9 @@ let PostMenuItems = ({
|
|||||||
DISCOVER_DEBUG_DIDS[currentAccount?.did ?? ''] && (
|
DISCOVER_DEBUG_DIDS[currentAccount?.did ?? ''] && (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
testID="postDropdownReportMisclassificationBtn"
|
testID="postDropdownReportMisclassificationBtn"
|
||||||
label={_(msg`Assign topic - help train Discover!`)}
|
label={_(msg`Assign topic for algo`)}
|
||||||
onPress={onReportMisclassification}>
|
onPress={onReportMisclassification}>
|
||||||
<Menu.ItemText>
|
<Menu.ItemText>{_(msg`Assign topic for algo`)}</Menu.ItemText>
|
||||||
{_(msg`Assign topic - help train Discover!`)}
|
|
||||||
</Menu.ItemText>
|
|
||||||
<Menu.ItemIcon icon={AtomIcon} position="right" />
|
<Menu.ItemIcon icon={AtomIcon} position="right" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
@@ -682,28 +668,6 @@ let PostMenuItems = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Menu.Group>
|
</Menu.Group>
|
||||||
|
|
||||||
{devModeEnabled ? (
|
|
||||||
<>
|
|
||||||
<Menu.Divider />
|
|
||||||
<Menu.Group>
|
|
||||||
<Menu.Item
|
|
||||||
testID="postAtUriShareBtn"
|
|
||||||
label={_(msg`Copy post at:// URI`)}
|
|
||||||
onPress={onShareATURI}>
|
|
||||||
<Menu.ItemText>{_(msg`Copy post at:// URI`)}</Menu.ItemText>
|
|
||||||
<Menu.ItemIcon icon={Share} position="right" />
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item
|
|
||||||
testID="postAuthorDIDShareBtn"
|
|
||||||
label={_(msg`Copy author DID`)}
|
|
||||||
onPress={onShareAuthorDID}>
|
|
||||||
<Menu.ItemText>{_(msg`Copy author DID`)}</Menu.ItemText>
|
|
||||||
<Menu.ItemIcon icon={Share} position="right" />
|
|
||||||
</Menu.Item>
|
|
||||||
</Menu.Group>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Menu.Outer>
|
</Menu.Outer>
|
||||||
|
|||||||
Reference in New Issue
Block a user