react-native-bread 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -221,21 +221,39 @@ Available options include:
221
221
 
222
222
  Toasts automatically appear above native modals on **iOS**.
223
223
 
224
- On **Android**, add `<ToastPortal />` inside your modal layouts:
224
+ On **Android**, you have two options:
225
+
226
+ ### Option 1: Use a Contained Modal
227
+
228
+ The simplest fix is to use `containedModal` presentation instead of `modal`. On Android, `modal` and `containedModal` look nearly identical, so this is an easy swap:
229
+
230
+ ```tsx
231
+ <Stack.Screen
232
+ name="(modal)"
233
+ options={{ presentation: Platform.OS === "android" ? "containedModal" : "modal" }}
234
+ />
235
+ ```
236
+
237
+ This renders the modal within the React hierarchy on Android, so toasts from your root `<BreadLoaf />` remain visible.
238
+
239
+ ### Option 2: Use ToastPortal
240
+
241
+ If you need native modals, add `<ToastPortal />` inside your modal layouts:
225
242
 
226
243
  ```tsx
227
244
  // app/(modal)/_layout.tsx
228
245
  import { Stack } from "expo-router";
229
- import { Platform } from "react-native";
230
246
  import { ToastPortal } from "react-native-bread";
231
247
 
232
248
  export default function ModalLayout() {
233
249
  return (
234
250
  <>
235
251
  <Stack screenOptions={{ headerShown: false }} />
236
- {Platform.OS === "android" && <ToastPortal />}
252
+ <ToastPortal />
237
253
  </>
238
254
  );
239
255
  }
240
256
  ```
241
257
 
258
+ The `ToastPortal` component only renders on Android - it returns `null` on iOS, so no platform check is needed.
259
+
@@ -77,6 +77,9 @@ function BreadLoaf({
77
77
  * the main `<BreadLoaf />` won't be visible. Add `<ToastPortal />` inside your
78
78
  * modal layouts to show toasts above modal content.
79
79
  *
80
+ * This component only renders on Android - it returns `null` on iOS where
81
+ * `<BreadLoaf />` already handles modal overlay via `FullWindowOverlay`.
82
+ *
80
83
  * This component only renders toasts - it does not accept configuration.
81
84
  * All styling/behavior is inherited from your root `<BreadLoaf />` config.
82
85
  *
@@ -85,19 +88,21 @@ function BreadLoaf({
85
88
  * // app/(modal)/_layout.tsx
86
89
  * import { Stack } from 'expo-router';
87
90
  * import { ToastPortal } from 'react-native-bread';
88
- * import { Platform } from 'react-native';
89
91
  *
90
92
  * export default function ModalLayout() {
91
93
  * return (
92
94
  * <>
93
95
  * <Stack screenOptions={{ headerShown: false }} />
94
- * {Platform.OS === 'android' && <ToastPortal />}
96
+ * <ToastPortal />
95
97
  * </>
96
98
  * );
97
99
  * }
98
100
  * ```
99
101
  */
100
102
  function ToastPortal() {
103
+ if (_reactNative.Platform.OS !== "android") {
104
+ return null;
105
+ }
101
106
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ToastContent, {});
102
107
  }
103
108
  const styles = _reactNative.StyleSheet.create({
@@ -72,6 +72,9 @@ export function BreadLoaf({
72
72
  * the main `<BreadLoaf />` won't be visible. Add `<ToastPortal />` inside your
73
73
  * modal layouts to show toasts above modal content.
74
74
  *
75
+ * This component only renders on Android - it returns `null` on iOS where
76
+ * `<BreadLoaf />` already handles modal overlay via `FullWindowOverlay`.
77
+ *
75
78
  * This component only renders toasts - it does not accept configuration.
76
79
  * All styling/behavior is inherited from your root `<BreadLoaf />` config.
77
80
  *
@@ -80,19 +83,21 @@ export function BreadLoaf({
80
83
  * // app/(modal)/_layout.tsx
81
84
  * import { Stack } from 'expo-router';
82
85
  * import { ToastPortal } from 'react-native-bread';
83
- * import { Platform } from 'react-native';
84
86
  *
85
87
  * export default function ModalLayout() {
86
88
  * return (
87
89
  * <>
88
90
  * <Stack screenOptions={{ headerShown: false }} />
89
- * {Platform.OS === 'android' && <ToastPortal />}
91
+ * <ToastPortal />
90
92
  * </>
91
93
  * );
92
94
  * }
93
95
  * ```
94
96
  */
95
97
  export function ToastPortal() {
98
+ if (Platform.OS !== "android") {
99
+ return null;
100
+ }
96
101
  return /*#__PURE__*/_jsx(ToastContent, {});
97
102
  }
98
103
  const styles = StyleSheet.create({
@@ -56,6 +56,9 @@ export declare function BreadLoaf({ config }: BreadLoafProps): import("react/jsx
56
56
  * the main `<BreadLoaf />` won't be visible. Add `<ToastPortal />` inside your
57
57
  * modal layouts to show toasts above modal content.
58
58
  *
59
+ * This component only renders on Android - it returns `null` on iOS where
60
+ * `<BreadLoaf />` already handles modal overlay via `FullWindowOverlay`.
61
+ *
59
62
  * This component only renders toasts - it does not accept configuration.
60
63
  * All styling/behavior is inherited from your root `<BreadLoaf />` config.
61
64
  *
@@ -64,18 +67,17 @@ export declare function BreadLoaf({ config }: BreadLoafProps): import("react/jsx
64
67
  * // app/(modal)/_layout.tsx
65
68
  * import { Stack } from 'expo-router';
66
69
  * import { ToastPortal } from 'react-native-bread';
67
- * import { Platform } from 'react-native';
68
70
  *
69
71
  * export default function ModalLayout() {
70
72
  * return (
71
73
  * <>
72
74
  * <Stack screenOptions={{ headerShown: false }} />
73
- * {Platform.OS === 'android' && <ToastPortal />}
75
+ * <ToastPortal />
74
76
  * </>
75
77
  * );
76
78
  * }
77
79
  * ```
78
80
  */
79
- export declare function ToastPortal(): import("react/jsx-runtime").JSX.Element;
81
+ export declare function ToastPortal(): import("react/jsx-runtime").JSX.Element | null;
80
82
  export {};
81
83
  //# sourceMappingURL=toast-provider.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bread",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A lightweight toast library for React Native with premium feeling animations and complex gesture support",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",