Skip to content

Commit 15383df

Browse files
committed
perf(toast): reduce react-native dependencies
1 parent 72d3a83 commit 15383df

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

code/ui/toast/src/Toast.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { AnimatePresence } from '@tamagui/animate-presence'
12
import type { GetProps, NativePlatform, NativeValue, TamaguiElement } from '@tamagui/core'
23
import { styled, useEvent } from '@tamagui/core'
34
import { composeEventHandlers, withStaticProperties } from '@tamagui/helpers'
45
import { ThemeableStack } from '@tamagui/stacks'
56
import { SizableText } from '@tamagui/text'
67
import { useControllableState } from '@tamagui/use-controllable-state'
78
import * as React from 'react'
8-
99
import { TOAST_NAME } from './constants'
1010
import { ToastAnnounceExclude } from './ToastAnnounce'
1111
import type { CustomData } from './ToastImperative'
@@ -16,7 +16,6 @@ import type { ScopedProps, ToastProviderProps } from './ToastProvider'
1616
import { ToastProvider } from './ToastProvider'
1717
import type { ToastViewportProps } from './ToastViewport'
1818
import { ToastViewport } from './ToastViewport'
19-
import { AnimatePresence } from '@tamagui/animate-presence'
2019

2120
/* -------------------------------------------------------------------------------------------------
2221
* ToastTitle

code/ui/toast/src/ToastImperative.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { NativePlatform, NativeValue } from '@tamagui/core'
2-
import { isWeb } from '@tamagui/core'
2+
import { isAndroid, isIos, isWeb } from '@tamagui/core'
33
import React from 'react'
4-
import { Platform } from 'react-native'
54
import { createNativeToast } from './createNativeToast'
65
import type { CreateNativeToastOptions, NativeToastRef } from './types'
76

@@ -137,8 +136,8 @@ export const ToastImperativeProvider = ({
137136
native === true ||
138137
(isWeb && isWebNative) ||
139138
(!isWeb && isMobileNative) ||
140-
(Platform.OS === 'android' && isAndroidNative) ||
141-
(Platform.OS === 'ios' && isIosNative)
139+
(isAndroid && isAndroidNative) ||
140+
(isIos && isIosNative)
142141

143142
if (isHandledNatively) {
144143
const nativeToastResult = createNativeToast(title, showOptions ?? {})

code/ui/toast/src/ToastImpl.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import type {
2323
PanResponderGestureState,
2424
} from 'react-native'
2525
import { PanResponder } from 'react-native'
26-
2726
import { TOAST_CONTEXT, TOAST_NAME } from './constants'
2827
import { ToastAnnounce } from './ToastAnnounce'
2928
import type { ScopedProps, SwipeDirection } from './ToastProvider'

0 commit comments

Comments
 (0)