react-native-platform-components 0.8.1 → 0.8.3
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 +137 -1
- package/lib/commonjs/index.web.js +62 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/module/index.web.js +56 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/typescript/commonjs/src/index.web.d.ts +92 -0
- package/lib/typescript/commonjs/src/index.web.d.ts.map +1 -0
- package/lib/typescript/module/src/index.web.d.ts +92 -0
- package/lib/typescript/module/src/index.web.d.ts.map +1 -0
- package/package.json +11 -1
- package/src/index.web.tsx +151 -0
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ pod install
|
|
|
91
91
|
|
|
92
92
|
- Uses native Android Views with Material Design (including `PopupMenu` for context menus)
|
|
93
93
|
- Supports **Material 3** styling
|
|
94
|
-
-
|
|
94
|
+
- **⚠️ Your app may crash if theme is not configured** — See [Android Theme Configuration](#android-theme-configuration) below
|
|
95
95
|
|
|
96
96
|
### Expo (Managed Workflow)
|
|
97
97
|
|
|
@@ -702,6 +702,142 @@ This is intentional. The goal is native fidelity, not pixel-level customization.
|
|
|
702
702
|
|
|
703
703
|
---
|
|
704
704
|
|
|
705
|
+
## Android Theme Configuration
|
|
706
|
+
|
|
707
|
+
> **⚠️ Your app may hard crash if you skip this section.** Android components require specific theme configuration. Components can crash immediately on mount if the required theme attributes are missing.
|
|
708
|
+
|
|
709
|
+
### Theme Requirements by Component
|
|
710
|
+
|
|
711
|
+
| Component | Mode | Required Theme | Crash if Missing |
|
|
712
|
+
| -------------------- | ---------------------------- | ------------------- | ---------------- |
|
|
713
|
+
| **SegmentedControl** | (always M3) | `Theme.Material3.*` | ✅ Yes |
|
|
714
|
+
| **DatePicker** | `android.material: 'm3'` | `Theme.Material3.*` | ✅ Yes |
|
|
715
|
+
| **DatePicker** | `android.material: 'system'` | `Theme.AppCompat.*` | ✅ Yes |
|
|
716
|
+
| **SelectionMenu** | `android.material: 'm3'` | `Theme.Material3.*` | ✅ Yes |
|
|
717
|
+
| **SelectionMenu** | `android.material: 'system'` | `Theme.AppCompat.*` | ✅ Yes |
|
|
718
|
+
| **ContextMenu** | — | Any | ❌ No |
|
|
719
|
+
| **LiquidGlass** | — | Any | ❌ No |
|
|
720
|
+
|
|
721
|
+
### Material 3 Theme Setup (Required for SegmentedControl)
|
|
722
|
+
|
|
723
|
+
`SegmentedControl` always uses Material 3 widgets (`MaterialButtonToggleGroup`). Your app **must** use a Material 3 theme or the app will crash on component mount.
|
|
724
|
+
|
|
725
|
+
**1. Update your app theme in `android/app/src/main/res/values/styles.xml`:**
|
|
726
|
+
|
|
727
|
+
```xml
|
|
728
|
+
<resources>
|
|
729
|
+
<!-- Base application theme - MUST inherit from Material3 -->
|
|
730
|
+
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
|
|
731
|
+
<!-- Material 3 requires these color attributes -->
|
|
732
|
+
<item name="colorPrimary">@color/md_theme_primary</item>
|
|
733
|
+
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
|
|
734
|
+
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>
|
|
735
|
+
<item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item>
|
|
736
|
+
<item name="colorSecondary">@color/md_theme_secondary</item>
|
|
737
|
+
<item name="colorOnSecondary">@color/md_theme_onSecondary</item>
|
|
738
|
+
<item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item>
|
|
739
|
+
<item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item>
|
|
740
|
+
<item name="colorTertiary">@color/md_theme_tertiary</item>
|
|
741
|
+
<item name="colorOnTertiary">@color/md_theme_onTertiary</item>
|
|
742
|
+
<item name="colorBackground">@color/md_theme_background</item>
|
|
743
|
+
<item name="colorOnBackground">@color/md_theme_onBackground</item>
|
|
744
|
+
<item name="colorSurface">@color/md_theme_surface</item>
|
|
745
|
+
<item name="colorOnSurface">@color/md_theme_onSurface</item>
|
|
746
|
+
<item name="colorError">@color/md_theme_error</item>
|
|
747
|
+
<item name="colorOnError">@color/md_theme_onError</item>
|
|
748
|
+
</style>
|
|
749
|
+
</resources>
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**2. Define your Material 3 colors in `android/app/src/main/res/values/colors.xml`:**
|
|
753
|
+
|
|
754
|
+
```xml
|
|
755
|
+
<resources>
|
|
756
|
+
<!-- Generate these using Material Theme Builder: https://m3.material.io/theme-builder -->
|
|
757
|
+
<color name="md_theme_primary">#6750A4</color>
|
|
758
|
+
<color name="md_theme_onPrimary">#FFFFFF</color>
|
|
759
|
+
<color name="md_theme_primaryContainer">#EADDFF</color>
|
|
760
|
+
<color name="md_theme_onPrimaryContainer">#21005D</color>
|
|
761
|
+
<color name="md_theme_secondary">#625B71</color>
|
|
762
|
+
<color name="md_theme_onSecondary">#FFFFFF</color>
|
|
763
|
+
<color name="md_theme_secondaryContainer">#E8DEF8</color>
|
|
764
|
+
<color name="md_theme_onSecondaryContainer">#1D192B</color>
|
|
765
|
+
<color name="md_theme_tertiary">#7D5260</color>
|
|
766
|
+
<color name="md_theme_onTertiary">#FFFFFF</color>
|
|
767
|
+
<color name="md_theme_background">#FFFBFE</color>
|
|
768
|
+
<color name="md_theme_onBackground">#1C1B1F</color>
|
|
769
|
+
<color name="md_theme_surface">#FFFBFE</color>
|
|
770
|
+
<color name="md_theme_onSurface">#1C1B1F</color>
|
|
771
|
+
<color name="md_theme_error">#B3261E</color>
|
|
772
|
+
<color name="md_theme_onError">#FFFFFF</color>
|
|
773
|
+
</resources>
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
> **Tip:** Use Google's [Material Theme Builder](https://m3.material.io/theme-builder) to generate a complete color scheme.
|
|
777
|
+
|
|
778
|
+
### Common Crash Scenarios
|
|
779
|
+
|
|
780
|
+
#### Crash: `Cannot find theme attribute materialButtonOutlinedStyle`
|
|
781
|
+
|
|
782
|
+
**Cause:** Using `SegmentedControl` without a Material 3 theme.
|
|
783
|
+
|
|
784
|
+
**Fix:** Update your theme to inherit from `Theme.Material3.*`:
|
|
785
|
+
|
|
786
|
+
```xml
|
|
787
|
+
<!-- Change this -->
|
|
788
|
+
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
789
|
+
|
|
790
|
+
<!-- To this -->
|
|
791
|
+
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
#### Crash: `You need to use a Theme.AppCompat theme`
|
|
795
|
+
|
|
796
|
+
**Cause:** Using `DatePicker` or `SelectionMenu` with `android.material: 'system'` while not extending AppCompat.
|
|
797
|
+
|
|
798
|
+
**Fix:** Ensure your theme inherits from `Theme.AppCompat.*` or `Theme.Material3.*` (which extends AppCompat), and your `MainActivity` extends `AppCompatActivity`.
|
|
799
|
+
|
|
800
|
+
### Mode Selection Guide
|
|
801
|
+
|
|
802
|
+
Choose the appropriate mode based on your app's theme:
|
|
803
|
+
|
|
804
|
+
```tsx
|
|
805
|
+
// If your app uses Theme.Material3.* (recommended)
|
|
806
|
+
<DatePicker android={{ material: 'm3' }} />
|
|
807
|
+
<SelectionMenu android={{ material: 'm3' }} />
|
|
808
|
+
<SegmentedControl /> // Always M3
|
|
809
|
+
|
|
810
|
+
// If your app uses Theme.AppCompat.*
|
|
811
|
+
<DatePicker android={{ material: 'system' }} />
|
|
812
|
+
<SelectionMenu android={{ material: 'system' }} />
|
|
813
|
+
// ⚠️ SegmentedControl will crash - upgrade to Material 3
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### Expo Configuration
|
|
817
|
+
|
|
818
|
+
For Expo projects, the config plugin can configure your theme automatically. Add to `app.json`:
|
|
819
|
+
|
|
820
|
+
```json
|
|
821
|
+
{
|
|
822
|
+
"expo": {
|
|
823
|
+
"plugins": [
|
|
824
|
+
[
|
|
825
|
+
"react-native-platform-components/app.plugin",
|
|
826
|
+
{
|
|
827
|
+
"android": {
|
|
828
|
+
"theme": "material3"
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
]
|
|
832
|
+
]
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
Then run `npx expo prebuild` to apply the configuration.
|
|
838
|
+
|
|
839
|
+
---
|
|
840
|
+
|
|
705
841
|
## Icons
|
|
706
842
|
|
|
707
843
|
ContextMenu supports icons on menu items. Icons are specified by name and resolved differently on each platform.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isLiquidGlassSupported = exports.SelectionMenu = exports.SegmentedControl = exports.LiquidGlass = exports.DatePicker = exports.ContextMenu = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
// index.web.tsx
|
|
11
|
+
// Web stubs for react-native-platform-components
|
|
12
|
+
// These components are native-only and render nothing/children on web.
|
|
13
|
+
// This file is fully standalone to avoid importing native component specs.
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Shared Types (duplicated to avoid importing from files with native deps)
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// DatePicker
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
const DatePicker = _props => null;
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// SelectionMenu
|
|
27
|
+
// ============================================================================
|
|
28
|
+
exports.DatePicker = DatePicker;
|
|
29
|
+
const SelectionMenu = _props => null;
|
|
30
|
+
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// ContextMenu
|
|
33
|
+
// ============================================================================
|
|
34
|
+
exports.SelectionMenu = SelectionMenu;
|
|
35
|
+
const ContextMenu = ({
|
|
36
|
+
children
|
|
37
|
+
}) => {
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// SegmentedControl
|
|
45
|
+
// ============================================================================
|
|
46
|
+
exports.ContextMenu = ContextMenu;
|
|
47
|
+
const SegmentedControl = _props => null;
|
|
48
|
+
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// LiquidGlass
|
|
51
|
+
// ============================================================================
|
|
52
|
+
exports.SegmentedControl = SegmentedControl;
|
|
53
|
+
const LiquidGlass = ({
|
|
54
|
+
children
|
|
55
|
+
}) => {
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.LiquidGlass = LiquidGlass;
|
|
61
|
+
const isLiquidGlassSupported = exports.isLiquidGlassSupported = false;
|
|
62
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","DatePicker","_props","exports","SelectionMenu","ContextMenu","children","jsx","Fragment","SegmentedControl","LiquidGlass","isLiquidGlassSupported"],"sourceRoot":"../../src","sources":["index.web.tsx"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAL1B;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAMA;AACA;AACA;;AAoBO,MAAMG,UAAU,GACrBC,MAAuB,IACO,IAAI;;AAEpC;AACA;AACA;AAAAC,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAoBO,MAAMG,aAAa,GACxBF,MAA0B,IACI,IAAI;;AAEpC;AACA;AACA;AAAAC,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAgCO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC;AACgB,CAAC,KAAgC;EACjD,oBAAO,IAAAT,WAAA,CAAAU,GAAA,EAAAV,WAAA,CAAAW,QAAA;IAAAF,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB,CAAC;;AAED;AACA;AACA;AAAAH,OAAA,CAAAE,WAAA,GAAAA,WAAA;AAkBO,MAAMI,gBAAgB,GAC3BP,MAA6B,IACC,IAAI;;AAEpC;AACA;AACA;AAAAC,OAAA,CAAAM,gBAAA,GAAAA,gBAAA;AASO,MAAMC,WAAW,GAAGA,CAAC;EAC1BJ;AACgB,CAAC,KAAgC;EACjD,oBAAO,IAAAT,WAAA,CAAAU,GAAA,EAAAV,WAAA,CAAAW,QAAA;IAAAF,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB,CAAC;AAACH,OAAA,CAAAO,WAAA,GAAAA,WAAA;AAEK,MAAMC,sBAAsB,GAAAR,OAAA,CAAAQ,sBAAA,GAAG,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// index.web.tsx
|
|
4
|
+
// Web stubs for react-native-platform-components
|
|
5
|
+
// These components are native-only and render nothing/children on web.
|
|
6
|
+
// This file is fully standalone to avoid importing native component specs.
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Shared Types (duplicated to avoid importing from files with native deps)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// DatePicker
|
|
16
|
+
// ============================================================================
|
|
17
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
export const DatePicker = _props => null;
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// SelectionMenu
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
export const SelectionMenu = _props => null;
|
|
25
|
+
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// ContextMenu
|
|
28
|
+
// ============================================================================
|
|
29
|
+
|
|
30
|
+
export const ContextMenu = ({
|
|
31
|
+
children
|
|
32
|
+
}) => {
|
|
33
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// SegmentedControl
|
|
40
|
+
// ============================================================================
|
|
41
|
+
|
|
42
|
+
export const SegmentedControl = _props => null;
|
|
43
|
+
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// LiquidGlass
|
|
46
|
+
// ============================================================================
|
|
47
|
+
|
|
48
|
+
export const LiquidGlass = ({
|
|
49
|
+
children
|
|
50
|
+
}) => {
|
|
51
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export const isLiquidGlassSupported = false;
|
|
56
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Fragment","_Fragment","jsx","_jsx","DatePicker","_props","SelectionMenu","ContextMenu","children","SegmentedControl","LiquidGlass","isLiquidGlassSupported"],"sourceRoot":"../../src","sources":["index.web.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;;AAIzB;AACA;AACA;;AAMA;AACA;AACA;AAAA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAoBA,OAAO,MAAMC,UAAU,GACrBC,MAAuB,IACO,IAAI;;AAEpC;AACA;AACA;;AAoBA,OAAO,MAAMC,aAAa,GACxBD,MAA0B,IACI,IAAI;;AAEpC;AACA;AACA;;AAgCA,OAAO,MAAME,WAAW,GAAGA,CAAC;EAC1BC;AACgB,CAAC,KAAgC;EACjD,oBAAOL,IAAA,CAAAF,SAAA;IAAAO,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB,CAAC;;AAED;AACA;AACA;;AAkBA,OAAO,MAAMC,gBAAgB,GAC3BJ,MAA6B,IACC,IAAI;;AAEpC;AACA;AACA;;AASA,OAAO,MAAMK,WAAW,GAAGA,CAAC;EAC1BF;AACgB,CAAC,KAAgC;EACjD,oBAAOL,IAAA,CAAAF,SAAA;IAAAO,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB,CAAC;AAED,OAAO,MAAMG,sBAAsB,GAAG,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
4
|
+
export type Visible = 'open' | 'closed';
|
|
5
|
+
export type Presentation = 'modal' | 'embedded';
|
|
6
|
+
export type AndroidMaterialMode = 'system' | 'm3';
|
|
7
|
+
export type DatePickerProps = {
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
date: Date | null;
|
|
10
|
+
minDate?: Date | null;
|
|
11
|
+
maxDate?: Date | null;
|
|
12
|
+
locale?: string;
|
|
13
|
+
timeZoneName?: string;
|
|
14
|
+
mode?: 'date' | 'time' | 'dateAndTime' | 'countDownTimer';
|
|
15
|
+
presentation?: 'modal' | 'embedded';
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
onConfirm?: (dateTime: Date) => void;
|
|
18
|
+
onClosed?: () => void;
|
|
19
|
+
testID?: string;
|
|
20
|
+
ios?: Record<string, unknown>;
|
|
21
|
+
android?: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare const DatePicker: (_props: DatePickerProps) => React.ReactElement | null;
|
|
24
|
+
export type SelectionMenuOption = {
|
|
25
|
+
label: string;
|
|
26
|
+
data: string;
|
|
27
|
+
};
|
|
28
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
29
|
+
options: readonly SelectionMenuOption[];
|
|
30
|
+
selected: string | null;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
presentation?: Presentation;
|
|
34
|
+
visible?: boolean;
|
|
35
|
+
onSelect?: (data: string, label: string, index: number) => void;
|
|
36
|
+
onRequestClose?: () => void;
|
|
37
|
+
ios?: Record<string, unknown>;
|
|
38
|
+
android?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare const SelectionMenu: (_props: SelectionMenuProps) => React.ReactElement | null;
|
|
41
|
+
export interface ContextMenuActionAttributes {
|
|
42
|
+
destructive?: boolean;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
hidden?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ContextMenuAction {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
subtitle?: string;
|
|
50
|
+
image?: string;
|
|
51
|
+
imageColor?: string;
|
|
52
|
+
attributes?: ContextMenuActionAttributes;
|
|
53
|
+
state?: 'off' | 'on' | 'mixed';
|
|
54
|
+
subactions?: ContextMenuAction[];
|
|
55
|
+
}
|
|
56
|
+
export interface ContextMenuProps extends ViewProps {
|
|
57
|
+
title?: string;
|
|
58
|
+
actions: readonly ContextMenuAction[];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
trigger?: 'longPress' | 'tap';
|
|
61
|
+
onPressAction?: (actionId: string, actionTitle: string) => void;
|
|
62
|
+
onMenuOpen?: () => void;
|
|
63
|
+
onMenuClose?: () => void;
|
|
64
|
+
ios?: Record<string, unknown>;
|
|
65
|
+
android?: Record<string, unknown>;
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
}
|
|
68
|
+
export declare const ContextMenu: ({ children, }: ContextMenuProps) => React.ReactElement | null;
|
|
69
|
+
export interface SegmentedControlSegmentProps {
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
icon?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface SegmentedControlProps extends ViewProps {
|
|
76
|
+
segments: readonly SegmentedControlSegmentProps[];
|
|
77
|
+
selectedValue: string | null;
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
onSelect?: (value: string, index: number) => void;
|
|
80
|
+
ios?: Record<string, unknown>;
|
|
81
|
+
android?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
export declare const SegmentedControl: (_props: SegmentedControlProps) => React.ReactElement | null;
|
|
84
|
+
export interface LiquidGlassProps extends ViewProps {
|
|
85
|
+
cornerRadius?: number;
|
|
86
|
+
ios?: Record<string, unknown>;
|
|
87
|
+
android?: Record<string, unknown>;
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
export declare const LiquidGlass: ({ children, }: LiquidGlassProps) => React.ReactElement | null;
|
|
91
|
+
export declare const isLiquidGlassSupported = false;
|
|
92
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/index.web.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpE,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;AAChD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,IAAI,CAAC;AAMlD,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,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@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
4
|
+
export type Visible = 'open' | 'closed';
|
|
5
|
+
export type Presentation = 'modal' | 'embedded';
|
|
6
|
+
export type AndroidMaterialMode = 'system' | 'm3';
|
|
7
|
+
export type DatePickerProps = {
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
date: Date | null;
|
|
10
|
+
minDate?: Date | null;
|
|
11
|
+
maxDate?: Date | null;
|
|
12
|
+
locale?: string;
|
|
13
|
+
timeZoneName?: string;
|
|
14
|
+
mode?: 'date' | 'time' | 'dateAndTime' | 'countDownTimer';
|
|
15
|
+
presentation?: 'modal' | 'embedded';
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
onConfirm?: (dateTime: Date) => void;
|
|
18
|
+
onClosed?: () => void;
|
|
19
|
+
testID?: string;
|
|
20
|
+
ios?: Record<string, unknown>;
|
|
21
|
+
android?: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare const DatePicker: (_props: DatePickerProps) => React.ReactElement | null;
|
|
24
|
+
export type SelectionMenuOption = {
|
|
25
|
+
label: string;
|
|
26
|
+
data: string;
|
|
27
|
+
};
|
|
28
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
29
|
+
options: readonly SelectionMenuOption[];
|
|
30
|
+
selected: string | null;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
presentation?: Presentation;
|
|
34
|
+
visible?: boolean;
|
|
35
|
+
onSelect?: (data: string, label: string, index: number) => void;
|
|
36
|
+
onRequestClose?: () => void;
|
|
37
|
+
ios?: Record<string, unknown>;
|
|
38
|
+
android?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare const SelectionMenu: (_props: SelectionMenuProps) => React.ReactElement | null;
|
|
41
|
+
export interface ContextMenuActionAttributes {
|
|
42
|
+
destructive?: boolean;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
hidden?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ContextMenuAction {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
subtitle?: string;
|
|
50
|
+
image?: string;
|
|
51
|
+
imageColor?: string;
|
|
52
|
+
attributes?: ContextMenuActionAttributes;
|
|
53
|
+
state?: 'off' | 'on' | 'mixed';
|
|
54
|
+
subactions?: ContextMenuAction[];
|
|
55
|
+
}
|
|
56
|
+
export interface ContextMenuProps extends ViewProps {
|
|
57
|
+
title?: string;
|
|
58
|
+
actions: readonly ContextMenuAction[];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
trigger?: 'longPress' | 'tap';
|
|
61
|
+
onPressAction?: (actionId: string, actionTitle: string) => void;
|
|
62
|
+
onMenuOpen?: () => void;
|
|
63
|
+
onMenuClose?: () => void;
|
|
64
|
+
ios?: Record<string, unknown>;
|
|
65
|
+
android?: Record<string, unknown>;
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
}
|
|
68
|
+
export declare const ContextMenu: ({ children, }: ContextMenuProps) => React.ReactElement | null;
|
|
69
|
+
export interface SegmentedControlSegmentProps {
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
icon?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface SegmentedControlProps extends ViewProps {
|
|
76
|
+
segments: readonly SegmentedControlSegmentProps[];
|
|
77
|
+
selectedValue: string | null;
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
onSelect?: (value: string, index: number) => void;
|
|
80
|
+
ios?: Record<string, unknown>;
|
|
81
|
+
android?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
export declare const SegmentedControl: (_props: SegmentedControlProps) => React.ReactElement | null;
|
|
84
|
+
export interface LiquidGlassProps extends ViewProps {
|
|
85
|
+
cornerRadius?: number;
|
|
86
|
+
ios?: Record<string, unknown>;
|
|
87
|
+
android?: Record<string, unknown>;
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
export declare const LiquidGlass: ({ children, }: LiquidGlassProps) => React.ReactElement | null;
|
|
91
|
+
export declare const isLiquidGlassSupported = false;
|
|
92
|
+
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/index.web.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMpE,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;AAChD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,IAAI,CAAC;AAMlD,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,gBAAgB,CAAC;IAC1D,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MA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AAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,qBAAqB,KAC5B,KAAK,CAAC,YAAY,GAAG,IAAY,CAAC;AAMrC,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,GAAI,eAEzB,gBAAgB,KAAG,KAAK,CAAC,YAAY,GAAG,IAE1C,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-platform-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Native UI components for React Native: DatePicker, ContextMenu, SelectionMenu, SegmentedControl, LiquidGlass.",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
7
|
+
"browser": "./lib/module/index.web.js",
|
|
8
|
+
"react-native": "./lib/module/index.js",
|
|
7
9
|
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
8
10
|
"exports": {
|
|
9
11
|
".": {
|
|
10
12
|
"source": "./src/index.tsx",
|
|
13
|
+
"browser": {
|
|
14
|
+
"types": "./lib/typescript/module/src/index.web.d.ts",
|
|
15
|
+
"default": "./lib/module/index.web.js"
|
|
16
|
+
},
|
|
17
|
+
"react-native": {
|
|
18
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
19
|
+
"default": "./lib/module/index.js"
|
|
20
|
+
},
|
|
11
21
|
"import": {
|
|
12
22
|
"types": "./lib/typescript/module/src/index.d.ts",
|
|
13
23
|
"default": "./lib/module/index.js"
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// index.web.tsx
|
|
2
|
+
// Web stubs for react-native-platform-components
|
|
3
|
+
// These components are native-only and render nothing/children on web.
|
|
4
|
+
// This file is fully standalone to avoid importing native component specs.
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Shared Types (duplicated to avoid importing from files with native deps)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
export type Visible = 'open' | 'closed';
|
|
15
|
+
export type Presentation = 'modal' | 'embedded';
|
|
16
|
+
export type AndroidMaterialMode = 'system' | 'm3';
|
|
17
|
+
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// DatePicker
|
|
20
|
+
// ============================================================================
|
|
21
|
+
|
|
22
|
+
export type DatePickerProps = {
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
date: Date | null;
|
|
25
|
+
minDate?: Date | null;
|
|
26
|
+
maxDate?: Date | null;
|
|
27
|
+
locale?: string;
|
|
28
|
+
|
|
29
|
+
timeZoneName?: string;
|
|
30
|
+
mode?: 'date' | 'time' | 'dateAndTime' | 'countDownTimer';
|
|
31
|
+
presentation?: 'modal' | 'embedded';
|
|
32
|
+
visible?: boolean;
|
|
33
|
+
onConfirm?: (dateTime: Date) => void;
|
|
34
|
+
onClosed?: () => void;
|
|
35
|
+
testID?: string;
|
|
36
|
+
ios?: Record<string, unknown>;
|
|
37
|
+
android?: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const DatePicker = (
|
|
41
|
+
_props: DatePickerProps
|
|
42
|
+
): React.ReactElement | null => null;
|
|
43
|
+
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// SelectionMenu
|
|
46
|
+
// ============================================================================
|
|
47
|
+
|
|
48
|
+
export type SelectionMenuOption = {
|
|
49
|
+
label: string;
|
|
50
|
+
data: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
54
|
+
options: readonly SelectionMenuOption[];
|
|
55
|
+
selected: string | null;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
presentation?: Presentation;
|
|
59
|
+
visible?: boolean;
|
|
60
|
+
onSelect?: (data: string, label: string, index: number) => void;
|
|
61
|
+
onRequestClose?: () => void;
|
|
62
|
+
ios?: Record<string, unknown>;
|
|
63
|
+
android?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const SelectionMenu = (
|
|
67
|
+
_props: SelectionMenuProps
|
|
68
|
+
): React.ReactElement | null => null;
|
|
69
|
+
|
|
70
|
+
// ============================================================================
|
|
71
|
+
// ContextMenu
|
|
72
|
+
// ============================================================================
|
|
73
|
+
|
|
74
|
+
export interface ContextMenuActionAttributes {
|
|
75
|
+
destructive?: boolean;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
hidden?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ContextMenuAction {
|
|
81
|
+
id: string;
|
|
82
|
+
title: string;
|
|
83
|
+
subtitle?: string;
|
|
84
|
+
image?: string;
|
|
85
|
+
imageColor?: string;
|
|
86
|
+
attributes?: ContextMenuActionAttributes;
|
|
87
|
+
state?: 'off' | 'on' | 'mixed';
|
|
88
|
+
subactions?: ContextMenuAction[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ContextMenuProps extends ViewProps {
|
|
92
|
+
title?: string;
|
|
93
|
+
actions: readonly ContextMenuAction[];
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
trigger?: 'longPress' | 'tap';
|
|
96
|
+
onPressAction?: (actionId: string, actionTitle: string) => void;
|
|
97
|
+
onMenuOpen?: () => void;
|
|
98
|
+
onMenuClose?: () => void;
|
|
99
|
+
ios?: Record<string, unknown>;
|
|
100
|
+
android?: Record<string, unknown>;
|
|
101
|
+
children?: ReactNode;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const ContextMenu = ({
|
|
105
|
+
children,
|
|
106
|
+
}: ContextMenuProps): React.ReactElement | null => {
|
|
107
|
+
return <>{children}</>;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// ============================================================================
|
|
111
|
+
// SegmentedControl
|
|
112
|
+
// ============================================================================
|
|
113
|
+
|
|
114
|
+
export interface SegmentedControlSegmentProps {
|
|
115
|
+
label: string;
|
|
116
|
+
value: string;
|
|
117
|
+
disabled?: boolean;
|
|
118
|
+
icon?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface SegmentedControlProps extends ViewProps {
|
|
122
|
+
segments: readonly SegmentedControlSegmentProps[];
|
|
123
|
+
selectedValue: string | null;
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
onSelect?: (value: string, index: number) => void;
|
|
126
|
+
ios?: Record<string, unknown>;
|
|
127
|
+
android?: Record<string, unknown>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const SegmentedControl = (
|
|
131
|
+
_props: SegmentedControlProps
|
|
132
|
+
): React.ReactElement | null => null;
|
|
133
|
+
|
|
134
|
+
// ============================================================================
|
|
135
|
+
// LiquidGlass
|
|
136
|
+
// ============================================================================
|
|
137
|
+
|
|
138
|
+
export interface LiquidGlassProps extends ViewProps {
|
|
139
|
+
cornerRadius?: number;
|
|
140
|
+
ios?: Record<string, unknown>;
|
|
141
|
+
android?: Record<string, unknown>;
|
|
142
|
+
children?: ReactNode;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const LiquidGlass = ({
|
|
146
|
+
children,
|
|
147
|
+
}: LiquidGlassProps): React.ReactElement | null => {
|
|
148
|
+
return <>{children}</>;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const isLiquidGlassSupported = false;
|