@ecohouse/ui 0.1.22 → 0.1.23

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/dist/index.cjs CHANGED
@@ -2230,6 +2230,7 @@ var styles6 = reactNative.StyleSheet.create({
2230
2230
  var ICON_SIZE4 = 20;
2231
2231
  var ANIMATION_DURATION = 200;
2232
2232
  var OPTION_HORIZONTAL_PADDING = 16;
2233
+ var OPTION_MIN_WIDTH = 97;
2233
2234
  var SegmentedToggle = react.forwardRef(
2234
2235
  function SegmentedToggle2({
2235
2236
  options,
@@ -2255,12 +2256,9 @@ var SegmentedToggle = react.forwardRef(
2255
2256
  const resolvedClassName = className?.trim() || void 0;
2256
2257
  const setContainerRef = react.useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
2257
2258
  const progress = react.useRef(new reactNative.Animated.Value(selectedIndex)).current;
2258
- const [contentWidths, setContentWidths] = react.useState([0, 0]);
2259
2259
  const [containerWidth, setContainerWidth] = react.useState(0);
2260
2260
  const availableOptionWidth = Math.max(0, (containerWidth - 12) / 2);
2261
- const widestContentWidth = Math.max(...contentWidths);
2262
- const contentBasedOptionWidth = widestContentWidth > 0 ? widestContentWidth + OPTION_HORIZONTAL_PADDING * 2 : 0;
2263
- const optionWidth = fullWidth ? availableOptionWidth : contentBasedOptionWidth;
2261
+ const optionWidth = fullWidth ? availableOptionWidth : OPTION_MIN_WIDTH;
2264
2262
  const indicatorTranslateX = progress.interpolate({
2265
2263
  inputRange: [0, 1],
2266
2264
  outputRange: [0, optionWidth + 4]
@@ -2311,7 +2309,7 @@ var SegmentedToggle = react.forwardRef(
2311
2309
  ]
2312
2310
  }
2313
2311
  ) : null,
2314
- options.map(({ value: optionValue, label, icon: Icon2 }, index) => {
2312
+ options.map(({ value: optionValue, label, icon: Icon2 }) => {
2315
2313
  const selected = optionValue === selectedValue;
2316
2314
  const iconColor = selected ? colors.primary : colors.whiteAlpha20;
2317
2315
  const labelColor = selected ? colors.whiteAlpha86 : colors.whiteAlpha40;
@@ -2326,27 +2324,12 @@ var SegmentedToggle = react.forwardRef(
2326
2324
  accessibilityState: { selected, disabled },
2327
2325
  style: [
2328
2326
  styles7.option,
2329
- fullWidth ? styles7.optionFullWidth : optionWidth > 0 && { minWidth: optionWidth }
2327
+ fullWidth ? styles7.optionFullWidth : { width: OPTION_MIN_WIDTH, minWidth: OPTION_MIN_WIDTH }
2330
2328
  ],
2331
- children: /* @__PURE__ */ jsxRuntime.jsxs(
2332
- reactNative.View,
2333
- {
2334
- onLayout: (event) => {
2335
- const nextWidth = event.nativeEvent.layout.width;
2336
- setContentWidths((currentWidths) => {
2337
- if (currentWidths[index] === nextWidth) return currentWidths;
2338
- const nextWidths = [currentWidths[0], currentWidths[1]];
2339
- nextWidths[index] = nextWidth;
2340
- return nextWidths;
2341
- });
2342
- },
2343
- style: styles7.optionContent,
2344
- children: [
2345
- Icon2 ? /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: ICON_SIZE4, color: iconColor }) : null,
2346
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.label, { color: labelColor }], children: label })
2347
- ]
2348
- }
2349
- )
2329
+ children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.optionContent, children: [
2330
+ Icon2 ? /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: ICON_SIZE4, color: iconColor }) : null,
2331
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.label, { color: labelColor }], children: label })
2332
+ ] })
2350
2333
  },
2351
2334
  optionValue
2352
2335
  );