@dloizides/ui-nav 1.33.0 → 1.34.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.
package/dist/index.mjs CHANGED
@@ -2260,7 +2260,8 @@ var DarkModeControl = ({
2260
2260
  regionLabel,
2261
2261
  variant = "segmented",
2262
2262
  testID,
2263
- containerStyle
2263
+ containerStyle,
2264
+ showLabel = false
2264
2265
  }) => {
2265
2266
  const { theme } = useUi();
2266
2267
  const colors = theme.colors;
@@ -2274,6 +2275,7 @@ var DarkModeControl = ({
2274
2275
  if (next !== void 0) onChange(next.value);
2275
2276
  }, [options, currentIndex, onChange]);
2276
2277
  if (options.length === 0 || current === void 0) return null;
2278
+ const labelVisible = (option) => showLabel || typeof option.renderIcon !== "function";
2277
2279
  if (variant === "cycle") {
2278
2280
  const iconColor = colors.text;
2279
2281
  return /* @__PURE__ */ jsx(View, { "aria-label": regionLabel, style: containerStyle, children: /* @__PURE__ */ jsxs(
@@ -2287,7 +2289,7 @@ var DarkModeControl = ({
2287
2289
  onPress: advance,
2288
2290
  children: [
2289
2291
  typeof current.renderIcon === "function" ? current.renderIcon(iconColor, DARK_MODE_ICON_SIZE) : null,
2290
- /* @__PURE__ */ jsx(Text, { style: [darkModeStyles.cycleText, { color: colors.text }], children: current.label })
2292
+ labelVisible(current) ? /* @__PURE__ */ jsx(Text, { style: [darkModeStyles.cycleText, { color: colors.text }], children: current.label }) : null
2291
2293
  ]
2292
2294
  }
2293
2295
  ) });
@@ -2312,7 +2314,7 @@ var DarkModeControl = ({
2312
2314
  onPress: () => onChange(option.value),
2313
2315
  children: [
2314
2316
  typeof option.renderIcon === "function" ? option.renderIcon(textColor, DARK_MODE_ICON_SIZE) : null,
2315
- /* @__PURE__ */ jsx(Text, { style: [darkModeStyles.segmentText, { color: textColor }], children: option.label })
2317
+ labelVisible(option) ? /* @__PURE__ */ jsx(Text, { style: [darkModeStyles.segmentText, { color: textColor }], children: option.label }) : null
2316
2318
  ]
2317
2319
  },
2318
2320
  option.value