clox-picker 0.1.2 → 0.1.3

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.
@@ -124,6 +124,10 @@ class CloxPickerView(context: Context, appContext: AppContext) : ExpoView(contex
124
124
  TabItem(id, name, iconUri, iconWidth, iconHeight)
125
125
  }
126
126
  if (tabs.isEmpty()) tabs = listOf(TabItem(0, "Tab", null, null, null))
127
+ // Re-validate selectedIndex against the new tabs count
128
+ if (tabs.isNotEmpty()) {
129
+ selectedIndex = selectedIndex.coerceIn(0, tabs.size - 1)
130
+ }
127
131
  buildSegments()
128
132
  }
129
133
 
@@ -133,7 +137,14 @@ class CloxPickerView(context: Context, appContext: AppContext) : ExpoView(contex
133
137
  }
134
138
 
135
139
  fun setValue(value: Int) {
136
- val newIndex = value.coerceIn(0, (tabs.size - 1).coerceAtLeast(0))
140
+ // If tabs haven't been set yet, store the value as-is (will be validated when tabs are set)
141
+ // Otherwise, clamp to valid range
142
+ val newIndex = if (tabs.isEmpty()) {
143
+ value
144
+ } else {
145
+ value.coerceIn(0, tabs.size - 1)
146
+ }
147
+
137
148
  if (newIndex != selectedIndex) {
138
149
  selectedIndex = newIndex
139
150
  animateThumbTo(selectedIndex)
package/example/App.tsx CHANGED
@@ -29,7 +29,7 @@ const PICKER_HEIGHT = 90;
29
29
  export default function App() {
30
30
  const {width, height} = useWindowDimensions();
31
31
  const colorScheme = useColorScheme();
32
- const [liquidIndex, setLiquidIndex] = useState(0);
32
+ const [liquidIndex, setLiquidIndex] = useState(2);
33
33
  const [standardIndex, setStandardIndex] = useState(0);
34
34
  const [androidIndex, setAndroidIndex] = useState(0);
35
35
  const [currentScheme, setCurrentScheme] = useState<'light' | 'dark' | null>(null);
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - CloxPicker (0.1.1):
2
+ - CloxPicker (0.1.2):
3
3
  - ExpoModulesCore
4
4
  - EXConstants (18.0.13):
5
5
  - ExpoModulesCore
@@ -2123,7 +2123,7 @@ EXTERNAL SOURCES:
2123
2123
  :path: "../node_modules/react-native/ReactCommon/yoga"
2124
2124
 
2125
2125
  SPEC CHECKSUMS:
2126
- CloxPicker: 32e274d5fe7d6ed57fc5b7ee5d64410abe5e1f63
2126
+ CloxPicker: 2230a7a323a09d77ac86c4a61fab545554f1838f
2127
2127
  EXConstants: 3feb66fd1d94202fc1f0946d74e029d8b224b60e
2128
2128
  EXJSONUtils: 1d3e4590438c3ee593684186007028a14b3686cd
2129
2129
  EXManifests: 83ef0844fcf06d6099b12a7bdbd7d36fc0e1dd16
@@ -8,11 +8,11 @@
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
10
  13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
11
- 3BC360054BB0CFDE5EBC6822 /* libPods-cloxpickerexample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F82CC5811EED89D1BF913D4 /* libPods-cloxpickerexample.a */; };
12
11
  3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; };
13
- A839A09C18884B519C4809C3 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 460ED5AABDC11D8AA01F7115 /* PrivacyInfo.xcprivacy */; };
12
+ 6D60B6DE6807345550D89DB0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 515D0E48D4C6FB6251E34D77 /* PrivacyInfo.xcprivacy */; };
13
+ 9E00A3C2E448C751E924C5B6 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECD77C7F2F5414CA8425C4F9 /* ExpoModulesProvider.swift */; };
14
14
  BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
15
- BC24888CAA5F23C677C48749 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5E230ACF65FF19830DBAAE3 /* ExpoModulesProvider.swift */; };
15
+ E7390BD80697FEB360F986A7 /* libPods-cloxpickerexample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DACA0C66768CDB757B10EDDD /* libPods-cloxpickerexample.a */; };
16
16
  F11748422D0307B40044C1D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F11748412D0307B40044C1D9 /* AppDelegate.swift */; };
17
17
  /* End PBXBuildFile section */
18
18
 
@@ -20,13 +20,13 @@
20
20
  13B07F961A680F5B00A75B9A /* cloxpickerexample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cloxpickerexample.app; sourceTree = BUILT_PRODUCTS_DIR; };
21
21
  13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = cloxpickerexample/Images.xcassets; sourceTree = "<group>"; };
22
22
  13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = cloxpickerexample/Info.plist; sourceTree = "<group>"; };
23
- 1E843B0CC6141138AC3C7B5A /* Pods-cloxpickerexample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cloxpickerexample.release.xcconfig"; path = "Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample.release.xcconfig"; sourceTree = "<group>"; };
24
- 22B8E0CFFBD3176968D03CA4 /* Pods-cloxpickerexample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cloxpickerexample.debug.xcconfig"; path = "Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample.debug.xcconfig"; sourceTree = "<group>"; };
25
- 460ED5AABDC11D8AA01F7115 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = cloxpickerexample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
26
- 5F82CC5811EED89D1BF913D4 /* libPods-cloxpickerexample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-cloxpickerexample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
23
+ 3E28B125BC2D19E6432E207C /* Pods-cloxpickerexample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cloxpickerexample.release.xcconfig"; path = "Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample.release.xcconfig"; sourceTree = "<group>"; };
24
+ 515D0E48D4C6FB6251E34D77 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = cloxpickerexample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
27
25
  AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = cloxpickerexample/SplashScreen.storyboard; sourceTree = "<group>"; };
28
26
  BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
29
- E5E230ACF65FF19830DBAAE3 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-cloxpickerexample/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
27
+ DA3650119D47B51A62404F45 /* Pods-cloxpickerexample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cloxpickerexample.debug.xcconfig"; path = "Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample.debug.xcconfig"; sourceTree = "<group>"; };
28
+ DACA0C66768CDB757B10EDDD /* libPods-cloxpickerexample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-cloxpickerexample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
29
+ ECD77C7F2F5414CA8425C4F9 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-cloxpickerexample/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
30
30
  ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
31
31
  F11748412D0307B40044C1D9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = cloxpickerexample/AppDelegate.swift; sourceTree = "<group>"; };
32
32
  F11748442D0722820044C1D9 /* cloxpickerexample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "cloxpickerexample-Bridging-Header.h"; path = "cloxpickerexample/cloxpickerexample-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -37,7 +37,7 @@
37
37
  isa = PBXFrameworksBuildPhase;
38
38
  buildActionMask = 2147483647;
39
39
  files = (
40
- 3BC360054BB0CFDE5EBC6822 /* libPods-cloxpickerexample.a in Frameworks */,
40
+ E7390BD80697FEB360F986A7 /* libPods-cloxpickerexample.a in Frameworks */,
41
41
  );
42
42
  runOnlyForDeploymentPostprocessing = 0;
43
43
  };
@@ -53,7 +53,7 @@
53
53
  13B07FB51A68108700A75B9A /* Images.xcassets */,
54
54
  13B07FB61A68108700A75B9A /* Info.plist */,
55
55
  AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */,
56
- 460ED5AABDC11D8AA01F7115 /* PrivacyInfo.xcprivacy */,
56
+ 515D0E48D4C6FB6251E34D77 /* PrivacyInfo.xcprivacy */,
57
57
  );
58
58
  name = cloxpickerexample;
59
59
  sourceTree = "<group>";
@@ -62,25 +62,19 @@
62
62
  isa = PBXGroup;
63
63
  children = (
64
64
  ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
65
- 5F82CC5811EED89D1BF913D4 /* libPods-cloxpickerexample.a */,
65
+ DACA0C66768CDB757B10EDDD /* libPods-cloxpickerexample.a */,
66
66
  );
67
67
  name = Frameworks;
68
68
  sourceTree = "<group>";
69
69
  };
70
- 35105F46911B9C6393A39506 /* cloxpickerexample */ = {
70
+ 4BB04C227EE42226DB6018D2 /* Pods */ = {
71
71
  isa = PBXGroup;
72
72
  children = (
73
- E5E230ACF65FF19830DBAAE3 /* ExpoModulesProvider.swift */,
73
+ DA3650119D47B51A62404F45 /* Pods-cloxpickerexample.debug.xcconfig */,
74
+ 3E28B125BC2D19E6432E207C /* Pods-cloxpickerexample.release.xcconfig */,
74
75
  );
75
- name = cloxpickerexample;
76
- sourceTree = "<group>";
77
- };
78
- 42B3C011BB99E0470F0D7313 /* ExpoModulesProviders */ = {
79
- isa = PBXGroup;
80
- children = (
81
- 35105F46911B9C6393A39506 /* cloxpickerexample */,
82
- );
83
- name = ExpoModulesProviders;
76
+ name = Pods;
77
+ path = Pods;
84
78
  sourceTree = "<group>";
85
79
  };
86
80
  832341AE1AAA6A7D00B99B32 /* Libraries */ = {
@@ -97,8 +91,8 @@
97
91
  832341AE1AAA6A7D00B99B32 /* Libraries */,
98
92
  83CBBA001A601CBA00E9B192 /* Products */,
99
93
  2D16E6871FA4F8E400B85C8A /* Frameworks */,
100
- E4D791C6B2AB8585F051B828 /* Pods */,
101
- 42B3C011BB99E0470F0D7313 /* ExpoModulesProviders */,
94
+ 4BB04C227EE42226DB6018D2 /* Pods */,
95
+ D6AE54B70D5F7EF429EC83E1 /* ExpoModulesProviders */,
102
96
  );
103
97
  indentWidth = 2;
104
98
  sourceTree = "<group>";
@@ -113,6 +107,14 @@
113
107
  name = Products;
114
108
  sourceTree = "<group>";
115
109
  };
110
+ 95E4A94D9637BA1B96DDF31A /* cloxpickerexample */ = {
111
+ isa = PBXGroup;
112
+ children = (
113
+ ECD77C7F2F5414CA8425C4F9 /* ExpoModulesProvider.swift */,
114
+ );
115
+ name = cloxpickerexample;
116
+ sourceTree = "<group>";
117
+ };
116
118
  BB2F792B24A3F905000567C9 /* Supporting */ = {
117
119
  isa = PBXGroup;
118
120
  children = (
@@ -122,14 +124,12 @@
122
124
  path = cloxpickerexample/Supporting;
123
125
  sourceTree = "<group>";
124
126
  };
125
- E4D791C6B2AB8585F051B828 /* Pods */ = {
127
+ D6AE54B70D5F7EF429EC83E1 /* ExpoModulesProviders */ = {
126
128
  isa = PBXGroup;
127
129
  children = (
128
- 22B8E0CFFBD3176968D03CA4 /* Pods-cloxpickerexample.debug.xcconfig */,
129
- 1E843B0CC6141138AC3C7B5A /* Pods-cloxpickerexample.release.xcconfig */,
130
+ 95E4A94D9637BA1B96DDF31A /* cloxpickerexample */,
130
131
  );
131
- name = Pods;
132
- path = Pods;
132
+ name = ExpoModulesProviders;
133
133
  sourceTree = "<group>";
134
134
  };
135
135
  /* End PBXGroup section */
@@ -140,13 +140,13 @@
140
140
  buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "cloxpickerexample" */;
141
141
  buildPhases = (
142
142
  08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */,
143
- DA6B1CE1579FD5E375F73D80 /* [Expo] Configure project */,
143
+ E9EEC3F2A013D05DDDABD8F7 /* [Expo] Configure project */,
144
144
  13B07F871A680F5B00A75B9A /* Sources */,
145
145
  13B07F8C1A680F5B00A75B9A /* Frameworks */,
146
146
  13B07F8E1A680F5B00A75B9A /* Resources */,
147
147
  00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
148
148
  800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */,
149
- A856019C87096E114C16EA9D /* [CP] Embed Pods Frameworks */,
149
+ D0BCA59BDC991A129B60063A /* [CP] Embed Pods Frameworks */,
150
150
  );
151
151
  buildRules = (
152
152
  );
@@ -198,7 +198,7 @@
198
198
  BB2F792D24A3F905000567C9 /* Expo.plist in Resources */,
199
199
  13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
200
200
  3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */,
201
- A839A09C18884B519C4809C3 /* PrivacyInfo.xcprivacy in Resources */,
201
+ 6D60B6DE6807345550D89DB0 /* PrivacyInfo.xcprivacy in Resources */,
202
202
  );
203
203
  runOnlyForDeploymentPostprocessing = 0;
204
204
  };
@@ -274,7 +274,7 @@
274
274
  shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample-resources.sh\"\n";
275
275
  showEnvVarsInLog = 0;
276
276
  };
277
- A856019C87096E114C16EA9D /* [CP] Embed Pods Frameworks */ = {
277
+ D0BCA59BDC991A129B60063A /* [CP] Embed Pods Frameworks */ = {
278
278
  isa = PBXShellScriptBuildPhase;
279
279
  buildActionMask = 2147483647;
280
280
  files = (
@@ -296,7 +296,7 @@
296
296
  shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-cloxpickerexample/Pods-cloxpickerexample-frameworks.sh\"\n";
297
297
  showEnvVarsInLog = 0;
298
298
  };
299
- DA6B1CE1579FD5E375F73D80 /* [Expo] Configure project */ = {
299
+ E9EEC3F2A013D05DDDABD8F7 /* [Expo] Configure project */ = {
300
300
  isa = PBXShellScriptBuildPhase;
301
301
  alwaysOutOfDate = 1;
302
302
  buildActionMask = 2147483647;
@@ -328,7 +328,7 @@
328
328
  buildActionMask = 2147483647;
329
329
  files = (
330
330
  F11748422D0307B40044C1D9 /* AppDelegate.swift in Sources */,
331
- BC24888CAA5F23C677C48749 /* ExpoModulesProvider.swift in Sources */,
331
+ 9E00A3C2E448C751E924C5B6 /* ExpoModulesProvider.swift in Sources */,
332
332
  );
333
333
  runOnlyForDeploymentPostprocessing = 0;
334
334
  };
@@ -337,7 +337,7 @@
337
337
  /* Begin XCBuildConfiguration section */
338
338
  13B07F941A680F5B00A75B9A /* Debug */ = {
339
339
  isa = XCBuildConfiguration;
340
- baseConfigurationReference = 22B8E0CFFBD3176968D03CA4 /* Pods-cloxpickerexample.debug.xcconfig */;
340
+ baseConfigurationReference = DA3650119D47B51A62404F45 /* Pods-cloxpickerexample.debug.xcconfig */;
341
341
  buildSettings = {
342
342
  ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
343
343
  CLANG_ENABLE_MODULES = YES;
@@ -376,7 +376,7 @@
376
376
  };
377
377
  13B07F951A680F5B00A75B9A /* Release */ = {
378
378
  isa = XCBuildConfiguration;
379
- baseConfigurationReference = 1E843B0CC6141138AC3C7B5A /* Pods-cloxpickerexample.release.xcconfig */;
379
+ baseConfigurationReference = 3E28B125BC2D19E6432E207C /* Pods-cloxpickerexample.release.xcconfig */;
380
380
  buildSettings = {
381
381
  ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
382
382
  CLANG_ENABLE_MODULES = YES;
@@ -328,6 +328,10 @@ public class CloxPickerView: ExpoView {
328
328
  if currentTabs.isEmpty {
329
329
  currentTabs = [CloxPickerTabItem(id: 0, name: "Tab", iconUri: nil, iconWidth: nil, iconHeight: nil)]
330
330
  }
331
+ // Re-validate currentValue against the new tabs count
332
+ if currentTabs.count > 0 {
333
+ currentValue = max(0, min(currentValue, currentTabs.count - 1))
334
+ }
331
335
  updateHostingView()
332
336
  }
333
337
 
@@ -337,7 +341,15 @@ public class CloxPickerView: ExpoView {
337
341
  }
338
342
 
339
343
  func setValue(_ value: Int) {
340
- let newValue = max(0, min(value, currentTabs.count - 1))
344
+ // If tabs haven't been set yet, store the value as-is (will be validated when tabs are set)
345
+ // Otherwise, clamp to valid range
346
+ let newValue: Int
347
+ if currentTabs.isEmpty {
348
+ newValue = value
349
+ } else {
350
+ newValue = max(0, min(value, currentTabs.count - 1))
351
+ }
352
+
341
353
  if newValue != currentValue {
342
354
  currentValue = newValue
343
355
  // Force update the hosting view to reflect the new value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clox-picker",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Clox Picker native module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",