diff --git a/flow-typed/react-native-simple-toast_vx.x.x.js b/flow-typed/react-native-simple-toast_vx.x.x.js deleted file mode 100644 index 86c88a886b..0000000000 --- a/flow-typed/react-native-simple-toast_vx.x.x.js +++ /dev/null @@ -1,38 +0,0 @@ -// flow-typed signature: dfa621fc2221dbcc5c75aa37a073b542 -// flow-typed version: <>/react-native-simple-toast_v0.1.1/flow_v0.92.0 - -/** - * Verbatim from index.d.ts. - */ - -declare module 'react-native-simple-toast' { - declare type SimpleToast = {| - // Toast duration constants - SHORT: number, - LONG: number, - - // Toast gravity constants - TOP: number, - BOTTOM: number, - CENTER: number, - - show: (message: string, duration?: number) => void, - - showWithGravity: (message: string, duration: number, gravity: number) => void, - |}; - declare export default SimpleToast; -} - -/** - * We include stubs for each file inside this npm package in case you need to - * require those files directly. Feel free to delete any files that aren't - * needed. - */ - -// Filename aliases -declare module 'react-native-simple-toast/index' { - declare module.exports: $Exports<'react-native-simple-toast'>; -} -declare module 'react-native-simple-toast/index.js' { - declare module.exports: $Exports<'react-native-simple-toast'>; -} diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6cd424c759..7339179db0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -258,9 +258,9 @@ PODS: - React-Core - react-native-safe-area-context (4.9.0): - React-Core - - react-native-simple-toast (1.1.4): + - react-native-simple-toast (3.3.1): - React-Core - - Toast (~> 4.0.0) + - Toast (~> 4) - react-native-webview (11.26.1): - React-Core - React-perflogger (0.68.7) @@ -380,7 +380,7 @@ PODS: - Sentry/HybridSDK (8.21.0): - SentryPrivate (= 8.21.0) - SentryPrivate (8.21.0) - - Toast (4.0.0) + - Toast (4.1.1) - Yoga (1.14.0) DEPENDENCIES: @@ -621,7 +621,7 @@ SPEC CHECKSUMS: react-native-netinfo: e849fc21ca2f4128a5726c801a82fc6f4a6db50d react-native-photo-view: ea0ec91bf5991a6843e740b1f47ab355171c996c react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b - react-native-simple-toast: 8ee5d23f0b92b935ab7434cdb65159ce12dfb4b7 + react-native-simple-toast: 1f1cc551d419bc0ab05dcb0136554006c274789d react-native-webview: 9f111dfbcfc826084d6c507f569e5e03342ee1c1 React-perflogger: 44436b315d757100a53dfb1ab6b77c58cb646d7d React-RCTActionSheet: 1888a229684762c40cc96c7ff4716f809655dc09 @@ -647,7 +647,7 @@ SPEC CHECKSUMS: RNVectorIcons: fcc2f6cb32f5735b586e66d14103a74ce6ad61f8 Sentry: ebc12276bd17613a114ab359074096b6b3725203 SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe - Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 + Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e Yoga: 0bc4b37c3b8a345336ff601e2cf7d9704bab7e93 PODFILE CHECKSUM: fe17e730c08576abd6133867554e6cb03f685fee diff --git a/package.json b/package.json index 9e30fe2beb..65ec7f2683 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "react-native-reanimated": "^2.2.0 <2.3.0", "react-native-safe-area-context": "^4.3.1", "react-native-screens": "^3.13.1 <3.30.0", - "react-native-simple-toast": "^1.1.4", + "react-native-simple-toast": "^3.3.1", "react-native-tab-view": "^2.15.2", "react-native-url-polyfill": "^1.3.0", "react-native-vector-icons": "^9.1.0", diff --git a/src/RootErrorBoundary.js b/src/RootErrorBoundary.js index f2e3c93e55..94052cf9f1 100644 --- a/src/RootErrorBoundary.js +++ b/src/RootErrorBoundary.js @@ -115,7 +115,7 @@ ${error.stack}`; // [1] https://reactjs.org/docs/error-boundaries.html#how-about-event-handlers. onPress={() => { Clipboard.setString(details); - Toast.show('Copied!'); + Toast.show('Copied!', Toast.SHORT); }} /> {Platform.select({ diff --git a/src/utils/info.js b/src/utils/info.js index c4604be437..14184522b0 100644 --- a/src/utils/info.js +++ b/src/utils/info.js @@ -6,7 +6,7 @@ import type { GlobalSettingsState, GetText, LocalizableText } from '../types'; import { openLinkWithUserPreference } from './openLink'; export const showToast = (message: string) => { - Toast.show(message); + Toast.show(message, Toast.SHORT); }; type LearnMoreButton = {| diff --git a/tools/tsflower b/tools/tsflower index 8198ea2077..04684421d7 100755 --- a/tools/tsflower +++ b/tools/tsflower @@ -147,6 +147,10 @@ run_only() # TODO get list of packages from data... better yet, make it # one tsflower command, reading a TsFlower config file + package=react-native-simple-toast + run_on_package "${package}" + format_dir "${rootdir}"/types/"${package}" + package=expo-mail-composer run_on_package "${package}" format_dir "${rootdir}"/types/"${package}" diff --git a/types/patches/0030-tsflower-Import-TurboModule-type-using-path-that-wor.patch b/types/patches/0030-tsflower-Import-TurboModule-type-using-path-that-wor.patch index 74b93127dc..12d431c21e 100644 --- a/types/patches/0030-tsflower-Import-TurboModule-type-using-path-that-wor.patch +++ b/types/patches/0030-tsflower-Import-TurboModule-type-using-path-that-wor.patch @@ -11,7 +11,8 @@ export type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; .../clipboard/dist/NativeClipboard.js.flow | 2 +- .../clipboard/dist/NativeClipboardModule.js.flow | 2 +- .../lib/typescript/src/specs/NativeSafeAreaContext.js.flow | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) + .../lib/typescript/NativeSimpleToast.js.flow | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git types/@react-native-clipboard/clipboard/dist/NativeClipboard.js.flow types/@react-native-clipboard/clipboard/dist/NativeClipboard.js.flow index c7446d1d7..637eaf154 100644 @@ -52,6 +53,19 @@ index 9d8051c08..22525e663 100644 import { type Double } from 'react-native/Libraries/Types/CodegenTypes'; export interface Spec extends TurboModule { +diff --git types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow +index c35597a1b..8ed9b3753 100644 +--- types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow ++++ types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow +@@ -2,7 +2,7 @@ + * @generated by TsFlower + */ + import type { ColorValue as $tsflower_subst$RN$ColorValue } from 'tsflower/subst/react-native'; +-import { type TurboModule } from 'react-native'; ++import { type TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; + + export type StylesIOS = { + textColor?: $tsflower_subst$RN$ColorValue, -- 2.32.0 diff --git a/types/react-native-simple-toast/index.js.flow b/types/react-native-simple-toast/index.js.flow new file mode 100644 index 0000000000..9d491e42ef --- /dev/null +++ b/types/react-native-simple-toast/index.js.flow @@ -0,0 +1,4 @@ +/* @flow + * @generated + */ +export * from './lib/typescript/index.js.flow'; diff --git a/types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow b/types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow new file mode 100644 index 0000000000..8ed9b37530 --- /dev/null +++ b/types/react-native-simple-toast/lib/typescript/NativeSimpleToast.js.flow @@ -0,0 +1,36 @@ +/* @flow + * @generated by TsFlower + */ +import type { ColorValue as $tsflower_subst$RN$ColorValue } from 'tsflower/subst/react-native'; +import { type TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; + +export type StylesIOS = { + textColor?: $tsflower_subst$RN$ColorValue, + backgroundColor?: $tsflower_subst$RN$ColorValue, + tapToDismissEnabled?: boolean, + ... +}; + +export interface Spec extends TurboModule { + getConstants: () => { + SHORT: number, + LONG: number, + TOP: number, + BOTTOM: number, + CENTER: number, + ... + }; + show: (message: string, duration: number, options?: Object) => void; + showWithGravity: (message: string, duration: number, gravity: number, options?: Object) => void; + showWithGravityAndOffset: ( + message: string, + duration: number, + gravity: number, + xOffset: number, + yOffset: number, + options?: Object, + ) => void; +} + +declare var _default: Spec; +export default _default; diff --git a/types/react-native-simple-toast/lib/typescript/index.js.flow b/types/react-native-simple-toast/lib/typescript/index.js.flow new file mode 100644 index 0000000000..2ea9592efb --- /dev/null +++ b/types/react-native-simple-toast/lib/typescript/index.js.flow @@ -0,0 +1,25 @@ +/* @flow + * @generated by TsFlower + */ +import { type StylesIOS } from './NativeSimpleToast'; + +declare var _default: { + SHORT: number, + LONG: number, + TOP: number, + BOTTOM: number, + CENTER: number, + show(message: string, duration: number, options?: StylesIOS): void, + showWithGravity(message: string, duration: number, gravity: number, options?: StylesIOS): void, + showWithGravityAndOffset( + message: string, + duration: number, + gravity: number, + xOffset: number, + yOffset: number, + options?: StylesIOS, + ): void, + ... +}; + +export default _default; diff --git a/yarn.lock b/yarn.lock index 238a791eaa..819178ef83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10812,10 +10812,10 @@ react-native-safe-area-context@^4.3.1: react-freeze "^1.0.0" warn-once "^0.1.0" -react-native-simple-toast@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/react-native-simple-toast/-/react-native-simple-toast-1.1.4.tgz#6a962beea87b86228a4f8c51bc93761108740b1c" - integrity sha512-7D8o8L445XDz7Rdh0pMgCIWuevv1FnGyuD7F8Nz/XhzMInmU4jL5VFJI25VVqQ2uGTaUSuo2ogXSgKnv6p9NJg== +react-native-simple-toast@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/react-native-simple-toast/-/react-native-simple-toast-3.3.1.tgz#0eeab7cdcb98d999467e1cef812cfdc198549c23" + integrity sha512-5SbAvZpzjSHNkMGbO1cr/7kg/oHZEVZbgeqC+6FtYTtvBbkRMbEaUIfiD1rvghbxZrJB783Y/mHRDUab2ogTqA== react-native-tab-view@^2.15.2: version "2.16.0"