@ruby-native/react 0.19.1 → 0.20.0

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.
Files changed (3) hide show
  1. package/index.d.ts +5 -3
  2. package/index.js +5 -3
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -241,13 +241,15 @@ export function NativeSubmitButton({ title, click }: {
241
241
  * @param {object} props
242
242
  * @param {number} [props.count] Sets both `home` and `tab` unless they are given explicitly.
243
243
  * @param {number} [props.home]
244
- * @param {number} [props.tab]
244
+ * @param {number | boolean | string} [props.tab] A count, `true` for a dot, or a short string.
245
+ * @param {Record<string, number | boolean | string>} [props.tabs] Badges by tab `key`.
245
246
  * @returns {import("react").ReactElement}
246
247
  */
247
- export function NativeBadge({ count, home, tab }: {
248
+ export function NativeBadge({ count, home, tab, tabs }: {
248
249
  count?: number | undefined;
249
250
  home?: number | undefined;
250
- tab?: number | undefined;
251
+ tab?: string | number | boolean | undefined;
252
+ tabs?: Record<string, string | number | boolean> | undefined;
251
253
  }): import("react").ReactElement;
252
254
  /**
253
255
  * A visible button that pops the native navigation stack on tap. Renders a
package/index.js CHANGED
@@ -404,16 +404,18 @@ export function NativeSubmitButton({ title = "Save", click = "[type='submit']" }
404
404
  * @param {object} props
405
405
  * @param {number} [props.count] Sets both `home` and `tab` unless they are given explicitly.
406
406
  * @param {number} [props.home]
407
- * @param {number} [props.tab]
407
+ * @param {number | boolean | string} [props.tab] A count, `true` for a dot, or a short string.
408
+ * @param {Record<string, number | boolean | string>} [props.tabs] Badges by tab `key`.
408
409
  * @returns {import("react").ReactElement}
409
410
  */
410
- export function NativeBadge({ count, home, tab }) {
411
+ export function NativeBadge({ count, home, tab, tabs }) {
411
412
  if (count != null && home == null) home = count
412
413
  if (count != null && tab == null) tab = count
413
414
  /** @type {Record<string, any>} */
414
415
  const props = { "data-native-badge": "", hidden: true }
415
416
  if (home != null) props["data-native-badge-home"] = home
416
- if (tab != null) props["data-native-badge-tab"] = tab
417
+ if (tab != null) props["data-native-badge-tab"] = String(tab)
418
+ if (tabs != null) props["data-native-badge-tabs"] = JSON.stringify(tabs)
417
419
  return createElement("div", props)
418
420
  }
419
421
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruby-native/react",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "React components for Ruby Native",
5
5
  "type": "module",
6
6
  "main": "index.js",