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.
- package/README.md +259 -44
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassView.kt +84 -0
- package/android/src/main/java/com/platformcomponents/PCLiquidGlassViewManager.kt +52 -0
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +241 -0
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +105 -0
- package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +2 -0
- package/ios/PCDatePickerView.swift +16 -13
- package/ios/PCLiquidGlass.h +10 -0
- package/ios/PCLiquidGlass.mm +140 -0
- package/ios/PCLiquidGlass.swift +354 -0
- package/ios/PCSegmentedControl.h +10 -0
- package/ios/PCSegmentedControl.mm +194 -0
- package/ios/PCSegmentedControl.swift +200 -0
- package/ios/PCSelectionMenu.swift +1 -1
- package/lib/commonjs/LiquidGlass.js +72 -0
- package/lib/commonjs/LiquidGlass.js.map +1 -0
- package/lib/commonjs/LiquidGlassNativeComponent.ts +110 -0
- package/lib/commonjs/SegmentedControl.js +93 -0
- package/lib/commonjs/SegmentedControl.js.map +1 -0
- package/lib/commonjs/SegmentedControlNativeComponent.ts +79 -0
- package/lib/commonjs/index.js +22 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/LiquidGlass.js +64 -0
- package/lib/module/LiquidGlass.js.map +1 -0
- package/lib/module/LiquidGlassNativeComponent.ts +110 -0
- package/lib/module/SegmentedControl.js +87 -0
- package/lib/module/SegmentedControl.js.map +1 -0
- package/lib/module/SegmentedControlNativeComponent.ts +79 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts +96 -0
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +93 -0
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts +62 -0
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +63 -0
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/LiquidGlass.d.ts +96 -0
- package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +93 -0
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/SegmentedControl.d.ts +62 -0
- package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -0
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +63 -0
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +13 -4
- package/react-native.config.js +1 -0
- package/shared/PCSegmentedControlComponentDescriptors-custom.h +22 -0
- package/shared/PCSegmentedControlShadowNode-custom.cpp +54 -0
- package/shared/PCSegmentedControlShadowNode-custom.h +56 -0
- package/shared/PCSegmentedControlState-custom.h +62 -0
- package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +1 -0
- package/src/LiquidGlass.tsx +169 -0
- package/src/LiquidGlassNativeComponent.ts +110 -0
- package/src/SegmentedControl.tsx +178 -0
- package/src/SegmentedControlNativeComponent.ts +79 -0
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
// MARK: - Segment model (bridged from ObjC++ as dictionaries)
|
|
4
|
+
|
|
5
|
+
struct PCSegmentedControlSegment {
|
|
6
|
+
let label: String
|
|
7
|
+
let value: String
|
|
8
|
+
let disabled: Bool
|
|
9
|
+
let icon: String
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objcMembers
|
|
13
|
+
public final class PCSegmentedControlView: UIControl {
|
|
14
|
+
// MARK: - Props (set from ObjC++)
|
|
15
|
+
|
|
16
|
+
/// ObjC++ sets this as an array of dictionaries: [{label, value, disabled, icon}]
|
|
17
|
+
public var segments: [Any] = [] { didSet { rebuildControl() } }
|
|
18
|
+
|
|
19
|
+
/// Controlled selection by value. "" = no selection.
|
|
20
|
+
public var selectedValue: String = "" { didSet { updateSelection() } }
|
|
21
|
+
|
|
22
|
+
/// "enabled" | "disabled"
|
|
23
|
+
public var interactivity: String = "enabled" { didSet { updateEnabled() } }
|
|
24
|
+
|
|
25
|
+
/// iOS-specific: momentary mode (segment springs back after touch)
|
|
26
|
+
public var momentary: Bool = false { didSet { control.isMomentary = momentary } }
|
|
27
|
+
|
|
28
|
+
/// iOS-specific: segment widths proportional to content
|
|
29
|
+
public var apportionsSegmentWidthsByContent: Bool = false {
|
|
30
|
+
didSet { control.apportionsSegmentWidthsByContent = apportionsSegmentWidthsByContent }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// iOS-specific: selected segment tint color (hex string)
|
|
34
|
+
public var selectedSegmentTintColor: String? { didSet { updateTintColor() } }
|
|
35
|
+
|
|
36
|
+
// MARK: - Events back to ObjC++
|
|
37
|
+
|
|
38
|
+
public var onSelect: ((Int, String) -> Void)? // (index, value)
|
|
39
|
+
|
|
40
|
+
// MARK: - Internal
|
|
41
|
+
|
|
42
|
+
private let control = UISegmentedControl()
|
|
43
|
+
private var parsedSegments: [PCSegmentedControlSegment] = []
|
|
44
|
+
|
|
45
|
+
// MARK: - Init
|
|
46
|
+
|
|
47
|
+
public override init(frame: CGRect) {
|
|
48
|
+
super.init(frame: frame)
|
|
49
|
+
setup()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public required init?(coder: NSCoder) {
|
|
53
|
+
super.init(coder: coder)
|
|
54
|
+
setup()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private func setup() {
|
|
58
|
+
control.translatesAutoresizingMaskIntoConstraints = false
|
|
59
|
+
addSubview(control)
|
|
60
|
+
|
|
61
|
+
NSLayoutConstraint.activate([
|
|
62
|
+
control.topAnchor.constraint(equalTo: topAnchor),
|
|
63
|
+
control.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
64
|
+
control.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
65
|
+
control.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
control.addTarget(self, action: #selector(valueChanged), for: .valueChanged)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@objc private func valueChanged() {
|
|
72
|
+
let index = control.selectedSegmentIndex
|
|
73
|
+
guard index != UISegmentedControl.noSegment,
|
|
74
|
+
index >= 0, index < parsedSegments.count else { return }
|
|
75
|
+
|
|
76
|
+
let segment = parsedSegments[index]
|
|
77
|
+
onSelect?(index, segment.value)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// MARK: - Props handling
|
|
81
|
+
|
|
82
|
+
private func rebuildControl() {
|
|
83
|
+
parsedSegments = segments.compactMap { any in
|
|
84
|
+
guard let dict = any as? [String: Any] else { return nil }
|
|
85
|
+
let label = (dict["label"] as? String) ?? ""
|
|
86
|
+
let value = (dict["value"] as? String) ?? ""
|
|
87
|
+
let disabled = (dict["disabled"] as? String) == "disabled"
|
|
88
|
+
let icon = (dict["icon"] as? String) ?? ""
|
|
89
|
+
return PCSegmentedControlSegment(
|
|
90
|
+
label: label,
|
|
91
|
+
value: value,
|
|
92
|
+
disabled: disabled,
|
|
93
|
+
icon: icon
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
control.removeAllSegments()
|
|
98
|
+
|
|
99
|
+
for (index, segment) in parsedSegments.enumerated() {
|
|
100
|
+
// Try to use SF Symbol icon if available
|
|
101
|
+
if !segment.icon.isEmpty,
|
|
102
|
+
let sfImage = UIImage(systemName: segment.icon) {
|
|
103
|
+
control.insertSegment(with: sfImage, at: index, animated: false)
|
|
104
|
+
} else {
|
|
105
|
+
control.insertSegment(withTitle: segment.label, at: index, animated: false)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Set enabled state for this segment
|
|
109
|
+
control.setEnabled(!segment.disabled, forSegmentAt: index)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
updateSelection()
|
|
113
|
+
invalidateIntrinsicContentSize()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private func updateSelection() {
|
|
117
|
+
if selectedValue.isEmpty {
|
|
118
|
+
control.selectedSegmentIndex = UISegmentedControl.noSegment
|
|
119
|
+
} else if let index = parsedSegments.firstIndex(where: { $0.value == selectedValue }) {
|
|
120
|
+
control.selectedSegmentIndex = index
|
|
121
|
+
} else {
|
|
122
|
+
control.selectedSegmentIndex = UISegmentedControl.noSegment
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private func updateEnabled() {
|
|
127
|
+
let enabled = interactivity != "disabled"
|
|
128
|
+
control.isEnabled = enabled
|
|
129
|
+
alpha = enabled ? 1.0 : 0.5
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private func updateTintColor() {
|
|
133
|
+
if let colorString = selectedSegmentTintColor, !colorString.isEmpty {
|
|
134
|
+
control.selectedSegmentTintColor = UIColor(hex: colorString)
|
|
135
|
+
} else {
|
|
136
|
+
control.selectedSegmentTintColor = nil
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// MARK: - Sizing
|
|
141
|
+
|
|
142
|
+
public override func sizeThatFits(_ size: CGSize) -> CGSize {
|
|
143
|
+
let fitted = control.sizeThatFits(CGSize(width: size.width, height: .greatestFiniteMagnitude))
|
|
144
|
+
return CGSize(
|
|
145
|
+
width: size.width > 0 ? size.width : fitted.width,
|
|
146
|
+
height: max(PCConstants.minTouchTargetHeight, fitted.height)
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public override var intrinsicContentSize: CGSize {
|
|
151
|
+
let fitted = control.intrinsicContentSize
|
|
152
|
+
return CGSize(
|
|
153
|
+
width: fitted.width,
|
|
154
|
+
height: max(PCConstants.minTouchTargetHeight, fitted.height)
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// Called by the measuring pipeline to get the size for Yoga layout.
|
|
159
|
+
@objc public func sizeForLayout(withConstrainedTo constrainedSize: CGSize) -> CGSize {
|
|
160
|
+
let fitted = control.sizeThatFits(
|
|
161
|
+
CGSize(width: constrainedSize.width > 0 ? constrainedSize.width : .greatestFiniteMagnitude,
|
|
162
|
+
height: .greatestFiniteMagnitude)
|
|
163
|
+
)
|
|
164
|
+
return CGSize(
|
|
165
|
+
width: constrainedSize.width > 0 ? constrainedSize.width : fitted.width,
|
|
166
|
+
height: max(PCConstants.minTouchTargetHeight, fitted.height)
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// MARK: - UIColor hex extension
|
|
172
|
+
|
|
173
|
+
private extension UIColor {
|
|
174
|
+
convenience init?(hex: String) {
|
|
175
|
+
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
176
|
+
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
|
|
177
|
+
|
|
178
|
+
var rgb: UInt64 = 0
|
|
179
|
+
guard Scanner(string: hexSanitized).scanHexInt64(&rgb) else { return nil }
|
|
180
|
+
|
|
181
|
+
let length = hexSanitized.count
|
|
182
|
+
if length == 6 {
|
|
183
|
+
self.init(
|
|
184
|
+
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
|
|
185
|
+
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0,
|
|
186
|
+
blue: CGFloat(rgb & 0x0000FF) / 255.0,
|
|
187
|
+
alpha: 1.0
|
|
188
|
+
)
|
|
189
|
+
} else if length == 8 {
|
|
190
|
+
self.init(
|
|
191
|
+
red: CGFloat((rgb & 0xFF000000) >> 24) / 255.0,
|
|
192
|
+
green: CGFloat((rgb & 0x00FF0000) >> 16) / 255.0,
|
|
193
|
+
blue: CGFloat((rgb & 0x0000FF00) >> 8) / 255.0,
|
|
194
|
+
alpha: CGFloat(rgb & 0x000000FF) / 255.0
|
|
195
|
+
)
|
|
196
|
+
} else {
|
|
197
|
+
return nil
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -462,7 +462,7 @@ private class PCMenuViewController: UIViewController, UITableViewDelegate, UITab
|
|
|
462
462
|
// Use liquid glass on iOS 26+, fall back to system material blur on older versions
|
|
463
463
|
let effectView: UIVisualEffectView
|
|
464
464
|
if #available(iOS 26, *) {
|
|
465
|
-
|
|
465
|
+
let glassEffect = UIGlassEffect()
|
|
466
466
|
glassEffect.isInteractive = true
|
|
467
467
|
effectView = UIVisualEffectView(effect: glassEffect)
|
|
468
468
|
} else {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LiquidGlass = LiquidGlass;
|
|
7
|
+
exports.isLiquidGlassSupported = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _LiquidGlassNativeComponent = _interopRequireDefault(require("./LiquidGlassNativeComponent"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
// LiquidGlass.tsx
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether the LiquidGlass effect is supported on the current device.
|
|
18
|
+
* Returns true on iOS 26+ (with Liquid Glass support), false otherwise.
|
|
19
|
+
*
|
|
20
|
+
* Use this to conditionally render fallback UI on unsupported devices.
|
|
21
|
+
*/
|
|
22
|
+
const isLiquidGlassSupported = exports.isLiquidGlassSupported = _reactNative.Platform.OS === 'ios' && Number(_reactNative.Platform.Version) >= 26;
|
|
23
|
+
function LiquidGlass(props) {
|
|
24
|
+
const {
|
|
25
|
+
style,
|
|
26
|
+
cornerRadius = 0,
|
|
27
|
+
ios,
|
|
28
|
+
android,
|
|
29
|
+
children,
|
|
30
|
+
onPress,
|
|
31
|
+
...viewProps
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
// Normalize iOS props for native layer (strings for codegen)
|
|
35
|
+
const nativeIos = (0, _react.useMemo)(() => {
|
|
36
|
+
if (_reactNative.Platform.OS !== 'ios' || !ios) return undefined;
|
|
37
|
+
return {
|
|
38
|
+
effect: ios.effect,
|
|
39
|
+
interactive: ios.interactive ? 'true' : 'false',
|
|
40
|
+
tintColor: ios.tintColor,
|
|
41
|
+
colorScheme: ios.colorScheme,
|
|
42
|
+
shadowRadius: ios.shadowRadius,
|
|
43
|
+
isHighlighted: ios.isHighlighted ? 'true' : 'false'
|
|
44
|
+
};
|
|
45
|
+
}, [ios]);
|
|
46
|
+
|
|
47
|
+
// Normalize Android props
|
|
48
|
+
const nativeAndroid = (0, _react.useMemo)(() => {
|
|
49
|
+
if (_reactNative.Platform.OS !== 'android' || !android) return undefined;
|
|
50
|
+
return {
|
|
51
|
+
fallbackBackgroundColor: android.fallbackBackgroundColor
|
|
52
|
+
};
|
|
53
|
+
}, [android]);
|
|
54
|
+
|
|
55
|
+
// Handle native press event
|
|
56
|
+
const handlePress = (0, _react.useCallback)(event => {
|
|
57
|
+
onPress?.({
|
|
58
|
+
x: event.nativeEvent.x,
|
|
59
|
+
y: event.nativeEvent.y
|
|
60
|
+
});
|
|
61
|
+
}, [onPress]);
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LiquidGlassNativeComponent.default, {
|
|
63
|
+
style: style,
|
|
64
|
+
cornerRadius: cornerRadius,
|
|
65
|
+
ios: nativeIos,
|
|
66
|
+
android: nativeAndroid,
|
|
67
|
+
onGlassPress: onPress ? handlePress : undefined,
|
|
68
|
+
...viewProps,
|
|
69
|
+
children: children
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=LiquidGlass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_LiquidGlassNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isLiquidGlassSupported","exports","Platform","OS","Number","Version","LiquidGlass","props","style","cornerRadius","ios","android","children","onPress","viewProps","nativeIos","useMemo","undefined","effect","interactive","tintColor","colorScheme","shadowRadius","isHighlighted","nativeAndroid","fallbackBackgroundColor","handlePress","useCallback","event","x","nativeEvent","y","jsx","onGlassPress"],"sourceRoot":"../../src","sources":["LiquidGlass.tsx"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAIsC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAA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AM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,GAAG,EAAEK,SAAU;IACfJ,OAAO,EAAEa,aAAc;IACvBS,YAAY,EAAEpB,OAAO,GAAGa,WAAW,GAAGT,SAAU;IAAA,GAC5CH,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,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SegmentedControl = SegmentedControl;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _SegmentedControlNativeComponent = _interopRequireDefault(require("./SegmentedControlNativeComponent"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
// SegmentedControl.tsx
|
|
14
|
+
|
|
15
|
+
// Android: Minimum height to ensure visibility.
|
|
16
|
+
// Fabric's shadow node measurement isn't being called on initial render,
|
|
17
|
+
// so we apply a minHeight that matches Material design touch target guidelines.
|
|
18
|
+
const ANDROID_MIN_HEIGHT = 48;
|
|
19
|
+
function normalizeSelectedValue(selected) {
|
|
20
|
+
return selected ?? '';
|
|
21
|
+
}
|
|
22
|
+
function SegmentedControl(props) {
|
|
23
|
+
const {
|
|
24
|
+
style,
|
|
25
|
+
segments,
|
|
26
|
+
selectedValue,
|
|
27
|
+
disabled,
|
|
28
|
+
onSelect,
|
|
29
|
+
ios,
|
|
30
|
+
android,
|
|
31
|
+
...viewProps
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
// Normalize segments for native
|
|
35
|
+
const nativeSegments = (0, _react.useMemo)(() => {
|
|
36
|
+
return segments.map(seg => ({
|
|
37
|
+
label: seg.label,
|
|
38
|
+
value: seg.value,
|
|
39
|
+
disabled: seg.disabled ? 'disabled' : 'enabled',
|
|
40
|
+
icon: seg.icon ?? ''
|
|
41
|
+
}));
|
|
42
|
+
}, [segments]);
|
|
43
|
+
const selectedData = (0, _react.useMemo)(() => normalizeSelectedValue(selectedValue), [selectedValue]);
|
|
44
|
+
const handleSelect = (0, _react.useCallback)(e => {
|
|
45
|
+
const {
|
|
46
|
+
index,
|
|
47
|
+
value
|
|
48
|
+
} = e.nativeEvent;
|
|
49
|
+
onSelect?.(value, index);
|
|
50
|
+
}, [onSelect]);
|
|
51
|
+
|
|
52
|
+
// Normalize iOS props to native string format
|
|
53
|
+
const nativeIos = (0, _react.useMemo)(() => {
|
|
54
|
+
if (!ios) return undefined;
|
|
55
|
+
return {
|
|
56
|
+
momentary: ios.momentary ? 'true' : 'false',
|
|
57
|
+
apportionsSegmentWidthsByContent: ios.apportionsSegmentWidthsByContent ? 'true' : 'false',
|
|
58
|
+
selectedSegmentTintColor: ios.selectedSegmentTintColor ?? ''
|
|
59
|
+
};
|
|
60
|
+
}, [ios]);
|
|
61
|
+
|
|
62
|
+
// Normalize Android props
|
|
63
|
+
const nativeAndroid = (0, _react.useMemo)(() => {
|
|
64
|
+
if (!android) return undefined;
|
|
65
|
+
return {
|
|
66
|
+
selectionRequired: android.selectionRequired ? 'true' : 'false'
|
|
67
|
+
};
|
|
68
|
+
}, [android]);
|
|
69
|
+
|
|
70
|
+
// Merge user style with Android minHeight default
|
|
71
|
+
const mergedStyle = (0, _react.useMemo)(() => {
|
|
72
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
73
|
+
return [styles.androidDefault, style];
|
|
74
|
+
}
|
|
75
|
+
return style;
|
|
76
|
+
}, [style]);
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SegmentedControlNativeComponent.default, {
|
|
78
|
+
style: mergedStyle,
|
|
79
|
+
segments: nativeSegments,
|
|
80
|
+
selectedValue: selectedData,
|
|
81
|
+
interactivity: disabled ? 'disabled' : 'enabled',
|
|
82
|
+
onSelect: onSelect ? handleSelect : undefined,
|
|
83
|
+
ios: nativeIos,
|
|
84
|
+
android: nativeAndroid,
|
|
85
|
+
...viewProps
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const styles = _reactNative.StyleSheet.create({
|
|
89
|
+
androidDefault: {
|
|
90
|
+
minHeight: ANDROID_MIN_HEIGHT
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_SegmentedControlNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ANDROID_MIN_HEIGHT","normalizeSelectedValue","selected","SegmentedControl","props","style","segments","selectedValue","disabled","onSelect","ios","android","viewProps","nativeSegments","useMemo","map","seg","label","value","icon","selectedData","handleSelect","useCallback","index","nativeEvent","nativeIos","undefined","momentary","apportionsSegmentWidthsByContent","selectedSegmentTintColor","nativeAndroid","selectionRequired","mergedStyle","Platform","OS","styles","androidDefault","jsx","interactivity","StyleSheet","create","minHeight"],"sourceRoot":"../../src","sources":["SegmentedControl.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,gCAAA,GAAAC,sBAAA,CAAAH,OAAA;AAE2C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAA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BAAU,CAACC,MAAM,CAAC;EAC/BJ,cAAc,EAAE;IACdK,SAAS,EAAEzC;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
|
+
);
|
package/lib/commonjs/index.js
CHANGED
|
@@ -36,6 +36,28 @@ Object.keys(_ContextMenu).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _SegmentedControl = require("./SegmentedControl");
|
|
40
|
+
Object.keys(_SegmentedControl).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _SegmentedControl[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _SegmentedControl[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _LiquidGlass = require("./LiquidGlass");
|
|
51
|
+
Object.keys(_LiquidGlass).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _LiquidGlass[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _LiquidGlass[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
39
61
|
var _sharedTypes = require("./sharedTypes");
|
|
40
62
|
Object.keys(_sharedTypes).forEach(function (key) {
|
|
41
63
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_DatePicker","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_SelectionMenu","_ContextMenu","_sharedTypes"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,YAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,YAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,YAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,
|
|
1
|
+
{"version":3,"names":["_DatePicker","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_SelectionMenu","_ContextMenu","_SegmentedControl","_LiquidGlass","_sharedTypes"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,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