Skip to content

Commit

Permalink
deps: Upgrade react-native-simple-toast to 3.3.1, the latest
Browse files Browse the repository at this point in the history
Unfortunately this causes a peer-dependency warning:

  warning " > react-native-simple-toast@3.3.1" has incorrect peer
    dependency "react-native@>=0.71.0".

but no issues are observed in manual testing of this library's
functionality on iOS or Android.

While we're at it, use TsFlower for the types. The types tell us
that `Toast.show`'s duration parameter is required; so, include it,
even though the implementation has logic to fall back to Toast.SHORT
if the argument isn't passed.

This lets us pull in the latest version of the "Toast" pod for iOS;
that's version 4.1.1. That version has a "privacy manifest" --

  scalessec/Toast@401141d79
  scalessec/Toast@607b12954
  scalessec/Toast@85b492dd8

-- which should hopefully help us with zulip#5847. Granted, the Toast
pod's privacy manifest file seems pretty boring; I think it just
declares that the library doesn't access any sensitive data. Still,
"Toast" is explicitly included in a list published by Apple of
"commonly used SDKs" that require their own privacy manifest:
  https://developer.apple.com/support/third-party-SDK-requirements/
(In fact, I think it's the only one of zulip-mobile's dependencies
that appears in that list.)

Related: zulip#5847
  • Loading branch information
chrisbobbe committed Apr 16, 2024
1 parent 5fa3ce6 commit 70c7bb4
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 51 deletions.
38 changes: 0 additions & 38 deletions flow-typed/react-native-simple-toast_vx.x.x.js

This file was deleted.

10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -647,7 +647,7 @@ SPEC CHECKSUMS:
RNVectorIcons: fcc2f6cb32f5735b586e66d14103a74ce6ad61f8
Sentry: ebc12276bd17613a114ab359074096b6b3725203
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
Yoga: 0bc4b37c3b8a345336ff601e2cf7d9704bab7e93

PODFILE CHECKSUM: fe17e730c08576abd6133867554e6cb03f685fee
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/RootErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {|
Expand Down
4 changes: 4 additions & 0 deletions tools/tsflower
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

4 changes: 4 additions & 0 deletions types/react-native-simple-toast/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* @flow
* @generated
*/
export * from './lib/typescript/index.js.flow';
Original file line number Diff line number Diff line change
@@ -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;
25 changes: 25 additions & 0 deletions types/react-native-simple-toast/lib/typescript/index.js.flow
Original file line number Diff line number Diff line change
@@ -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;
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 70c7bb4

Please sign in to comment.