@delacour/react-native-ui 0.9.0-alpha.20261109185803 → 0.9.0-alpha.20261109201759

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": "@delacour/react-native-ui",
3
- "version": "0.9.0-alpha.20261109185803",
3
+ "version": "0.9.0-alpha.20261109201759",
4
4
  "description": "React Native UI components — Uniwind, Reanimated, Gesture Handler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -186,8 +186,8 @@
186
186
  "expo-blur": ">=15",
187
187
  "@maplibre/maplibre-react-native": "^11.5.0",
188
188
  "@central-icons-react-native/round-outlined-radius-1-stroke-1.5": "^1.1",
189
- "@delacour/react-native-bottom-sheet": "0.9.0-alpha.20261109185803",
190
- "@delacour/react-native-charts": "0.9.0-alpha.20261109185803",
189
+ "@delacour/react-native-bottom-sheet": "0.9.0-alpha.20261109201759",
190
+ "@delacour/react-native-charts": "0.9.0-alpha.20261109201759",
191
191
  "@legendapp/list": ">=3.3",
192
192
  "react-native-skia": ">=3.9.0",
193
193
  "expo-linear-gradient": ">=15",
@@ -11,10 +11,14 @@ carries nothing a screen reader can use, and announcing them buries the rows.
11
11
  | --- | --- |
12
12
  | `index.ts` | → `@delacour/react-native-ui/separator` |
13
13
  | `separator.tsx` | The `tv()` and the component, in one file |
14
- | `separator.render.test.tsx` | Mounted under Jest — hidden from assistive technology on both axes, props forwarded, siblings stay readable |
14
+ | `separator.render.test.tsx` | Mounted under Jest — hidden from assistive technology on both axes, caller overrides ignored, props forwarded, siblings stay readable |
15
15
 
16
16
  ## Design
17
17
 
18
+ - **The accessibility props are fixed.** `accessible`,
19
+ `accessibilityElementsHidden` and `importantForAccessibility` are omitted from
20
+ `SeparatorProps`, and the component spreads `{...props}` before it sets them,
21
+ so a caller cannot unhide the line.
18
22
  - **`separatorVariants` lives in `separator.tsx`**, above the component, not in a
19
23
  `*.variants.ts` sibling — the pattern C carve-out. That file imports React
20
24
  Native, so the `tv()` is not unit-testable; the exclusive-axis and
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, test } from "@jest/globals";
2
- import { Text } from "react-native";
2
+ import { Text, type ViewProps } from "react-native";
3
3
  import { renderWithProviders, screen } from "../../test/render";
4
- import { Separator } from "./separator";
4
+ import { Separator, type SeparatorProps } from "./separator";
5
5
 
6
6
  describe("Separator", () => {
7
7
  test("renders its host view, forwarding testID", async () => {
@@ -40,4 +40,28 @@ describe("Separator", () => {
40
40
  expect(screen.getByText("Above")).toBeOnTheScreen();
41
41
  expect(screen.getByText("Below")).toBeOnTheScreen();
42
42
  });
43
+
44
+ test("keeps its hidden props when a caller passes overrides", async () => {
45
+ const overrides: ViewProps = {
46
+ accessibilityElementsHidden: false,
47
+ accessible: true,
48
+ importantForAccessibility: "yes",
49
+ };
50
+ await renderWithProviders(<Separator testID="rule" {...overrides} />);
51
+ expect(screen.queryByTestId("rule")).not.toBeOnTheScreen();
52
+ const rule = screen.getByTestId("rule", { includeHiddenElements: true });
53
+ expect(rule.props.accessible).toBe(false);
54
+ expect(rule.props.accessibilityElementsHidden).toBe(true);
55
+ expect(rule.props.importantForAccessibility).toBe("no-hide-descendants");
56
+ });
57
+
58
+ test("leaves the hidden props out of SeparatorProps", () => {
59
+ // @ts-expect-error `accessible` is not part of SeparatorProps
60
+ const accessible: SeparatorProps = { accessible: true };
61
+ // @ts-expect-error `accessibilityElementsHidden` is not part of SeparatorProps
62
+ const elementsHidden: SeparatorProps = { accessibilityElementsHidden: false };
63
+ // @ts-expect-error `importantForAccessibility` is not part of SeparatorProps
64
+ const important: SeparatorProps = { importantForAccessibility: "yes" };
65
+ expect([accessible, elementsHidden, important]).toHaveLength(3);
66
+ });
43
67
  });
@@ -44,7 +44,13 @@ export const separatorVariants = tv({
44
44
 
45
45
  export type SeparatorVariantProps = VariantProps<typeof separatorVariants>;
46
46
 
47
- export type SeparatorProps = ViewProps & {
47
+ /**
48
+ * The props that hide a separator from assistive technology. The component
49
+ * always sets them, so they are not part of `SeparatorProps`.
50
+ */
51
+ type SeparatorHiddenProps = "accessible" | "accessibilityElementsHidden" | "importantForAccessibility";
52
+
53
+ export type SeparatorProps = Omit<ViewProps, SeparatorHiddenProps> & {
48
54
  /** Axis the line runs along. A vertical separator needs a parent with a height. */
49
55
  orientation?: SeparatorOrientation;
50
56
  className?: string;
@@ -72,13 +78,15 @@ export type SeparatorProps = ViewProps & {
72
78
  * </View>
73
79
  */
74
80
  export function Separator({ orientation = "horizontal", className, ...props }: SeparatorProps): ReactElement {
81
+ // `{...props}` goes first, so the hidden props below win even when a caller
82
+ // casts past `SeparatorProps` and passes them anyway.
75
83
  return (
76
84
  <View
85
+ {...props}
77
86
  accessibilityElementsHidden
78
87
  accessible={false}
79
88
  className={separatorVariants({ className, orientation })}
80
89
  importantForAccessibility="no-hide-descendants"
81
- {...props}
82
90
  />
83
91
  );
84
92
  }