react-native-platform-components 0.6.0 → 0.6.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 +58 -0
- package/android/src/main/java/com/platformcomponents/PCContextMenuView.kt +2 -2
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +4 -0
- package/app.plugin.cjs +4 -0
- package/expo-module.config.json +4 -0
- package/ios/PCContextMenu.swift +65 -22
- package/ios/PCDatePickerView.swift +25 -11
- package/lib/commonjs/ContextMenu.js +118 -0
- package/lib/commonjs/ContextMenu.js.map +1 -0
- package/lib/commonjs/ContextMenuNativeComponent.ts +141 -0
- package/lib/commonjs/DatePicker.js +86 -0
- package/lib/commonjs/DatePicker.js.map +1 -0
- package/lib/commonjs/DatePickerNativeComponent.ts +69 -0
- package/lib/commonjs/SelectionMenu.js +73 -0
- package/lib/commonjs/SelectionMenu.js.map +1 -0
- package/lib/commonjs/SelectionMenuNativeComponent.ts +97 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/sharedTypes.js +6 -0
- package/lib/commonjs/sharedTypes.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/ContextMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DatePicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SelectionMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -0
- package/lib/typescript/module/src/ContextMenu.d.ts +79 -0
- package/lib/typescript/module/src/ContextMenu.d.ts.map +1 -0
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +122 -0
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/DatePicker.d.ts +40 -0
- package/lib/typescript/module/src/DatePicker.d.ts.map +1 -0
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +54 -0
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/SelectionMenu.d.ts +47 -0
- package/lib/typescript/module/src/SelectionMenu.d.ts.map +1 -0
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +78 -0
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +5 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/sharedTypes.d.ts +12 -0
- package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -0
- package/package.json +29 -10
- package/plugin/build/index.cjs +26 -0
- package/plugin/build/index.d.ts +22 -0
- package/plugin/build/index.d.ts.map +1 -0
- package/plugin/tsconfig.json +16 -0
- package/lib/typescript/src/ContextMenu.d.ts.map +0 -1
- package/lib/typescript/src/ContextMenuNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/DatePicker.d.ts.map +0 -1
- package/lib/typescript/src/DatePickerNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/SelectionMenu.d.ts.map +0 -1
- package/lib/typescript/src/SelectionMenuNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/sharedTypes.d.ts.map +0 -1
- /package/lib/typescript/{src → commonjs/src}/ContextMenu.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/ContextMenuNativeComponent.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/DatePicker.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/DatePickerNativeComponent.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/SelectionMenu.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/SelectionMenuNativeComponent.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/sharedTypes.d.ts +0 -0
- /package/lib/typescript/{package.json → module/package.json} +0 -0
package/README.md
CHANGED
|
@@ -78,6 +78,64 @@ pod install
|
|
|
78
78
|
- Supports **Material 3** styling
|
|
79
79
|
- No additional setup required beyond autolinking
|
|
80
80
|
|
|
81
|
+
### Expo (Managed Workflow)
|
|
82
|
+
|
|
83
|
+
> **Note:** This library is **not supported in Expo Go**. It requires native code and must be used with [Expo Dev Client](https://docs.expo.dev/develop/development-builds/introduction/) or EAS Build.
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
npx expo install react-native-platform-components
|
|
87
|
+
npx expo prebuild
|
|
88
|
+
npx expo run:ios
|
|
89
|
+
# or
|
|
90
|
+
npx expo run:android
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The library includes an Expo config plugin that handles all native configuration automatically. No manual native setup is required.
|
|
94
|
+
|
|
95
|
+
**EAS Build:**
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
eas build --platform ios
|
|
99
|
+
eas build --platform android
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Config Plugin:**
|
|
103
|
+
|
|
104
|
+
Add to your `app.json`:
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"expo": {
|
|
108
|
+
"plugins": [
|
|
109
|
+
["react-native-platform-components/app.plugin", {}]
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For a complete working example, see the [`example-expo/`](./example-expo) directory.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## React Native New Architecture
|
|
120
|
+
|
|
121
|
+
This library is built for the **React Native New Architecture** (Fabric + TurboModules).
|
|
122
|
+
|
|
123
|
+
| Feature | Status |
|
|
124
|
+
|---------|--------|
|
|
125
|
+
| Fabric (New Renderer) | Supported |
|
|
126
|
+
| Codegen | Used for type-safe native bindings |
|
|
127
|
+
| TurboModules | N/A (view components only) |
|
|
128
|
+
| Old Architecture | Not supported |
|
|
129
|
+
|
|
130
|
+
**Tested with:**
|
|
131
|
+
- React Native 0.81+ (bare and Expo)
|
|
132
|
+
- Expo SDK 54+
|
|
133
|
+
|
|
134
|
+
**Requirements:**
|
|
135
|
+
- New Architecture must be enabled in your app
|
|
136
|
+
- For bare React Native: set `newArchEnabled=true` in `gradle.properties` (Android) and use the `RCT_NEW_ARCH_ENABLED` flag (iOS)
|
|
137
|
+
- For Expo: set `"newArchEnabled": true` in `app.json`
|
|
138
|
+
|
|
81
139
|
---
|
|
82
140
|
|
|
83
141
|
## Quick Start
|
|
@@ -9,12 +9,12 @@ import android.view.Menu
|
|
|
9
9
|
import android.view.MotionEvent
|
|
10
10
|
import android.view.View
|
|
11
11
|
import android.view.ViewConfiguration
|
|
12
|
-
import android.widget.FrameLayout
|
|
13
12
|
import androidx.appcompat.widget.PopupMenu
|
|
14
13
|
import androidx.core.content.ContextCompat
|
|
15
14
|
import androidx.core.graphics.drawable.DrawableCompat
|
|
15
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
16
16
|
|
|
17
|
-
class PCContextMenuView(context: Context) :
|
|
17
|
+
class PCContextMenuView(context: Context) : ReactViewGroup(context) {
|
|
18
18
|
|
|
19
19
|
data class Action(
|
|
20
20
|
val id: String,
|
|
@@ -341,12 +341,16 @@ class PCSelectionMenuView(context: Context) : FrameLayout(context), ReactScrollV
|
|
|
341
341
|
|
|
342
342
|
if (mode == MaterialMode.M3) {
|
|
343
343
|
// M3 exposed dropdown menu - the standard Material 3 way
|
|
344
|
+
// Must set box background mode BEFORE setting endIconMode to avoid IllegalStateException
|
|
344
345
|
val til = TextInputLayout(context).apply {
|
|
345
346
|
layoutParams = FrameLayout.LayoutParams(
|
|
346
347
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
|
347
348
|
FrameLayout.LayoutParams.WRAP_CONTENT
|
|
348
349
|
)
|
|
350
|
+
// Set box background mode first - required for END_ICON_DROPDOWN_MENU
|
|
351
|
+
boxBackgroundMode = TextInputLayout.BOX_BACKGROUND_OUTLINE
|
|
349
352
|
hint = placeholder
|
|
353
|
+
// Now safe to set the dropdown icon
|
|
350
354
|
endIconMode = TextInputLayout.END_ICON_DROPDOWN_MENU
|
|
351
355
|
}
|
|
352
356
|
|
package/app.plugin.cjs
ADDED
package/ios/PCContextMenu.swift
CHANGED
|
@@ -114,6 +114,8 @@ public final class PCContextMenuView: UIView, UIContextMenuInteractionDelegate {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
|
|
118
|
+
|
|
117
119
|
private func updateEnabled() {
|
|
118
120
|
let disabled = (interactivity == "disabled")
|
|
119
121
|
alpha = disabled ? 0.5 : 1.0
|
|
@@ -146,10 +148,14 @@ public final class PCContextMenuView: UIView, UIContextMenuInteractionDelegate {
|
|
|
146
148
|
|
|
147
149
|
private func installContextMenuInteraction() {
|
|
148
150
|
guard contextMenuInteraction == nil else { return }
|
|
151
|
+
|
|
152
|
+
// Install interaction on self so that long-press on our view triggers the menu.
|
|
153
|
+
// We use UITargetedPreview in the delegate methods to show the parent view
|
|
154
|
+
// (which contains the React content) as the preview.
|
|
149
155
|
let interaction = UIContextMenuInteraction(delegate: self)
|
|
150
156
|
addInteraction(interaction)
|
|
151
157
|
contextMenuInteraction = interaction
|
|
152
|
-
logger.debug("Installed UIContextMenuInteraction")
|
|
158
|
+
logger.debug("Installed UIContextMenuInteraction on PCContextMenuView")
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
private func removeContextMenuInteraction() {
|
|
@@ -167,14 +173,12 @@ public final class PCContextMenuView: UIView, UIContextMenuInteractionDelegate {
|
|
|
167
173
|
return
|
|
168
174
|
}
|
|
169
175
|
|
|
170
|
-
let button = UIButton(type: .
|
|
176
|
+
let button = UIButton(type: .system)
|
|
171
177
|
button.backgroundColor = .clear
|
|
172
178
|
button.showsMenuAsPrimaryAction = true
|
|
173
179
|
button.translatesAutoresizingMaskIntoConstraints = false
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
let interaction = UIContextMenuInteraction(delegate: self)
|
|
177
|
-
button.addInteraction(interaction)
|
|
180
|
+
// Make button invisible but still tappable
|
|
181
|
+
button.tintColor = .clear
|
|
178
182
|
|
|
179
183
|
addSubview(button)
|
|
180
184
|
NSLayoutConstraint.activate([
|
|
@@ -218,25 +222,13 @@ public final class PCContextMenuView: UIView, UIContextMenuInteractionDelegate {
|
|
|
218
222
|
let actions = parsedActions.filter { !$0.hidden }
|
|
219
223
|
guard !actions.isEmpty else { return nil }
|
|
220
224
|
|
|
221
|
-
|
|
225
|
+
let actionCountStr = String(actions.count)
|
|
226
|
+
logger.debug("contextMenuInteraction: creating configuration with \(actionCountStr) actions")
|
|
222
227
|
|
|
228
|
+
// Use nil previewProvider - we'll use UITargetedPreview via delegate instead
|
|
223
229
|
return UIContextMenuConfiguration(
|
|
224
230
|
identifier: nil,
|
|
225
|
-
previewProvider:
|
|
226
|
-
// Return a preview controller showing the content
|
|
227
|
-
guard let self else { return nil }
|
|
228
|
-
let preview = UIViewController()
|
|
229
|
-
preview.view.backgroundColor = .clear
|
|
230
|
-
|
|
231
|
-
// Snapshot the current view for preview
|
|
232
|
-
let snapshot = self.snapshotView(afterScreenUpdates: false)
|
|
233
|
-
if let snap = snapshot {
|
|
234
|
-
snap.frame = CGRect(origin: .zero, size: self.bounds.size)
|
|
235
|
-
preview.view.addSubview(snap)
|
|
236
|
-
preview.preferredContentSize = self.bounds.size
|
|
237
|
-
}
|
|
238
|
-
return preview
|
|
239
|
-
} : nil,
|
|
231
|
+
previewProvider: nil,
|
|
240
232
|
actionProvider: { [weak self] suggestedActions in
|
|
241
233
|
guard let self else { return nil }
|
|
242
234
|
return self.buildMenu(from: actions, title: self.menuTitle)
|
|
@@ -244,6 +236,57 @@ public final class PCContextMenuView: UIView, UIContextMenuInteractionDelegate {
|
|
|
244
236
|
)
|
|
245
237
|
}
|
|
246
238
|
|
|
239
|
+
/// Get the parent component view (PCContextMenu) which contains all React content
|
|
240
|
+
private func getParentComponentView() -> UIView? {
|
|
241
|
+
return superview
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
public func contextMenuInteraction(
|
|
245
|
+
_ interaction: UIContextMenuInteraction,
|
|
246
|
+
previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration
|
|
247
|
+
) -> UITargetedPreview? {
|
|
248
|
+
let parameters = UIPreviewParameters()
|
|
249
|
+
parameters.backgroundColor = .clear
|
|
250
|
+
|
|
251
|
+
// Check if preview is enabled via the enablePreview prop
|
|
252
|
+
if enablePreview == "true" {
|
|
253
|
+
// Target the parent view (PCContextMenu) which contains the React content
|
|
254
|
+
guard let parentView = getParentComponentView() else {
|
|
255
|
+
logger.debug("previewForHighlighting: no parent found")
|
|
256
|
+
return nil
|
|
257
|
+
}
|
|
258
|
+
let parentType = String(describing: type(of: parentView))
|
|
259
|
+
logger.debug("previewForHighlighting: targeting parent \(parentType)")
|
|
260
|
+
parameters.visiblePath = UIBezierPath(roundedRect: parentView.bounds, cornerRadius: 8)
|
|
261
|
+
return UITargetedPreview(view: parentView, parameters: parameters)
|
|
262
|
+
} else {
|
|
263
|
+
// When preview is disabled, target self with zero-size path
|
|
264
|
+
// This prevents iOS from manipulating the parent view and causing white flashes
|
|
265
|
+
logger.debug("previewForHighlighting: preview disabled, targeting self with zero path")
|
|
266
|
+
parameters.visiblePath = UIBezierPath(rect: .zero)
|
|
267
|
+
return UITargetedPreview(view: self, parameters: parameters)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
public func contextMenuInteraction(
|
|
272
|
+
_ interaction: UIContextMenuInteraction,
|
|
273
|
+
previewForDismissingMenuWithConfiguration configuration: UIContextMenuConfiguration
|
|
274
|
+
) -> UITargetedPreview? {
|
|
275
|
+
let parameters = UIPreviewParameters()
|
|
276
|
+
parameters.backgroundColor = .clear
|
|
277
|
+
|
|
278
|
+
if enablePreview == "true" {
|
|
279
|
+
guard let parentView = getParentComponentView() else {
|
|
280
|
+
return nil
|
|
281
|
+
}
|
|
282
|
+
parameters.visiblePath = UIBezierPath(roundedRect: parentView.bounds, cornerRadius: 8)
|
|
283
|
+
return UITargetedPreview(view: parentView, parameters: parameters)
|
|
284
|
+
} else {
|
|
285
|
+
parameters.visiblePath = UIBezierPath(rect: .zero)
|
|
286
|
+
return UITargetedPreview(view: self, parameters: parameters)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
247
290
|
public func contextMenuInteraction(
|
|
248
291
|
_ interaction: UIContextMenuInteraction,
|
|
249
292
|
willDisplayMenuFor configuration: UIContextMenuConfiguration,
|
|
@@ -283,31 +283,45 @@ public final class PCDatePickerView: UIControl,
|
|
|
283
283
|
// Prevent "settle" events right as we present.
|
|
284
284
|
suppressNextChangesBriefly()
|
|
285
285
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
// Check if using inline style (full calendar) - needs larger popover size
|
|
287
|
+
var isInlineStyle = false
|
|
288
|
+
if #available(iOS 13.4, *) {
|
|
289
|
+
isInlineStyle = picker.preferredDatePickerStyle == .inline
|
|
290
|
+
}
|
|
289
291
|
|
|
292
|
+
let vc = UIViewController()
|
|
290
293
|
picker.translatesAutoresizingMaskIntoConstraints = false
|
|
291
294
|
vc.view.addSubview(picker)
|
|
292
295
|
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
// For inline style, use system background and constrain all edges
|
|
297
|
+
// For other styles, use clear background and only top/leading constraints
|
|
298
|
+
if isInlineStyle {
|
|
299
|
+
vc.view.backgroundColor = .systemBackground
|
|
300
|
+
vc.view.isOpaque = true
|
|
301
|
+
NSLayoutConstraint.activate([
|
|
302
|
+
picker.topAnchor.constraint(equalTo: vc.view.topAnchor, constant: 8),
|
|
303
|
+
picker.leadingAnchor.constraint(equalTo: vc.view.leadingAnchor, constant: 8),
|
|
304
|
+
picker.trailingAnchor.constraint(equalTo: vc.view.trailingAnchor, constant: -8),
|
|
305
|
+
picker.bottomAnchor.constraint(equalTo: vc.view.bottomAnchor, constant: -8),
|
|
306
|
+
])
|
|
307
|
+
} else {
|
|
308
|
+
vc.view.backgroundColor = .clear
|
|
309
|
+
vc.view.isOpaque = false
|
|
310
|
+
NSLayoutConstraint.activate([
|
|
311
|
+
picker.topAnchor.constraint(equalTo: vc.view.topAnchor),
|
|
312
|
+
picker.leadingAnchor.constraint(equalTo: vc.view.leadingAnchor),
|
|
313
|
+
])
|
|
314
|
+
}
|
|
298
315
|
|
|
299
316
|
let size = popoverContentSize()
|
|
300
317
|
vc.preferredContentSize = size
|
|
301
318
|
|
|
302
|
-
// ✅ Anchored popover-style (not a full sheet)
|
|
303
319
|
vc.modalPresentationStyle = .popover
|
|
304
320
|
vc.presentationController?.delegate = self
|
|
305
321
|
|
|
306
322
|
if let pop = vc.popoverPresentationController {
|
|
307
323
|
pop.delegate = self
|
|
308
324
|
pop.sourceView = self
|
|
309
|
-
// Use a minimum height for sourceRect to help popover positioning
|
|
310
|
-
// (modal presentation views have zero intrinsic height)
|
|
311
325
|
let sourceRect = CGRect(
|
|
312
326
|
x: bounds.minX,
|
|
313
327
|
y: bounds.minY,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContextMenu = ContextMenu;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _ContextMenuNativeComponent = _interopRequireDefault(require("./ContextMenuNativeComponent"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
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); }
|
|
12
|
+
// ContextMenu.tsx
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Attributes for a context menu action.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A single action in the context menu.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Convert user-friendly subaction to native format (no further nesting).
|
|
24
|
+
*/
|
|
25
|
+
function normalizeSubaction(action) {
|
|
26
|
+
return {
|
|
27
|
+
id: action.id,
|
|
28
|
+
title: action.title,
|
|
29
|
+
subtitle: action.subtitle,
|
|
30
|
+
image: action.image,
|
|
31
|
+
imageColor: action.imageColor,
|
|
32
|
+
attributes: action.attributes ? {
|
|
33
|
+
destructive: action.attributes.destructive ? 'true' : 'false',
|
|
34
|
+
disabled: action.attributes.disabled ? 'true' : 'false',
|
|
35
|
+
hidden: action.attributes.hidden ? 'true' : 'false'
|
|
36
|
+
} : undefined,
|
|
37
|
+
state: action.state
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Convert user-friendly action to native format.
|
|
43
|
+
* Note: Only one level of nesting is supported by the native component.
|
|
44
|
+
*/
|
|
45
|
+
function normalizeAction(action) {
|
|
46
|
+
return {
|
|
47
|
+
id: action.id,
|
|
48
|
+
title: action.title,
|
|
49
|
+
subtitle: action.subtitle,
|
|
50
|
+
image: action.image,
|
|
51
|
+
imageColor: action.imageColor,
|
|
52
|
+
attributes: action.attributes ? {
|
|
53
|
+
destructive: action.attributes.destructive ? 'true' : 'false',
|
|
54
|
+
disabled: action.attributes.disabled ? 'true' : 'false',
|
|
55
|
+
hidden: action.attributes.hidden ? 'true' : 'false'
|
|
56
|
+
} : undefined,
|
|
57
|
+
state: action.state,
|
|
58
|
+
subactions: action.subactions?.map(normalizeSubaction)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function ContextMenu(props) {
|
|
62
|
+
const {
|
|
63
|
+
style,
|
|
64
|
+
title,
|
|
65
|
+
actions,
|
|
66
|
+
disabled,
|
|
67
|
+
trigger = 'longPress',
|
|
68
|
+
onPressAction,
|
|
69
|
+
onMenuOpen,
|
|
70
|
+
onMenuClose,
|
|
71
|
+
children,
|
|
72
|
+
ios,
|
|
73
|
+
android,
|
|
74
|
+
...viewProps
|
|
75
|
+
} = props;
|
|
76
|
+
const nativeActions = (0, _react.useMemo)(() => actions.map(normalizeAction), [actions]);
|
|
77
|
+
const handlePressAction = (0, _react.useCallback)(e => {
|
|
78
|
+
const {
|
|
79
|
+
actionId,
|
|
80
|
+
actionTitle
|
|
81
|
+
} = e.nativeEvent;
|
|
82
|
+
onPressAction?.(actionId, actionTitle);
|
|
83
|
+
}, [onPressAction]);
|
|
84
|
+
const handleMenuOpen = (0, _react.useCallback)(() => {
|
|
85
|
+
onMenuOpen?.();
|
|
86
|
+
}, [onMenuOpen]);
|
|
87
|
+
const handleMenuClose = (0, _react.useCallback)(() => {
|
|
88
|
+
onMenuClose?.();
|
|
89
|
+
}, [onMenuClose]);
|
|
90
|
+
const nativeIOS = (0, _react.useMemo)(() => {
|
|
91
|
+
if (!ios) return undefined;
|
|
92
|
+
return {
|
|
93
|
+
enablePreview: ios.enablePreview ? 'true' : 'false'
|
|
94
|
+
};
|
|
95
|
+
}, [ios]);
|
|
96
|
+
const nativeAndroid = (0, _react.useMemo)(() => {
|
|
97
|
+
if (!android) return undefined;
|
|
98
|
+
return {
|
|
99
|
+
anchorPosition: android.anchorPosition,
|
|
100
|
+
visible: android.visible ? 'open' : 'closed'
|
|
101
|
+
};
|
|
102
|
+
}, [android]);
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ContextMenuNativeComponent.default, {
|
|
104
|
+
style: style,
|
|
105
|
+
title: title,
|
|
106
|
+
actions: nativeActions,
|
|
107
|
+
interactivity: disabled ? 'disabled' : 'enabled',
|
|
108
|
+
trigger: trigger,
|
|
109
|
+
onPressAction: onPressAction ? handlePressAction : undefined,
|
|
110
|
+
onMenuOpen: onMenuOpen ? handleMenuOpen : undefined,
|
|
111
|
+
onMenuClose: onMenuClose ? handleMenuClose : undefined,
|
|
112
|
+
ios: nativeIOS,
|
|
113
|
+
android: nativeAndroid,
|
|
114
|
+
...viewProps,
|
|
115
|
+
children: children
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ContextMenuNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","normalizeSubaction","action","id","title","subtitle","image","imageColor","attributes","destructive","disabled","hidden","undefined","state","normalizeAction","subactions","map","ContextMenu","props","style","actions","trigger","onPressAction","onMenuOpen","onMenuClose","children","ios","android","viewProps","nativeActions","useMemo","handlePressAction","useCallback","actionId","actionTitle","nativeEvent","handleMenuOpen","handleMenuClose","nativeIOS","enablePreview","nativeAndroid","anchorPosition","visible","jsx","interactivity"],"sourceRoot":"../../src","sources":["ContextMenu.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,2BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIsC,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAE,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AAA,EAAChE,2BAAA,CAAAK,OAAiB;IAChBmC,KAAK,EAAEA,KAAM;IACbf,KAAK,EAAEA,KAAM;IACbgB,OAAO,EAAES,aAAc;IACvBe,aAAa,EAAElC,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDW,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAa,GAAGS,iBAAiB,GAAGnB,SAAU;IAC7DW,UAAU,EAAEA,UAAU,GAAGa,cAAc,GAAGxB,SAAU;IACpDY,WAAW,EAAEA,WAAW,GAAGa,eAAe,GAAGzB,SAAU;IACvDc,GAAG,EAAEY,SAAU;IACfX,OAAO,EAAEa,aAAc;IAAA,GACnBZ,SAAS;IAAAH,QAAA,EAEZA;EAAQ,CACQ,CAAC;AAExB","ignoreList":[]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// ContextMenuNativeComponent.ts
|
|
2
|
+
import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Attributes for a context menu action.
|
|
7
|
+
*/
|
|
8
|
+
export type ContextMenuActionAttributes = Readonly<{
|
|
9
|
+
/** Whether the action is destructive (red styling) */
|
|
10
|
+
destructive?: string; // 'true' | 'false'
|
|
11
|
+
/** Whether the action is disabled (grayed out) */
|
|
12
|
+
disabled?: string; // 'true' | 'false'
|
|
13
|
+
/** Whether the action is hidden */
|
|
14
|
+
hidden?: string; // 'true' | 'false'
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A leaf subaction (no further nesting to avoid codegen recursion issues).
|
|
19
|
+
*/
|
|
20
|
+
export type ContextMenuSubaction = Readonly<{
|
|
21
|
+
/** Unique identifier returned in callbacks */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Display title */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Secondary text (iOS only) */
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
/** Icon name (SF Symbol on iOS, drawable resource on Android) */
|
|
28
|
+
image?: string;
|
|
29
|
+
/** Tint color for the icon (hex string, e.g., "#FF0000") */
|
|
30
|
+
imageColor?: string;
|
|
31
|
+
/** Action attributes */
|
|
32
|
+
attributes?: ContextMenuActionAttributes;
|
|
33
|
+
/** Checkmark state: 'off' | 'on' | 'mixed' */
|
|
34
|
+
state?: string;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A single action in the context menu.
|
|
39
|
+
* Actions can be nested one level via `subactions` for submenus.
|
|
40
|
+
*/
|
|
41
|
+
export type ContextMenuAction = Readonly<{
|
|
42
|
+
/** Unique identifier returned in callbacks */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Display title */
|
|
45
|
+
title: string;
|
|
46
|
+
/** Secondary text (iOS only) */
|
|
47
|
+
subtitle?: string;
|
|
48
|
+
/** Icon name (SF Symbol on iOS, drawable resource on Android) */
|
|
49
|
+
image?: string;
|
|
50
|
+
/** Tint color for the icon (hex string, e.g., "#FF0000") */
|
|
51
|
+
imageColor?: string;
|
|
52
|
+
/** Action attributes */
|
|
53
|
+
attributes?: ContextMenuActionAttributes;
|
|
54
|
+
/** Checkmark state: 'off' | 'on' | 'mixed' */
|
|
55
|
+
state?: string;
|
|
56
|
+
/** Nested actions for submenu (one level deep) */
|
|
57
|
+
subactions?: ReadonlyArray<ContextMenuSubaction>;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Event emitted when an action is pressed.
|
|
62
|
+
*/
|
|
63
|
+
export type ContextMenuPressActionEvent = Readonly<{
|
|
64
|
+
/** The action's unique identifier */
|
|
65
|
+
actionId: string;
|
|
66
|
+
/** The action's title */
|
|
67
|
+
actionTitle: string;
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
/** Interactivity state (no booleans for codegen). */
|
|
71
|
+
export type ContextMenuInteractivity = 'enabled' | 'disabled';
|
|
72
|
+
|
|
73
|
+
/** Trigger mode for opening the menu. */
|
|
74
|
+
export type ContextMenuTrigger = 'longPress' | 'tap';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* iOS-specific configuration.
|
|
78
|
+
*/
|
|
79
|
+
export type IOSProps = Readonly<{
|
|
80
|
+
/** Enable preview when long-pressing */
|
|
81
|
+
enablePreview?: string; // 'true' | 'false'
|
|
82
|
+
}>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Android-specific configuration.
|
|
86
|
+
*/
|
|
87
|
+
export type AndroidProps = Readonly<{
|
|
88
|
+
/** Anchor position for the popup menu */
|
|
89
|
+
anchorPosition?: string; // 'left' | 'right'
|
|
90
|
+
/**
|
|
91
|
+
* Programmatic visibility control (Android only).
|
|
92
|
+
* 'open' to show the menu, 'closed' to hide it.
|
|
93
|
+
*/
|
|
94
|
+
visible?: string; // 'open' | 'closed'
|
|
95
|
+
}>;
|
|
96
|
+
|
|
97
|
+
export interface ContextMenuProps extends ViewProps {
|
|
98
|
+
/**
|
|
99
|
+
* Menu title (shown as header on iOS).
|
|
100
|
+
*/
|
|
101
|
+
title?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Menu actions.
|
|
105
|
+
*/
|
|
106
|
+
actions: ReadonlyArray<ContextMenuAction>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Enabled / disabled state.
|
|
110
|
+
*/
|
|
111
|
+
interactivity?: string; // ContextMenuInteractivity
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* How the menu is triggered:
|
|
115
|
+
* - 'longPress' (default): Long-press opens the menu
|
|
116
|
+
* - 'tap': Single tap opens the menu
|
|
117
|
+
*/
|
|
118
|
+
trigger?: string; // ContextMenuTrigger
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Fired when user presses an action.
|
|
122
|
+
*/
|
|
123
|
+
onPressAction?: CodegenTypes.BubblingEventHandler<ContextMenuPressActionEvent>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Fired when menu opens.
|
|
127
|
+
*/
|
|
128
|
+
onMenuOpen?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Fired when menu closes.
|
|
132
|
+
*/
|
|
133
|
+
onMenuClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
134
|
+
|
|
135
|
+
ios?: IOSProps;
|
|
136
|
+
android?: AndroidProps;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default codegenNativeComponent<ContextMenuProps>(
|
|
140
|
+
'PCContextMenu'
|
|
141
|
+
) as HostComponent<ContextMenuProps>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DatePicker = DatePicker;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _DatePickerNativeComponent = _interopRequireDefault(require("./DatePickerNativeComponent"));
|
|
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
|
+
// DatePicker.tsx
|
|
14
|
+
|
|
15
|
+
// Sentinel value for "no date". Using MIN_SAFE_INTEGER ensures we don't
|
|
16
|
+
// conflict with valid negative timestamps (dates before 1970).
|
|
17
|
+
const NO_DATE_SENTINEL = Number.MIN_SAFE_INTEGER;
|
|
18
|
+
function dateToMsOrSentinel(d) {
|
|
19
|
+
if (!d) return NO_DATE_SENTINEL;
|
|
20
|
+
const ms = d.getTime();
|
|
21
|
+
return Number.isFinite(ms) ? ms : NO_DATE_SENTINEL;
|
|
22
|
+
}
|
|
23
|
+
function normalizeVisible(presentation, visible) {
|
|
24
|
+
// Only meaningful in modal presentation. Keep undefined for inline to avoid noise.
|
|
25
|
+
if (presentation !== 'modal') return undefined;
|
|
26
|
+
return visible ? 'open' : 'closed';
|
|
27
|
+
}
|
|
28
|
+
function DatePicker(props) {
|
|
29
|
+
const {
|
|
30
|
+
style,
|
|
31
|
+
date,
|
|
32
|
+
minDate,
|
|
33
|
+
maxDate,
|
|
34
|
+
locale,
|
|
35
|
+
timeZoneName,
|
|
36
|
+
mode,
|
|
37
|
+
presentation = 'modal',
|
|
38
|
+
visible,
|
|
39
|
+
onConfirm,
|
|
40
|
+
onClosed,
|
|
41
|
+
ios,
|
|
42
|
+
android,
|
|
43
|
+
testID
|
|
44
|
+
} = props;
|
|
45
|
+
const isModal = presentation === 'modal';
|
|
46
|
+
const handleConfirm = (0, _react.useCallback)(e => {
|
|
47
|
+
onConfirm?.(new Date(e.nativeEvent.timestampMs));
|
|
48
|
+
}, [onConfirm]);
|
|
49
|
+
const handleClosed = (0, _react.useCallback)(() => {
|
|
50
|
+
onClosed?.();
|
|
51
|
+
}, [onClosed]);
|
|
52
|
+
const nativeProps = {
|
|
53
|
+
style: [styles.picker, style],
|
|
54
|
+
mode,
|
|
55
|
+
locale,
|
|
56
|
+
timeZoneName,
|
|
57
|
+
presentation,
|
|
58
|
+
visible: normalizeVisible(presentation, visible),
|
|
59
|
+
dateMs: dateToMsOrSentinel(date),
|
|
60
|
+
minDateMs: dateToMsOrSentinel(minDate),
|
|
61
|
+
maxDateMs: dateToMsOrSentinel(maxDate),
|
|
62
|
+
onConfirm: onConfirm ? handleConfirm : undefined,
|
|
63
|
+
onClosed: isModal && onClosed ? handleClosed : undefined,
|
|
64
|
+
ios: ios ? {
|
|
65
|
+
preferredStyle: ios.preferredStyle,
|
|
66
|
+
countDownDurationSeconds: ios.countDownDurationSeconds,
|
|
67
|
+
minuteInterval: ios.minuteInterval,
|
|
68
|
+
roundsToMinuteInterval: ios.roundsToMinuteInterval
|
|
69
|
+
} : undefined,
|
|
70
|
+
android: android ? {
|
|
71
|
+
firstDayOfWeek: android.firstDayOfWeek,
|
|
72
|
+
material: android.material,
|
|
73
|
+
dialogTitle: android.dialogTitle,
|
|
74
|
+
positiveButtonTitle: android.positiveButtonTitle,
|
|
75
|
+
negativeButtonTitle: android.negativeButtonTitle
|
|
76
|
+
} : undefined
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerNativeComponent.default, {
|
|
79
|
+
testID: testID,
|
|
80
|
+
...nativeProps
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const styles = _reactNative.StyleSheet.create({
|
|
84
|
+
picker: {}
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DatePickerNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NO_DATE_SENTINEL","Number","MIN_SAFE_INTEGER","dateToMsOrSentinel","d","ms","getTime","isFinite","normalizeVisible","presentation","visible","undefined","DatePicker","props","style","date","minDate","maxDate","locale","timeZoneName","mode","onConfirm","onClosed","ios","android","testID","isModal","handleConfirm","useCallback","Date","nativeEvent","timestampMs","handleClosed","nativeProps","styles","picker","dateMs","minDateMs","maxDateMs","preferredStyle","countDownDurationSeconds","minuteInterval","roundsToMinuteInterval","firstDayOfWeek","material","dialogTitle","positiveButtonTitle","negativeButtonTitle","jsx","StyleSheet","create"],"sourceRoot":"../../src","sources":["DatePicker.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,0BAAA,GAAAC,sBAAA,CAAAH,OAAA;AASqC,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,CAAAE,wBAAA,CAAAlB,CAAA,EAAAG,CAAA,OAAAK,CAAA,CAAAI,GAAA,IAAAJ,CAAA,CAAAK,GAAA,IAAAN,CAAA,CAAAE,CAAA,EAAA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