react-native-platform-components 0.6.1 → 0.8.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.
Files changed (62) hide show
  1. package/README.md +259 -44
  2. package/android/src/main/java/com/platformcomponents/PCLiquidGlassView.kt +84 -0
  3. package/android/src/main/java/com/platformcomponents/PCLiquidGlassViewManager.kt +52 -0
  4. package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +241 -0
  5. package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +105 -0
  6. package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +2 -0
  7. package/ios/PCDatePickerView.swift +16 -13
  8. package/ios/PCLiquidGlass.h +10 -0
  9. package/ios/PCLiquidGlass.mm +140 -0
  10. package/ios/PCLiquidGlass.swift +354 -0
  11. package/ios/PCSegmentedControl.h +10 -0
  12. package/ios/PCSegmentedControl.mm +194 -0
  13. package/ios/PCSegmentedControl.swift +200 -0
  14. package/ios/PCSelectionMenu.swift +1 -1
  15. package/lib/commonjs/LiquidGlass.js +72 -0
  16. package/lib/commonjs/LiquidGlass.js.map +1 -0
  17. package/lib/commonjs/LiquidGlassNativeComponent.ts +110 -0
  18. package/lib/commonjs/SegmentedControl.js +93 -0
  19. package/lib/commonjs/SegmentedControl.js.map +1 -0
  20. package/lib/commonjs/SegmentedControlNativeComponent.ts +79 -0
  21. package/lib/commonjs/index.js +22 -0
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/module/LiquidGlass.js +64 -0
  24. package/lib/module/LiquidGlass.js.map +1 -0
  25. package/lib/module/LiquidGlassNativeComponent.ts +110 -0
  26. package/lib/module/SegmentedControl.js +87 -0
  27. package/lib/module/SegmentedControl.js.map +1 -0
  28. package/lib/module/SegmentedControlNativeComponent.ts +79 -0
  29. package/lib/module/index.js +2 -0
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/typescript/commonjs/src/LiquidGlass.d.ts +96 -0
  32. package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -0
  33. package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +93 -0
  34. package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/src/SegmentedControl.d.ts +62 -0
  36. package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +63 -0
  38. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  40. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  41. package/lib/typescript/module/src/LiquidGlass.d.ts +96 -0
  42. package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -0
  43. package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +93 -0
  44. package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -0
  45. package/lib/typescript/module/src/SegmentedControl.d.ts +62 -0
  46. package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -0
  47. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +63 -0
  48. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -0
  49. package/lib/typescript/module/src/index.d.ts +2 -0
  50. package/lib/typescript/module/src/index.d.ts.map +1 -1
  51. package/package.json +13 -4
  52. package/react-native.config.js +1 -0
  53. package/shared/PCSegmentedControlComponentDescriptors-custom.h +22 -0
  54. package/shared/PCSegmentedControlShadowNode-custom.cpp +54 -0
  55. package/shared/PCSegmentedControlShadowNode-custom.h +56 -0
  56. package/shared/PCSegmentedControlState-custom.h +62 -0
  57. package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +1 -0
  58. package/src/LiquidGlass.tsx +169 -0
  59. package/src/LiquidGlassNativeComponent.ts +110 -0
  60. package/src/SegmentedControl.tsx +178 -0
  61. package/src/SegmentedControlNativeComponent.ts +79 -0
  62. package/src/index.tsx +2 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ // LiquidGlass.tsx
4
+ import React, { useCallback, useMemo } from 'react';
5
+ import { Platform } from 'react-native';
6
+ import NativeLiquidGlass from './LiquidGlassNativeComponent';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ /**
9
+ * Whether the LiquidGlass effect is supported on the current device.
10
+ * Returns true on iOS 26+ (with Liquid Glass support), false otherwise.
11
+ *
12
+ * Use this to conditionally render fallback UI on unsupported devices.
13
+ */
14
+ export const isLiquidGlassSupported = Platform.OS === 'ios' && Number(Platform.Version) >= 26;
15
+ export function LiquidGlass(props) {
16
+ const {
17
+ style,
18
+ cornerRadius = 0,
19
+ ios,
20
+ android,
21
+ children,
22
+ onPress,
23
+ ...viewProps
24
+ } = props;
25
+
26
+ // Normalize iOS props for native layer (strings for codegen)
27
+ const nativeIos = useMemo(() => {
28
+ if (Platform.OS !== 'ios' || !ios) return undefined;
29
+ return {
30
+ effect: ios.effect,
31
+ interactive: ios.interactive ? 'true' : 'false',
32
+ tintColor: ios.tintColor,
33
+ colorScheme: ios.colorScheme,
34
+ shadowRadius: ios.shadowRadius,
35
+ isHighlighted: ios.isHighlighted ? 'true' : 'false'
36
+ };
37
+ }, [ios]);
38
+
39
+ // Normalize Android props
40
+ const nativeAndroid = useMemo(() => {
41
+ if (Platform.OS !== 'android' || !android) return undefined;
42
+ return {
43
+ fallbackBackgroundColor: android.fallbackBackgroundColor
44
+ };
45
+ }, [android]);
46
+
47
+ // Handle native press event
48
+ const handlePress = useCallback(event => {
49
+ onPress?.({
50
+ x: event.nativeEvent.x,
51
+ y: event.nativeEvent.y
52
+ });
53
+ }, [onPress]);
54
+ return /*#__PURE__*/_jsx(NativeLiquidGlass, {
55
+ style: style,
56
+ cornerRadius: cornerRadius,
57
+ ios: nativeIos,
58
+ android: nativeAndroid,
59
+ onGlassPress: onPress ? handlePress : undefined,
60
+ ...viewProps,
61
+ children: children
62
+ });
63
+ }
64
+ //# sourceMappingURL=LiquidGlass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useMemo","Platform","NativeLiquidGlass","jsx","_jsx","isLiquidGlassSupported","OS","Number","Version","LiquidGlass","props","style","cornerRadius","ios","android","children","onPress","viewProps","nativeIos","undefined","effect","interactive","tintColor","colorScheme","shadowRadius","isHighlighted","nativeAndroid","fallbackBackgroundColor","handlePress","event","x","nativeEvent","y","onGlassPress"],"sourceRoot":"../../src","sources":["LiquidGlass.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,QAAQ,QAAwB,cAAc;AAEvD,OAAOC,iBAAiB,MAIjB,8BAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQtC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAA+B,GAC1CJ,QAAQ,CAACK,EAAE,KAAK,KAAK,IAAIC,MAAM,CAACN,QAAQ,CAACO,OAAO,CAAC,IAAI,EAAE;AA6FzD,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAsB;EACvE,MAAM;IACJC,KAAK;IACLC,YAAY,GAAG,CAAC;IAChBC,GAAG;IACHC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACP,GAAGC;EACL,CAAC,GAAGP,KAAK;;EAET;EACA,MAAMQ,SAAS,GAAGlB,OAAO,CAAC,MAAM;IAC9B,IAAIC,QAAQ,CAACK,EAAE,KAAK,KAAK,IAAI,CAACO,GAAG,EAAE,OAAOM,SAAS;IACnD,OAAO;MACLC,MAAM,EAAEP,GAAG,CAACO,MAAM;MAClBC,WAAW,EAAER,GAAG,CAACQ,WAAW,GAAG,MAAM,GAAG,OAAO;MAC/CC,SAAS,EAAET,GAAG,CAACS,SAAS;MACxBC,WAAW,EAAEV,GAAG,CAACU,WAAW;MAC5BC,YAAY,EAAEX,GAAG,CAACW,YAAY;MAC9BC,aAAa,EAAEZ,GAAG,CAACY,aAAa,GAAG,MAAM,GAAG;IAC9C,CAAC;EACH,CAAC,EAAE,CAACZ,GAAG,CAAC,CAAC;;EAET;EACA,MAAMa,aAAa,GAAG1B,OAAO,CAAC,MAAM;IAClC,IAAIC,QAAQ,CAACK,EAAE,KAAK,SAAS,IAAI,CAACQ,OAAO,EAAE,OAAOK,SAAS;IAC3D,OAAO;MACLQ,uBAAuB,EAAEb,OAAO,CAACa;IACnC,CAAC;EACH,CAAC,EAAE,CAACb,OAAO,CAAC,CAAC;;EAEb;EACA,MAAMc,WAAW,GAAG7B,WAAW,CAC5B8B,KAAgD,IAAK;IACpDb,OAAO,GAAG;MAAEc,CAAC,EAAED,KAAK,CAACE,WAAW,CAACD,CAAC;MAAEE,CAAC,EAAEH,KAAK,CAACE,WAAW,CAACC;IAAE,CAAC,CAAC;EAC/D,CAAC,EACD,CAAChB,OAAO,CACV,CAAC;EAED,oBACEZ,IAAA,CAACF,iBAAiB;IAChBS,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,GAAG,EAAEK,SAAU;IACfJ,OAAO,EAAEY,aAAc;IACvBO,YAAY,EAAEjB,OAAO,GAAGY,WAAW,GAAGT,SAAU;IAAA,GAC5CF,SAAS;IAAAF,QAAA,EAEZA;EAAQ,CACQ,CAAC;AAExB","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ // LiquidGlassNativeComponent.ts
2
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ /**
6
+ * Glass effect intensity/style.
7
+ * - 'clear': More transparent, subtle glass effect
8
+ * - 'regular': Standard blur intensity (default)
9
+ * - 'none': No glass effect (useful for animating materialization)
10
+ */
11
+ export type LiquidGlassEffect = 'clear' | 'regular' | 'none';
12
+
13
+ /**
14
+ * Color scheme for the glass effect.
15
+ * - 'light': Force light appearance
16
+ * - 'dark': Force dark appearance
17
+ * - 'system': Follow system appearance (default)
18
+ */
19
+ export type LiquidGlassColorScheme = 'light' | 'dark' | 'system';
20
+
21
+ /**
22
+ * iOS-specific configuration.
23
+ */
24
+ export type LiquidGlassIOSProps = Readonly<{
25
+ /**
26
+ * Glass effect style.
27
+ * @default 'regular'
28
+ */
29
+ effect?: string; // LiquidGlassEffect
30
+
31
+ /**
32
+ * Enables touch interaction effects when pressing the view.
33
+ * Note: Only applies on component mount; cannot be changed dynamically.
34
+ * @default false
35
+ */
36
+ interactive?: string; // 'true' | 'false'
37
+
38
+ /**
39
+ * Overlay tint color applied to the glass effect.
40
+ * Accepts hex color strings (e.g., '#FF0000', '#FF000080').
41
+ */
42
+ tintColor?: string;
43
+
44
+ /**
45
+ * Appearance adaptation mode.
46
+ * @default 'system'
47
+ */
48
+ colorScheme?: string; // LiquidGlassColorScheme
49
+
50
+ /**
51
+ * Shadow radius for the glass effect.
52
+ * @default 20
53
+ */
54
+ shadowRadius?: CodegenTypes.Float;
55
+
56
+ /**
57
+ * Whether the view is highlighted (pressed state).
58
+ */
59
+ isHighlighted?: string; // 'true' | 'false'
60
+ }>;
61
+
62
+ /**
63
+ * Android-specific configuration (stub - LiquidGlass is iOS only).
64
+ */
65
+ export type LiquidGlassAndroidProps = Readonly<{
66
+ /**
67
+ * Fallback background color for Android (since glass effect is not supported).
68
+ * If not provided, renders as transparent.
69
+ */
70
+ fallbackBackgroundColor?: string;
71
+ }>;
72
+
73
+ /**
74
+ * Event emitted when the glass view is pressed.
75
+ */
76
+ export type LiquidGlassPressEvent = Readonly<{
77
+ /** X coordinate of touch relative to view bounds */
78
+ x: CodegenTypes.Float;
79
+ /** Y coordinate of touch relative to view bounds */
80
+ y: CodegenTypes.Float;
81
+ }>;
82
+
83
+ export interface LiquidGlassNativeProps extends ViewProps {
84
+ /**
85
+ * Corner radius for the glass effect.
86
+ * Applied uniformly to all corners.
87
+ * @default 0
88
+ */
89
+ cornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
90
+
91
+ /**
92
+ * iOS-specific props.
93
+ */
94
+ ios?: LiquidGlassIOSProps;
95
+
96
+ /**
97
+ * Android-specific props.
98
+ */
99
+ android?: LiquidGlassAndroidProps;
100
+
101
+ /**
102
+ * Fired when the glass view is pressed.
103
+ * Includes touch coordinates relative to view bounds.
104
+ */
105
+ onGlassPress?: CodegenTypes.DirectEventHandler<LiquidGlassPressEvent>;
106
+ }
107
+
108
+ export default codegenNativeComponent<LiquidGlassNativeProps>(
109
+ 'PCLiquidGlass'
110
+ ) as HostComponent<LiquidGlassNativeProps>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ // SegmentedControl.tsx
4
+ import React, { useCallback, useMemo } from 'react';
5
+ import { Platform, StyleSheet } from 'react-native';
6
+ import NativeSegmentedControl from './SegmentedControlNativeComponent';
7
+
8
+ // Android: Minimum height to ensure visibility.
9
+ // Fabric's shadow node measurement isn't being called on initial render,
10
+ // so we apply a minHeight that matches Material design touch target guidelines.
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const ANDROID_MIN_HEIGHT = 48;
13
+ function normalizeSelectedValue(selected) {
14
+ return selected ?? '';
15
+ }
16
+ export function SegmentedControl(props) {
17
+ const {
18
+ style,
19
+ segments,
20
+ selectedValue,
21
+ disabled,
22
+ onSelect,
23
+ ios,
24
+ android,
25
+ ...viewProps
26
+ } = props;
27
+
28
+ // Normalize segments for native
29
+ const nativeSegments = useMemo(() => {
30
+ return segments.map(seg => ({
31
+ label: seg.label,
32
+ value: seg.value,
33
+ disabled: seg.disabled ? 'disabled' : 'enabled',
34
+ icon: seg.icon ?? ''
35
+ }));
36
+ }, [segments]);
37
+ const selectedData = useMemo(() => normalizeSelectedValue(selectedValue), [selectedValue]);
38
+ const handleSelect = useCallback(e => {
39
+ const {
40
+ index,
41
+ value
42
+ } = e.nativeEvent;
43
+ onSelect?.(value, index);
44
+ }, [onSelect]);
45
+
46
+ // Normalize iOS props to native string format
47
+ const nativeIos = useMemo(() => {
48
+ if (!ios) return undefined;
49
+ return {
50
+ momentary: ios.momentary ? 'true' : 'false',
51
+ apportionsSegmentWidthsByContent: ios.apportionsSegmentWidthsByContent ? 'true' : 'false',
52
+ selectedSegmentTintColor: ios.selectedSegmentTintColor ?? ''
53
+ };
54
+ }, [ios]);
55
+
56
+ // Normalize Android props
57
+ const nativeAndroid = useMemo(() => {
58
+ if (!android) return undefined;
59
+ return {
60
+ selectionRequired: android.selectionRequired ? 'true' : 'false'
61
+ };
62
+ }, [android]);
63
+
64
+ // Merge user style with Android minHeight default
65
+ const mergedStyle = useMemo(() => {
66
+ if (Platform.OS === 'android') {
67
+ return [styles.androidDefault, style];
68
+ }
69
+ return style;
70
+ }, [style]);
71
+ return /*#__PURE__*/_jsx(NativeSegmentedControl, {
72
+ style: mergedStyle,
73
+ segments: nativeSegments,
74
+ selectedValue: selectedData,
75
+ interactivity: disabled ? 'disabled' : 'enabled',
76
+ onSelect: onSelect ? handleSelect : undefined,
77
+ ios: nativeIos,
78
+ android: nativeAndroid,
79
+ ...viewProps
80
+ });
81
+ }
82
+ const styles = StyleSheet.create({
83
+ androidDefault: {
84
+ minHeight: ANDROID_MIN_HEIGHT
85
+ }
86
+ });
87
+ //# sourceMappingURL=SegmentedControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useMemo","Platform","StyleSheet","NativeSegmentedControl","jsx","_jsx","ANDROID_MIN_HEIGHT","normalizeSelectedValue","selected","SegmentedControl","props","style","segments","selectedValue","disabled","onSelect","ios","android","viewProps","nativeSegments","map","seg","label","value","icon","selectedData","handleSelect","e","index","nativeEvent","nativeIos","undefined","momentary","apportionsSegmentWidthsByContent","selectedSegmentTintColor","nativeAndroid","selectionRequired","mergedStyle","OS","styles","androidDefault","interactivity","create","minHeight"],"sourceRoot":"../../src","sources":["SegmentedControl.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SACEC,QAAQ,EACRC,UAAU,QAIL,cAAc;AAErB,OAAOC,sB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,gCAAgC,EAAEjB,GAAG,CAACiB,gCAAgC,GAClE,MAAM,GACN,OAAO;MACXC,wBAAwB,EAAElB,GAAG,CAACkB,wBAAwB,IAAI;IAC5D,CAAC;EACH,CAAC,EAAE,CAAClB,GAAG,CAAC,CAAC;;EAET;EACA,MAAMmB,aAAa,GAAGnC,OAAO,CAAC,MAAM;IAClC,IAAI,CAACiB,OAAO,EAAE,OAAOc,SAAS;IAC9B,OAAO;MACLK,iBAAiB,EAAEnB,OAAO,CAACmB,iBAAiB,GAAG,MAAM,GAAG;IAC1D,CAAC;EACH,CAAC,EAAE,CAACnB,OAAO,CAAC,CAAC;;EAEb;EACA,MAAMoB,WAAW,GAAGrC,OAAO,CAAC,MAA4B;IACtD,IAAIC,QAAQ,CAACqC,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAO,CAACC,MAAM,CAACC,cAAc,EAAE7B,KAAK,CAAC;IACvC;IACA,OAAOA,KAAK;EACd,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,oBACEN,IAAA,CAACF,sBAAsB;IACrBQ,KAAK,EAAE0B,WAAY;IACnBzB,QAAQ,EAAEO,cAAe;IACzBN,aAAa,EAAEY,YAAa;IAC5BgB,aAAa,EAAE3B,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDC,QAAQ,EAAEA,QAAQ,GAAGW,YAAY,GAAGK,SAAU;IAC9Cf,GAAG,EAAEc,SAAU;IACfb,OAAO,EAAEkB,aAAc;IAAA,GACnBjB;EAAS,CACd,CAAC;AAEN;AAEA,MAAMqB,MAAM,GAAGrC,UAAU,CAACwC,MAAM,CAAC;EAC/BF,cAAc,EAAE;IACdG,SAAS,EAAErC;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ // SegmentedControlNativeComponent.ts
2
+ import type { CodegenTypes, ViewProps } from 'react-native';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ /**
6
+ * A single segment in the control.
7
+ */
8
+ export type SegmentedControlSegment = Readonly<{
9
+ label: string;
10
+ value: string;
11
+ disabled: string; // 'enabled' | 'disabled'
12
+ icon: string; // SF Symbol (iOS) or drawable name (Android), empty = none
13
+ }>;
14
+
15
+ /**
16
+ * Event emitted when the user selects a segment.
17
+ */
18
+ export type SegmentedControlSelectEvent = Readonly<{
19
+ /** Selected segment index */
20
+ index: CodegenTypes.Int32;
21
+
22
+ /** Selected segment value */
23
+ value: string;
24
+ }>;
25
+
26
+ /** Interactivity state (no booleans). */
27
+ export type SegmentedControlInteractivity = 'enabled' | 'disabled';
28
+
29
+ /**
30
+ * iOS-specific configuration.
31
+ */
32
+ export type IOSProps = Readonly<{
33
+ /** Momentary mode: segment springs back after touch */
34
+ momentary?: string; // 'true' | 'false'
35
+
36
+ /** Whether segment widths are proportional to content */
37
+ apportionsSegmentWidthsByContent?: string; // 'true' | 'false'
38
+
39
+ /** Selected segment tint color (hex string) */
40
+ selectedSegmentTintColor?: string;
41
+ }>;
42
+
43
+ /**
44
+ * Android-specific configuration.
45
+ */
46
+ export type AndroidProps = Readonly<{
47
+ /** Whether one segment must always be selected */
48
+ selectionRequired?: string; // 'true' | 'false'
49
+ }>;
50
+
51
+ export interface SegmentedControlProps extends ViewProps {
52
+ /**
53
+ * Segments to display.
54
+ */
55
+ segments: ReadonlyArray<SegmentedControlSegment>;
56
+
57
+ /**
58
+ * Controlled selection by `value`.
59
+ * Empty string means "no selection".
60
+ */
61
+ selectedValue?: CodegenTypes.WithDefault<string, ''>;
62
+
63
+ /**
64
+ * Enabled / disabled state.
65
+ */
66
+ interactivity?: string; // SegmentedControlInteractivity
67
+
68
+ /**
69
+ * Fired when the user selects a segment.
70
+ */
71
+ onSelect?: CodegenTypes.BubblingEventHandler<SegmentedControlSelectEvent>;
72
+
73
+ ios?: IOSProps;
74
+ android?: AndroidProps;
75
+ }
76
+
77
+ export default codegenNativeComponent<SegmentedControlProps>(
78
+ 'PCSegmentedControl'
79
+ );
@@ -3,5 +3,7 @@
3
3
  export * from "./DatePicker.js";
4
4
  export * from "./SelectionMenu.js";
5
5
  export * from "./ContextMenu.js";
6
+ export * from "./SegmentedControl.js";
7
+ export * from "./LiquidGlass.js";
6
8
  export * from "./sharedTypes.js";
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAc;AAC5B,cAAc,oBAAiB;AAC/B,cAAc,kBAAe;AAC7B,cAAc,kBAAe","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAc;AAC5B,cAAc,oBAAiB;AAC/B,cAAc,kBAAe;AAC7B,cAAc,uBAAoB;AAClC,cAAc,kBAAe;AAC7B,cAAc,kBAAe","ignoreList":[]}
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import { type ViewProps } from 'react-native';
3
+ import { type LiquidGlassColorScheme, type LiquidGlassEffect, type LiquidGlassPressEvent } from './LiquidGlassNativeComponent';
4
+ export type { LiquidGlassEffect, LiquidGlassColorScheme, LiquidGlassPressEvent, };
5
+ /**
6
+ * Whether the LiquidGlass effect is supported on the current device.
7
+ * Returns true on iOS 26+ (with Liquid Glass support), false otherwise.
8
+ *
9
+ * Use this to conditionally render fallback UI on unsupported devices.
10
+ */
11
+ export declare const isLiquidGlassSupported: boolean;
12
+ export interface LiquidGlassProps extends ViewProps {
13
+ /**
14
+ * Corner radius for the glass effect.
15
+ * Applied uniformly to all corners.
16
+ * @default 0
17
+ */
18
+ cornerRadius?: number;
19
+ /**
20
+ * iOS-specific props for the glass effect.
21
+ */
22
+ ios?: {
23
+ /**
24
+ * Glass effect style.
25
+ * - 'clear': More transparent, subtle glass effect
26
+ * - 'regular': Standard blur intensity (default)
27
+ * - 'none': No glass effect (useful for animating materialization)
28
+ * @default 'regular'
29
+ */
30
+ effect?: LiquidGlassEffect;
31
+ /**
32
+ * Enables native touch interaction effects when pressing the view.
33
+ * When enabled, the glass effect responds to touch location with
34
+ * position-aware visual feedback (iOS 26+ UIGlassEffect.isInteractive).
35
+ *
36
+ * Note: Only applies on component mount; cannot be changed dynamically.
37
+ * @default false
38
+ */
39
+ interactive?: boolean;
40
+ /**
41
+ * Overlay tint color applied to the glass effect.
42
+ * Accepts any valid color value (hex, rgba, named colors).
43
+ *
44
+ * Example: '#FF0000', 'rgba(255, 0, 0, 0.5)', 'red'
45
+ */
46
+ tintColor?: string;
47
+ /**
48
+ * Appearance adaptation mode.
49
+ * - 'light': Force light appearance
50
+ * - 'dark': Force dark appearance
51
+ * - 'system': Follow system appearance (default)
52
+ * @default 'system'
53
+ */
54
+ colorScheme?: LiquidGlassColorScheme;
55
+ /**
56
+ * Shadow radius for the glass effect glow.
57
+ * Higher values create a more diffuse shadow.
58
+ * @default 20
59
+ */
60
+ shadowRadius?: number;
61
+ /**
62
+ * @deprecated Use `interactive` instead for native touch-based highlighting.
63
+ * This prop is a no-op on iOS 26+ where UIGlassEffect handles touch feedback.
64
+ * @default false
65
+ */
66
+ isHighlighted?: boolean;
67
+ };
68
+ /**
69
+ * Android-specific props.
70
+ * Note: LiquidGlass is an iOS-only effect. On Android, the component
71
+ * renders as a regular View with optional fallback styling.
72
+ */
73
+ android?: {
74
+ /**
75
+ * Fallback background color for Android since glass effect is not supported.
76
+ * If not provided, the view renders transparently.
77
+ */
78
+ fallbackBackgroundColor?: string;
79
+ };
80
+ /**
81
+ * Content to render inside the glass effect container.
82
+ */
83
+ children?: React.ReactNode;
84
+ /**
85
+ * Called when the glass view is pressed.
86
+ * Includes touch coordinates relative to the view bounds.
87
+ */
88
+ onPress?: (event: {
89
+ x: number;
90
+ y: number;
91
+ }) => void;
92
+ /** Test identifier */
93
+ testID?: string;
94
+ }
95
+ export declare function LiquidGlass(props: LiquidGlassProps): React.ReactElement;
96
+ //# sourceMappingURL=LiquidGlass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiquidGlass.d.ts","sourceRo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AgB,GAAG,KAAK,CAAC,YAAY,CAoDvE"}
@@ -0,0 +1,93 @@
1
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ /**
3
+ * Glass effect intensity/style.
4
+ * - 'clear': More transparent, subtle glass effect
5
+ * - 'regular': Standard blur intensity (default)
6
+ * - 'none': No glass effect (useful for animating materialization)
7
+ */
8
+ export type LiquidGlassEffect = 'clear' | 'regular' | 'none';
9
+ /**
10
+ * Color scheme for the glass effect.
11
+ * - 'light': Force light appearance
12
+ * - 'dark': Force dark appearance
13
+ * - 'system': Follow system appearance (default)
14
+ */
15
+ export type LiquidGlassColorScheme = 'light' | 'dark' | 'system';
16
+ /**
17
+ * iOS-specific configuration.
18
+ */
19
+ export type LiquidGlassIOSProps = Readonly<{
20
+ /**
21
+ * Glass effect style.
22
+ * @default 'regular'
23
+ */
24
+ effect?: string;
25
+ /**
26
+ * Enables touch interaction effects when pressing the view.
27
+ * Note: Only applies on component mount; cannot be changed dynamically.
28
+ * @default false
29
+ */
30
+ interactive?: string;
31
+ /**
32
+ * Overlay tint color applied to the glass effect.
33
+ * Accepts hex color strings (e.g., '#FF0000', '#FF000080').
34
+ */
35
+ tintColor?: string;
36
+ /**
37
+ * Appearance adaptation mode.
38
+ * @default 'system'
39
+ */
40
+ colorScheme?: string;
41
+ /**
42
+ * Shadow radius for the glass effect.
43
+ * @default 20
44
+ */
45
+ shadowRadius?: CodegenTypes.Float;
46
+ /**
47
+ * Whether the view is highlighted (pressed state).
48
+ */
49
+ isHighlighted?: string;
50
+ }>;
51
+ /**
52
+ * Android-specific configuration (stub - LiquidGlass is iOS only).
53
+ */
54
+ export type LiquidGlassAndroidProps = Readonly<{
55
+ /**
56
+ * Fallback background color for Android (since glass effect is not supported).
57
+ * If not provided, renders as transparent.
58
+ */
59
+ fallbackBackgroundColor?: string;
60
+ }>;
61
+ /**
62
+ * Event emitted when the glass view is pressed.
63
+ */
64
+ export type LiquidGlassPressEvent = Readonly<{
65
+ /** X coordinate of touch relative to view bounds */
66
+ x: CodegenTypes.Float;
67
+ /** Y coordinate of touch relative to view bounds */
68
+ y: CodegenTypes.Float;
69
+ }>;
70
+ export interface LiquidGlassNativeProps extends ViewProps {
71
+ /**
72
+ * Corner radius for the glass effect.
73
+ * Applied uniformly to all corners.
74
+ * @default 0
75
+ */
76
+ cornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
77
+ /**
78
+ * iOS-specific props.
79
+ */
80
+ ios?: LiquidGlassIOSProps;
81
+ /**
82
+ * Android-specific props.
83
+ */
84
+ android?: LiquidGlassAndroidProps;
85
+ /**
86
+ * Fired when the glass view is pressed.
87
+ * Includes touch coordinates relative to view bounds.
88
+ */
89
+ onGlassPress?: CodegenTypes.DirectEventHandler<LiquidGlassPressEvent>;
90
+ }
91
+ declare const _default: HostComponent<LiquidGlassNativeProps>;
92
+ export default _default;
93
+ //# sourceMappingURL=LiquidGlassNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiquidGlassNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/LiquidGlassNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3E;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IAElC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,oDAAoD;IACpD,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;IACtB,oDAAoD;IACpD,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE/D;;OAEG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAElC;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACvE;wBAII,aAAa,CAAC,sBAAsB,CAAC;AAF1C,wBAE2C"}
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { type ViewProps } from 'react-native';
3
+ export interface SegmentedControlSegmentProps {
4
+ /** Display label for the segment */
5
+ label: string;
6
+ /** Unique value identifier for the segment */
7
+ value: string;
8
+ /** Whether this specific segment is disabled */
9
+ disabled?: boolean;
10
+ /** Optional SF Symbol name (iOS) or drawable resource name (Android) */
11
+ icon?: string;
12
+ }
13
+ export interface SegmentedControlProps extends ViewProps {
14
+ /** Array of segments to display */
15
+ segments: readonly SegmentedControlSegmentProps[];
16
+ /**
17
+ * Currently selected segment value.
18
+ * Use `null` for no selection.
19
+ */
20
+ selectedValue: string | null;
21
+ /**
22
+ * Called when the user selects a segment.
23
+ * @param value - The selected segment's value
24
+ * @param index - The selected segment's index
25
+ */
26
+ onSelect?: (value: string, index: number) => void;
27
+ /** Whether the entire control is disabled */
28
+ disabled?: boolean;
29
+ /**
30
+ * iOS-specific configuration
31
+ */
32
+ ios?: {
33
+ /**
34
+ * Momentary mode: segment springs back after touch (no persistent selection)
35
+ * Default: false
36
+ */
37
+ momentary?: boolean;
38
+ /**
39
+ * Whether segment widths are proportional to content
40
+ * Default: false (equal widths)
41
+ */
42
+ apportionsSegmentWidthsByContent?: boolean;
43
+ /**
44
+ * Selected segment tint color (hex string, e.g., "#007AFF")
45
+ */
46
+ selectedSegmentTintColor?: string;
47
+ };
48
+ /**
49
+ * Android-specific configuration
50
+ */
51
+ android?: {
52
+ /**
53
+ * Whether one segment must always be selected.
54
+ * Default: false
55
+ */
56
+ selectionRequired?: boolean;
57
+ };
58
+ /** Test identifier */
59
+ testID?: string;
60
+ }
61
+ export declare function SegmentedControl(props: SegmentedControlProps): React.ReactElement;
62
+ //# sourceMappingURL=SegmentedControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../../src/SegmentedControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AAWtB,MAAM,WAAW,4BAA4B;IAC3C,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IAEd,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,mCAAmC;IACnC,QAAQ,EAAE,SAAS,4BAA4B,EAAE,CAAC;IAElD;;;OAGG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,GAAG,CAAC,EAAE;QACJ;;;WAGG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;;WAGG;QACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;QAE3C;;WAEG;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;KACnC,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;;WAGG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CAAC;IAEF,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,GAC3B,KAAK,CAAC,YAAY,CA2EpB"}