jfs-components 0.0.61 → 0.0.62

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.
@@ -8,7 +8,10 @@ import React from 'react';
8
8
  */
9
9
  export function cloneChildrenWithModes(children, modes, forcedModes) {
10
10
  const result = [];
11
- React.Children.forEach(children, child => {
11
+
12
+ // toArray assigns stable keys to sibling lists and flattens top-level Fragments.
13
+ // Raw arrays from flattenChildren / concat have no keys; forEach alone does not add them.
14
+ React.Children.forEach(React.Children.toArray(children), child => {
12
15
  if (! /*#__PURE__*/React.isValidElement(child)) {
13
16
  if (child !== null && child !== undefined) {
14
17
  result.push(child);
@@ -20,7 +23,7 @@ export function cloneChildrenWithModes(children, modes, forcedModes) {
20
23
  // so recurse into their children and process each one individually.
21
24
  if (child.type === React.Fragment) {
22
25
  const fragment = child;
23
- result.push(...cloneChildrenWithModes(fragment.props.children, modes, forcedModes));
26
+ result.push(...cloneChildrenWithModes(React.Children.toArray(fragment.props.children ?? null), modes, forcedModes));
24
27
  return;
25
28
  }
26
29
  const childChildren = child.props?.children;
@@ -48,7 +51,10 @@ export function cloneChildrenWithModes(children, modes, forcedModes) {
48
51
  modes: mergedModes
49
52
  }, processedChildren));
50
53
  });
51
- return result;
54
+
55
+ // Ensure the returned list always has keys for each entry (cloneElement can drop
56
+ // keys in some paths; Views that render this array require keyed siblings).
57
+ return React.Children.toArray(result);
52
58
  }
53
59
 
54
60
  /**
@@ -40,20 +40,5 @@ export declare const JFSThemeProvider: React.FC<JFSThemeProviderProps>;
40
40
  * }
41
41
  */
42
42
  export declare const useTokens: () => TokenContextType;
43
- /**
44
- * Returns the JFS font map. The TTF is encapsulated within the package at
45
- * src/assets/fonts/JioType Var.ttf (included via package.json "files").
46
- * Call this inside load functions to avoid top-level require errors if font missing.
47
- */
48
- export declare const getJFSFonts: () => {
49
- readonly 'JioType Var': any;
50
- };
51
- /**
52
- * Hook for loading JFS fonts using expo-font. This improves Android font support by explicitly registering
53
- * the custom 'JioType Var' font (encapsulated in the package) via Font.loadAsync before components render.
54
- * Without it, Android defaults to Roboto. Call at app root (e.g. before JFSThemeProvider). Returns loaded state.
55
- * See getJFSFonts() for direct use with Font.loadAsync. Handles missing font gracefully for web/Storybook.
56
- */
57
- export declare function useJFSFonts(): boolean;
58
43
  export {};
59
44
  //# sourceMappingURL=JFSThemeProvider.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * Auto-generated from SVG files in src/icons/
5
5
  * DO NOT EDIT MANUALLY - Run "npm run icons:generate" to regenerate
6
6
  *
7
- * Generated: 2026-04-14T20:53:41.145Z
7
+ * Generated: 2026-04-15T11:47:37.104Z
8
8
  */
9
9
  export declare const iconRegistry: Record<string, {
10
10
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jfs-components",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "description": "React Native Jio Finance Components Library",
5
5
  "author": "sunshuaiqi@gmail.com",
6
6
  "license": "MIT",
@@ -92,9 +92,8 @@ function ListGroup({
92
92
  ...(listGroupSlot ? flattenChildren(listGroupSlot) : []),
93
93
  ...(children ? flattenChildren(children) : []),
94
94
  ]
95
- const keyedItems = React.Children.toArray(rawItems)
96
- const processedSlot = keyedItems.length > 0
97
- ? cloneChildrenWithModes(keyedItems, modes)
95
+ const processedSlot = rawItems.length > 0
96
+ ? cloneChildrenWithModes(rawItems, modes)
98
97
  : null
99
98
 
100
99
  // Use provided accessibilityLabel or fall back to label
@@ -1,7 +1,6 @@
1
1
 
2
- import React, { createContext, useContext, ReactNode, useMemo, useState, useEffect } from 'react';
2
+ import React, { createContext, useContext, ReactNode, useMemo } from 'react';
3
3
  import { getVariableByName } from './figma-variables-resolver';
4
- import * as Font from 'expo-font';
5
4
 
6
5
  /**
7
6
  * Shape of the TokenContext
@@ -77,38 +76,3 @@ export const useTokens = (): TokenContextType => {
77
76
  }
78
77
  return context;
79
78
  };
80
-
81
- /**
82
- * Returns the JFS font map. The TTF is encapsulated within the package at
83
- * src/assets/fonts/JioType Var.ttf (included via package.json "files").
84
- * Call this inside load functions to avoid top-level require errors if font missing.
85
- */
86
- export const getJFSFonts = () => ({
87
- 'JioType Var': require('../assets/fonts/JioType Var.ttf'),
88
- } as const);
89
-
90
- /**
91
- * Hook for loading JFS fonts using expo-font. This improves Android font support by explicitly registering
92
- * the custom 'JioType Var' font (encapsulated in the package) via Font.loadAsync before components render.
93
- * Without it, Android defaults to Roboto. Call at app root (e.g. before JFSThemeProvider). Returns loaded state.
94
- * See getJFSFonts() for direct use with Font.loadAsync. Handles missing font gracefully for web/Storybook.
95
- */
96
- export function useJFSFonts(): boolean {
97
- const [fontsLoaded, setFontsLoaded] = useState(false);
98
-
99
- useEffect(() => {
100
- async function loadJFSFonts() {
101
- try {
102
- await Font.loadAsync(getJFSFonts());
103
- setFontsLoaded(true);
104
- } catch (error) {
105
- console.warn('Failed to load JFS fonts (this is common in web/Storybook or if font file missing):', error);
106
- setFontsLoaded(true);
107
- }
108
- }
109
-
110
- loadJFSFonts();
111
- }, []);
112
-
113
- return fontsLoaded;
114
- }
@@ -4,7 +4,7 @@
4
4
  * Auto-generated from SVG files in src/icons/
5
5
  * DO NOT EDIT MANUALLY - Run "npm run icons:generate" to regenerate
6
6
  *
7
- * Generated: 2026-04-14T20:53:41.145Z
7
+ * Generated: 2026-04-15T11:47:37.104Z
8
8
  */
9
9
 
10
10
  // Icon name to SVG data mapping
@@ -11,7 +11,9 @@ export function cloneChildrenWithModes(
11
11
  ): React.ReactNode[] {
12
12
  const result: React.ReactNode[] = [];
13
13
 
14
- React.Children.forEach(children, (child) => {
14
+ // toArray assigns stable keys to sibling lists and flattens top-level Fragments.
15
+ // Raw arrays from flattenChildren / concat have no keys; forEach alone does not add them.
16
+ React.Children.forEach(React.Children.toArray(children), (child) => {
15
17
  if (!React.isValidElement(child)) {
16
18
  if (child !== null && child !== undefined) {
17
19
  result.push(child);
@@ -23,7 +25,13 @@ export function cloneChildrenWithModes(
23
25
  // so recurse into their children and process each one individually.
24
26
  if (child.type === React.Fragment) {
25
27
  const fragment = child as React.ReactElement<{ children?: React.ReactNode }>;
26
- result.push(...cloneChildrenWithModes(fragment.props.children, modes, forcedModes));
28
+ result.push(
29
+ ...cloneChildrenWithModes(
30
+ React.Children.toArray(fragment.props.children ?? null),
31
+ modes,
32
+ forcedModes
33
+ )
34
+ );
27
35
  return;
28
36
  }
29
37
 
@@ -58,7 +66,9 @@ export function cloneChildrenWithModes(
58
66
  );
59
67
  });
60
68
 
61
- return result;
69
+ // Ensure the returned list always has keys for each entry (cloneElement can drop
70
+ // keys in some paths; Views that render this array require keyed siblings).
71
+ return React.Children.toArray(result);
62
72
  }
63
73
 
64
74
  /**