From 93a4f8465af2067d3aa4e6a282ed1efeea73266d Mon Sep 17 00:00:00 2001 From: AHMED SALIH AC <36645339+adsalihac@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:16:34 +0530 Subject: [PATCH 1/4] default duration added --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b1fcde8..a9d9b99 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,7 +34,7 @@ export default { CENTER: constantsSource.CENTER, show(message: string, durationSeconds: number, styles: StylesIOS = {}) { - RCTToast.show(message, durationSeconds, processColors(styles)); + RCTToast.show(message, durationSeconds === undefined ? constantsSource.SHORT : durationSeconds, processColors(styles)); }, showWithGravity( From 88a9599f3d9c284e67c8a72dac0fc196a10265f6 Mon Sep 17 00:00:00 2001 From: AHMED SALIH AC <36645339+adsalihac@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:12:33 +0530 Subject: [PATCH 2/4] fix: improve structure --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index a9d9b99..4f22ff2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,7 +34,11 @@ export default { CENTER: constantsSource.CENTER, show(message: string, durationSeconds: number, styles: StylesIOS = {}) { - RCTToast.show(message, durationSeconds === undefined ? constantsSource.SHORT : durationSeconds, processColors(styles)); + RCTToast.show( + message, + durationSeconds === undefined ? constantsSource.SHORT : durationSeconds, + processColors(styles), + ); }, showWithGravity( From 71cfbeae84d07ed317a80c003ebe24e35b36d7a9 Mon Sep 17 00:00:00 2001 From: AHMED SALIH AC <36645339+adsalihac@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:13:34 +0530 Subject: [PATCH 3/4] docs: example added --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9aac90c..74ba96a 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ type StylesIOS = { ```js import Toast from 'react-native-simple-toast'; +Toast.show('This is a short toast'); + Toast.show('This is a long toast.', Toast.LONG); Toast.showWithGravity( From a44e1f1236ea2fe453ccfe30927753801b1293f7 Mon Sep 17 00:00:00 2001 From: AHMED SALIH AC <36645339+adsalihac@users.noreply.github.com> Date: Fri, 2 Jun 2023 23:52:18 +0530 Subject: [PATCH 4/4] fix: operator changed --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4f22ff2..92c1e32 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ export default { show(message: string, durationSeconds: number, styles: StylesIOS = {}) { RCTToast.show( message, - durationSeconds === undefined ? constantsSource.SHORT : durationSeconds, + durationSeconds ?? constantsSource.SHORT, processColors(styles), ); },