@oneplatformdev/react-native-uikit 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -313,6 +313,8 @@ Both are controlled: pass `value`/`onValueChange` to `Switch` or `checked`/`onVa
313
313
 
314
314
  `Checkbox` defaults to a 22-unit slightly rounded square with a built-in checkmark. Override `size`, state colors, `borderWidth`, and `iconSize`/`iconColor`. Use `shape="circle"` for a radius derived from its size, or `shape="square"` with `borderRadius` (including `0`) for custom corners. Supply an `icon` node to replace the built-in indicator; the consumer owns that node's size and color.
315
315
 
316
+ Use `interactive={false}` when Checkbox is only a visual indicator inside another pressable row. It renders a non-interactive View, does not handle touches, and leaves checked-state accessibility to the parent row. The default remains interactive.
317
+
316
318
  Owned source is available through `npx @oneplatformdev/react-native-uikit add switch` and `npx @oneplatformdev/react-native-uikit add checkbox`. Both are standalone components; Switch uses the existing `react-native-reanimated` peer.
317
319
 
318
320
  ## PhotoPreview and EmptyListView
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/react-native-uikit",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "bin": {
@@ -4,6 +4,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
4
4
  export interface CheckboxProps {
5
5
  checked: boolean;
6
6
  onValueChange?: (checked: boolean) => void;
7
+ interactive?: boolean;
7
8
  disabled?: boolean;
8
9
  size?: number;
9
10
  shape?: 'square' | 'circle';
@@ -8,6 +8,7 @@ import type { CheckboxProps } from '../types/types';
8
8
  export const Checkbox = ({
9
9
  checked,
10
10
  onValueChange,
11
+ interactive = true,
11
12
  disabled = false,
12
13
  size = 22,
13
14
  shape = 'square',
@@ -47,8 +48,29 @@ export const Checkbox = ({
47
48
  disabledBackgroundColor, disabledBorderColor, iconSize, iconColor,
48
49
  ]);
49
50
  const onPress = useCallback(() => {
50
- if (!disabled) onValueChange?.(!checked);
51
- }, [checked, disabled, onValueChange]);
51
+ if (interactive && !disabled) onValueChange?.(!checked);
52
+ }, [checked, disabled, interactive, onValueChange]);
53
+
54
+ const content = checked ? (
55
+ <View pointerEvents="none">
56
+ {icon === undefined ? <View style={styles.indicator} />
57
+ : typeof icon === 'string' || typeof icon === 'number' ? <Text>{icon}</Text> : icon}
58
+ </View>
59
+ ) : null;
60
+
61
+ if (!interactive) {
62
+ return (
63
+ <View
64
+ pointerEvents="none"
65
+ accessible={false}
66
+ accessibilityElementsHidden
67
+ importantForAccessibility="no-hide-descendants"
68
+ style={[styles.container, style]}
69
+ >
70
+ {content}
71
+ </View>
72
+ );
73
+ }
52
74
 
53
75
  return (
54
76
  <Pressable
@@ -61,12 +83,7 @@ export const Checkbox = ({
61
83
  onPress={onPress}
62
84
  style={[styles.container, style]}
63
85
  >
64
- {checked ? (
65
- <View pointerEvents="none">
66
- {icon === undefined ? <View style={styles.indicator} />
67
- : typeof icon === 'string' || typeof icon === 'number' ? <Text>{icon}</Text> : icon}
68
- </View>
69
- ) : null}
86
+ {content}
70
87
  </Pressable>
71
88
  );
72
89
  };