Update toast API usage
(cherry picked from commit e370018b8ed8cdfd7675c9634058c72cb59d39de)
This commit is contained in:
committed by
Samuel Newman
parent
336a25748e
commit
9b8fd2eb48
@@ -129,7 +129,7 @@ import {EmojiArc_Stroke2_Corner0_Rounded as EmojiSmile} from '#/components/icons
|
||||
import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
|
||||
import {LazyQuoteEmbed} from '#/components/Post/Embed/LazyQuoteEmbed'
|
||||
import * as Prompt from '#/components/Prompt'
|
||||
import {toast} from '#/components/Toast'
|
||||
import * as toast from '#/components/Toast'
|
||||
import {Text as NewText} from '#/components/Typography'
|
||||
import {BottomSheetPortalProvider} from '../../../../modules/bottom-sheet'
|
||||
import {
|
||||
@@ -815,10 +815,8 @@ let ComposerPost = React.memo(function ComposerPost({
|
||||
if (isNative) return // web only
|
||||
const [mimeType] = uri.slice('data:'.length).split(';')
|
||||
if (!SUPPORTED_MIME_TYPES.includes(mimeType as SupportedMimeTypes)) {
|
||||
toast.show({
|
||||
toast.show(_(msg`Unsupported video type`), {
|
||||
type: 'error',
|
||||
content: _(msg`Unsupported video type`),
|
||||
a11yLabel: _(msg`Unsupported video type.`),
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -1255,8 +1253,6 @@ function ComposerFooter({
|
||||
dispatch,
|
||||
showAddButton,
|
||||
onEmojiButtonPress,
|
||||
onError,
|
||||
|
||||
onSelectVideo,
|
||||
onAddPost,
|
||||
}: {
|
||||
@@ -1338,12 +1334,9 @@ function ComposerFooter({
|
||||
}
|
||||
}
|
||||
|
||||
errors.map((error, i) => {
|
||||
toast.show({
|
||||
errors.map(error => {
|
||||
toast.show(error, {
|
||||
type: 'warning',
|
||||
content: error,
|
||||
a11yLabel: error,
|
||||
duration: 3e3 * (errors.length - i),
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -1369,9 +1362,7 @@ function ComposerFooter({
|
||||
) : (
|
||||
<ToolbarWrapper style={[a.flex_row, a.align_center, a.gap_xs]}>
|
||||
<SelectMediaButton
|
||||
size={images.length}
|
||||
disabled={isMediaSelectionDisabled}
|
||||
setError={onError}
|
||||
selectedAssetsCount={selectedAssetsCount}
|
||||
onSelectAssets={onSelectAssets}
|
||||
/>
|
||||
|
||||
@@ -22,12 +22,10 @@ import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button} from '#/components/Button'
|
||||
import {useSheetWrapper} from '#/components/Dialog/sheet-wrapper'
|
||||
import {Image_Stroke2_Corner0_Rounded as ImageIcon} from '#/components/icons/Image'
|
||||
import {toast} from '#/components/Toast'
|
||||
import * as toast from '#/components/Toast'
|
||||
|
||||
export type SelectMediaButtonProps = {
|
||||
size: number
|
||||
disabled?: boolean
|
||||
setError: (error: string) => void
|
||||
selectedAssetsCount: number
|
||||
onSelectAssets: (props: {
|
||||
type: AssetType
|
||||
@@ -433,10 +431,8 @@ export function SelectMediaButton({
|
||||
])
|
||||
|
||||
if (!photoAccess && !videoAccess) {
|
||||
toast.show({
|
||||
toast.show(_(msg`You need to allow access to your media library.`), {
|
||||
type: 'error',
|
||||
content: 'You need to allow access to your media library.',
|
||||
a11yLabel: 'You need to allow access to your media library.',
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -459,6 +455,7 @@ export function SelectMediaButton({
|
||||
|
||||
await processSelectedAssets(assets)
|
||||
}, [
|
||||
_,
|
||||
requestPhotoAccessIfNeeded,
|
||||
requestVideoAccessIfNeeded,
|
||||
sheetWrapper,
|
||||
|
||||
Reference in New Issue
Block a user