From c0c450793e8b474f38378e425d6b515f508b0745 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Mon, 7 Aug 2023 18:50:44 -0700 Subject: [PATCH] Add missing constants to fallback implementation of ToastAndroid (#38803) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38803 The d.ts file says these constant must exist, but they only exist in the android implementation. This diff stops lying and adds some dummy constants, so that the type will match-up. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D48085126 fbshipit-source-id: 8d5332a71b9b3c1925abeec9e47630a07abf8b86 --- .../Libraries/Components/ToastAndroid/ToastAndroid.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js b/packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js index d6e98fc61d97e2..ebdd82b59f8a30 100644 --- a/packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js +++ b/packages/react-native/Libraries/Components/ToastAndroid/ToastAndroid.js @@ -5,12 +5,20 @@ * LICENSE file in the root directory of this source tree. * * @format - * @noflow + * @flow strict-local */ 'use strict'; const ToastAndroid = { + // Dummy fallback toast duration constants + SHORT: (0: number), + LONG: (0: number), + // Dummy fallback toast gravity constants + TOP: (0: number), + BOTTOM: (0: number), + CENTER: (0: number), + show: function (message: string, duration: number): void { console.warn('ToastAndroid is not supported on this platform.'); },