@namiml/expo-sdk 3.4.2-dev.202605300214 → 3.4.2-dev.202606042208

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiml/expo-sdk",
3
- "version": "3.4.2-dev.202605300214",
3
+ "version": "3.4.2-dev.202606042208",
4
4
  "type": "module",
5
5
  "description": "Nami Expo SDK — paywall and subscription management for Expo apps",
6
6
  "main": "./dist/index.cjs",
@@ -29,8 +29,8 @@
29
29
  "prepublishOnly": "yarn clean && yarn build:prod"
30
30
  },
31
31
  "dependencies": {
32
- "@namiml/expo-nami-iap": "3.4.2-dev.202605300214",
33
- "@namiml/sdk-core": "3.4.2-dev.202605300214",
32
+ "@namiml/expo-nami-iap": "3.4.2-dev.202606042208",
33
+ "@namiml/sdk-core": "3.4.2-dev.202606042208",
34
34
  "react-native-qrcode-svg": "^6.3.21",
35
35
  "react-native-safe-area-context": "^5.6.0",
36
36
  "react-native-svg": "^15.15.4"
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useState, useCallback } from 'react';
2
- import { View, StyleSheet, Dimensions, LayoutChangeEvent, ViewStyle } from 'react-native';
2
+ import { View, StyleSheet, Dimensions, LayoutChangeEvent, ScrollView, ViewStyle } from 'react-native';
3
3
  import { applyGridStyles, focusedStyleOverrides, parseSize } from '../../utils/styles';
4
4
  import { TemplateRenderer } from '../TemplateRenderer';
5
5
  import type { TComponent } from '@namiml/sdk-core';
@@ -41,11 +41,75 @@ export const NamiResponsiveGrid: React.FC<Props> = ({ component, scaleFactor, on
41
41
  const itemWidth = (usableWidth - gap * (columns - 1)) / columns;
42
42
 
43
43
  const repeatingBlocks = useMemo(() => getRepeatingListBlocks(ctx, component), [ctx, component]);
44
+
45
+ const isGrouped = !!(component.groupBy && component.groupHeaderTemplate);
46
+ const isHorizontalGrouped = !isVertical && isGrouped && repeatingBlocks.length > 0;
47
+
48
+ // Grouped horizontal: walk blocks and build per-group sections.
49
+ // Only used when isHorizontalGrouped; computed unconditionally to satisfy hook rules.
50
+ const groupSections = useMemo<Array<{ header: TComponent; items: TComponent[] }>>(() => {
51
+ if (!isHorizontalGrouped) return [];
52
+ const sections: Array<{ header: TComponent; items: TComponent[] }> = [];
53
+ let currentItems: TComponent[] = [];
54
+ repeatingBlocks.forEach((subArray: TComponent[]) => {
55
+ const isHeader =
56
+ subArray.length === 1 && (subArray[0] as any)?.__namiGroupHeader === true;
57
+ if (isHeader) {
58
+ currentItems = [];
59
+ sections.push({ header: subArray[0], items: currentItems });
60
+ } else {
61
+ subArray.forEach((child) => currentItems.push(child));
62
+ }
63
+ });
64
+ return sections;
65
+ }, [isHorizontalGrouped, repeatingBlocks]);
66
+
67
+ // Flat items list — used only by non-grouped paths.
44
68
  const items: TComponent[] = useMemo(
45
69
  () => (repeatingBlocks.length ? repeatingBlocks.flat() : (component.components ?? [])),
46
70
  [component.components, repeatingBlocks],
47
71
  );
48
72
 
73
+ if (isHorizontalGrouped) {
74
+ return (
75
+ <FocusScope onFocusWithinChange={setIsFocused}>
76
+ <View style={containerStyle} onLayout={onLayout}>
77
+ {groupSections.map((group, groupIdx) => (
78
+ <View key={(group.header as any).id ?? `group-${groupIdx}`} style={styles.groupSection}>
79
+ <View style={styles.groupHeader}>
80
+ <TemplateRenderer
81
+ component={group.header}
82
+ scaleFactor={scaleFactor}
83
+ onClose={onClose}
84
+ parentDirection={direction}
85
+ />
86
+ </View>
87
+ <ScrollView
88
+ horizontal
89
+ showsHorizontalScrollIndicator={false}
90
+ contentContainerStyle={styles.horizontalScrollContent}
91
+ >
92
+ {group.items.map((child: TComponent, itemIdx: number) => (
93
+ <View
94
+ key={(child as any).id ?? `group-${groupIdx}-item-${itemIdx}`}
95
+ style={{ marginRight: itemIdx < group.items.length - 1 ? gap : 0 }}
96
+ >
97
+ <TemplateRenderer
98
+ component={child}
99
+ scaleFactor={scaleFactor}
100
+ onClose={onClose}
101
+ parentDirection={direction}
102
+ />
103
+ </View>
104
+ ))}
105
+ </ScrollView>
106
+ </View>
107
+ ))}
108
+ </View>
109
+ </FocusScope>
110
+ );
111
+ }
112
+
49
113
  return (
50
114
  <FocusScope onFocusWithinChange={setIsFocused}>
51
115
  <View style={[containerStyle, styles.grid, isVertical ? styles.vertical : styles.horizontal]} onLayout={onLayout}>
@@ -72,4 +136,7 @@ const styles = StyleSheet.create({
72
136
  grid: { alignItems: 'center', justifyContent: 'center' },
73
137
  horizontal: { flexDirection: 'row', flexWrap: 'wrap', alignSelf: 'baseline' },
74
138
  vertical: { flexDirection: 'column', flexWrap: 'nowrap', alignSelf: 'baseline' },
139
+ groupSection: { width: '100%' },
140
+ groupHeader: { width: '100%' },
141
+ horizontalScrollContent: { flexDirection: 'row', flexWrap: 'nowrap' },
75
142
  });