react-native-platform-components 1.2.0 → 1.4.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 +33 -31
- package/android/src/main/java/com/platformcomponents/PCButtonGroupView.kt +498 -0
- package/android/src/main/java/com/platformcomponents/PCButtonGroupViewManager.kt +191 -0
- package/android/src/main/java/com/platformcomponents/PCButtonSupport.kt +127 -0
- package/android/src/main/java/com/platformcomponents/PCButtonView.kt +345 -0
- package/android/src/main/java/com/platformcomponents/PCButtonViewManager.kt +126 -0
- package/android/src/main/java/com/platformcomponents/PCExpressive.kt +107 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarView.kt +115 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarViewManager.kt +65 -0
- package/android/src/main/java/com/platformcomponents/PCNativeThemeModule.kt +3 -0
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +13 -5
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +6 -1
- package/android/src/main/java/com/platformcomponents/PCTextFieldView.kt +1018 -0
- package/android/src/main/java/com/platformcomponents/PCTextFieldViewManager.kt +248 -0
- package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +13 -6
- package/android/src/main/jni/CMakeLists.txt +13 -1
- package/android/src/main/res/values/attrs.xml +13 -0
- package/android/src/main/res/values/styles.xml +183 -0
- package/ios/PCButton.h +10 -0
- package/ios/PCButton.mm +196 -0
- package/ios/PCButtonGroup.h +10 -0
- package/ios/PCButtonGroup.mm +256 -0
- package/ios/PCButtonGroupView.swift +254 -0
- package/ios/PCButtonSupport.swift +141 -0
- package/ios/PCButtonView.swift +155 -0
- package/ios/PCFloatingToolbar.h +10 -0
- package/ios/PCFloatingToolbar.mm +76 -0
- package/ios/PCFloatingToolbarView.swift +95 -0
- package/ios/PCNativeThemeModule.mm +13 -0
- package/ios/PCSelectionMenu.swift +9 -1
- package/ios/PCTextField.h +10 -0
- package/ios/PCTextField.mm +391 -0
- package/ios/PCTextFieldView.swift +1012 -0
- package/lib/commonjs/Button.js +77 -0
- package/lib/commonjs/Button.js.map +1 -0
- package/lib/commonjs/ButtonGroup.js +99 -0
- package/lib/commonjs/ButtonGroup.js.map +1 -0
- package/lib/commonjs/ButtonGroupNativeComponent.ts +121 -0
- package/lib/commonjs/ButtonNativeComponent.ts +76 -0
- package/lib/commonjs/ContextMenuNativeComponent.ts +5 -4
- package/lib/commonjs/DatePickerNativeComponent.ts +17 -11
- package/lib/commonjs/FloatingToolbar.js +69 -0
- package/lib/commonjs/FloatingToolbar.js.map +1 -0
- package/lib/commonjs/FloatingToolbarNativeComponent.ts +31 -0
- package/lib/commonjs/LiquidGlass.js +24 -4
- package/lib/commonjs/LiquidGlass.js.map +1 -1
- package/lib/commonjs/LiquidGlassNativeComponent.ts +6 -5
- package/lib/commonjs/NativePlatformComponentsTheme.js.map +1 -1
- package/lib/commonjs/SegmentedControl.js +11 -85
- package/lib/commonjs/SegmentedControl.js.map +1 -1
- package/lib/commonjs/SegmentedControlNativeComponent.ts +15 -11
- package/lib/commonjs/SelectionMenuNativeComponent.ts +6 -5
- package/lib/commonjs/TextField.js +195 -0
- package/lib/commonjs/TextField.js.map +1 -0
- package/lib/commonjs/TextFieldNativeComponent.ts +218 -0
- package/lib/commonjs/codegenTypes.js +6 -0
- package/lib/commonjs/codegenTypes.js.map +1 -0
- package/lib/commonjs/focusRegistry.js +78 -0
- package/lib/commonjs/focusRegistry.js.map +1 -0
- package/lib/commonjs/icons.js +92 -0
- package/lib/commonjs/icons.js.map +1 -0
- package/lib/commonjs/index.js +66 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +32 -2
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/labelStyle.js +27 -0
- package/lib/commonjs/labelStyle.js.map +1 -0
- package/lib/commonjs/reactNativeInternals.d.js +2 -0
- package/lib/commonjs/reactNativeInternals.d.js.map +1 -0
- package/lib/module/Button.js +70 -0
- package/lib/module/Button.js.map +1 -0
- package/lib/module/ButtonGroup.js +92 -0
- package/lib/module/ButtonGroup.js.map +1 -0
- package/lib/module/ButtonGroupNativeComponent.ts +121 -0
- package/lib/module/ButtonNativeComponent.ts +76 -0
- package/lib/module/ContextMenuNativeComponent.ts +5 -4
- package/lib/module/DatePickerNativeComponent.ts +17 -11
- package/lib/module/FloatingToolbar.js +62 -0
- package/lib/module/FloatingToolbar.js.map +1 -0
- package/lib/module/FloatingToolbarNativeComponent.ts +31 -0
- package/lib/module/LiquidGlass.js +24 -4
- package/lib/module/LiquidGlass.js.map +1 -1
- package/lib/module/LiquidGlassNativeComponent.ts +6 -5
- package/lib/module/NativePlatformComponentsTheme.js.map +1 -1
- package/lib/module/SegmentedControl.js +12 -87
- package/lib/module/SegmentedControl.js.map +1 -1
- package/lib/module/SegmentedControlNativeComponent.ts +15 -11
- package/lib/module/SelectionMenuNativeComponent.ts +6 -5
- package/lib/module/TextField.js +189 -0
- package/lib/module/TextField.js.map +1 -0
- package/lib/module/TextFieldNativeComponent.ts +218 -0
- package/lib/module/codegenTypes.js +4 -0
- package/lib/module/codegenTypes.js.map +1 -0
- package/lib/module/focusRegistry.js +74 -0
- package/lib/module/focusRegistry.js.map +1 -0
- package/lib/module/icons.js +87 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +28 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/labelStyle.js +23 -0
- package/lib/module/labelStyle.js.map +1 -0
- package/lib/module/reactNativeInternals.d.js +2 -0
- package/lib/module/reactNativeInternals.d.js.map +1 -0
- package/lib/typescript/commonjs/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/Button.d.ts +76 -0
- package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts +102 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts +93 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts +57 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts +5 -4
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts +12 -11
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts +45 -0
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts +24 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts +4 -3
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +6 -5
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts +10 -2
- package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts +17 -46
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +9 -6
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts +6 -5
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/TextField.d.ts +174 -0
- package/lib/typescript/commonjs/src/TextField.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts +162 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/codegenTypes.d.ts +12 -0
- package/lib/typescript/commonjs/src/codegenTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/icons.d.ts +52 -0
- package/lib/typescript/commonjs/src/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.web.d.ts +121 -0
- package/lib/typescript/commonjs/src/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/labelStyle.d.ts +20 -0
- package/lib/typescript/commonjs/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sharedTypes.d.ts +8 -3
- package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -1
- package/lib/typescript/module/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/module/src/Button.d.ts +76 -0
- package/lib/typescript/module/src/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts +102 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts +93 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts +57 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +5 -4
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +12 -11
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/FloatingToolbar.d.ts +45 -0
- package/lib/typescript/module/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts +24 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlass.d.ts +4 -3
- package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +6 -5
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts +10 -2
- package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts.map +1 -1
- package/lib/typescript/module/src/SegmentedControl.d.ts +17 -46
- package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +9 -6
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +6 -5
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/TextField.d.ts +174 -0
- package/lib/typescript/module/src/TextField.d.ts.map +1 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts +162 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/codegenTypes.d.ts +12 -0
- package/lib/typescript/module/src/codegenTypes.d.ts.map +1 -0
- package/lib/typescript/module/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/module/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/icons.d.ts +52 -0
- package/lib/typescript/module/src/icons.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +6 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.web.d.ts +121 -0
- package/lib/typescript/module/src/index.web.d.ts.map +1 -1
- package/lib/typescript/module/src/labelStyle.d.ts +20 -0
- package/lib/typescript/module/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/module/src/sharedTypes.d.ts +8 -3
- package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -1
- package/package.json +28 -6
- package/react-native.config.js +3 -0
- package/shared/PCButtonComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupShadowNode-custom.cpp +48 -0
- package/shared/PCButtonGroupShadowNode-custom.h +55 -0
- package/shared/PCButtonGroupState-custom.h +61 -0
- package/shared/PCButtonShadowNode-custom.cpp +48 -0
- package/shared/PCButtonShadowNode-custom.h +55 -0
- package/shared/PCButtonState-custom.h +61 -0
- package/shared/PCDatePickerState-custom.h +2 -2
- package/shared/PCSegmentedControlState-custom.h +2 -2
- package/shared/PCSelectionMenuState-custom.h +2 -2
- package/shared/PCTextFieldComponentDescriptors-custom.h +22 -0
- package/shared/PCTextFieldShadowNode-custom.cpp +47 -0
- package/shared/PCTextFieldShadowNode-custom.h +55 -0
- package/shared/PCTextFieldState-custom.h +61 -0
- package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +3 -0
- package/src/Button.tsx +144 -0
- package/src/ButtonGroup.tsx +233 -0
- package/src/ButtonGroupNativeComponent.ts +121 -0
- package/src/ButtonNativeComponent.ts +76 -0
- package/src/ContextMenuNativeComponent.ts +5 -4
- package/src/DatePickerNativeComponent.ts +17 -11
- package/src/FloatingToolbar.tsx +113 -0
- package/src/FloatingToolbarNativeComponent.ts +31 -0
- package/src/LiquidGlass.tsx +24 -5
- package/src/LiquidGlassNativeComponent.ts +6 -5
- package/src/NativePlatformComponentsTheme.ts +11 -2
- package/src/SegmentedControl.tsx +26 -118
- package/src/SegmentedControlNativeComponent.ts +15 -11
- package/src/SelectionMenuNativeComponent.ts +6 -5
- package/src/TextField.tsx +494 -0
- package/src/TextFieldNativeComponent.ts +218 -0
- package/src/codegenTypes.ts +40 -0
- package/src/focusRegistry.ts +89 -0
- package/src/icons.ts +116 -0
- package/src/index.tsx +6 -0
- package/src/index.web.tsx +194 -0
- package/src/labelStyle.ts +36 -0
- package/src/reactNativeInternals.d.ts +22 -0
- package/src/sharedTypes.ts +9 -3
- /package/{app.plugin.cjs → app.plugin.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TextStyle } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Font for a control's labels. Each field falls back to the platform default.
|
|
4
|
+
*/
|
|
5
|
+
export interface LabelStyle {
|
|
6
|
+
fontFamily?: string;
|
|
7
|
+
fontSize?: number;
|
|
8
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
9
|
+
fontStyle?: 'normal' | 'italic';
|
|
10
|
+
}
|
|
11
|
+
/** The flat font fields the native specs expect; empty / 0 = default. */
|
|
12
|
+
export type NativeLabelStyle = {
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
fontSize: number;
|
|
15
|
+
fontWeight: string;
|
|
16
|
+
fontStyle: string;
|
|
17
|
+
};
|
|
18
|
+
/** Normalizes a label font for native; `undefined` keeps the platform font. */
|
|
19
|
+
export declare function normalizeLabelStyle(labelStyle: LabelStyle | undefined): NativeLabelStyle | undefined;
|
|
20
|
+
//# sourceMappingURL=labelStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labelStyle.d.ts","sourceRoot":"","sources":["../../../../src/labelStyle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACjC;AAED,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,gBAAgB,GAAG,SAAS,CAS9B"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BubblingEventHandler } from './codegenTypes.js';
|
|
2
2
|
/** Shared "open/closed" control state. */
|
|
3
3
|
export type Visible = 'open' | 'closed';
|
|
4
4
|
/** Shared presentation mode for pickers/menus. */
|
|
5
5
|
export type Presentation = 'modal' | 'embedded';
|
|
6
|
-
/** Shared Material preference (Android). */
|
|
6
|
+
/** Shared Material preference (Android): the platform widget or the Material one. */
|
|
7
7
|
export type AndroidMaterialMode = 'system' | 'm3';
|
|
8
|
+
/**
|
|
9
|
+
* Shared Material style for the Material-only components (Android):
|
|
10
|
+
* Material 3, or Material 3 Expressive (the default).
|
|
11
|
+
*/
|
|
12
|
+
export type AndroidMaterialStyle = 'm3' | 'expressive';
|
|
8
13
|
/** Common event empty payload type. */
|
|
9
14
|
export type EmptyEvent = Readonly<{}>;
|
|
10
15
|
/** Convenience alias (optional). */
|
|
11
|
-
export type Bubbling<T> =
|
|
16
|
+
export type Bubbling<T> = BubblingEventHandler<T>;
|
|
12
17
|
//# sourceMappingURL=sharedTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTypes.d.ts","sourceRoot":"","sources":["../../../../src/sharedTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"sharedTypes.d.ts","sourceRoot":"","sources":["../../../../src/sharedTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAgB,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExC,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;AAEhD,qFAAqF;AACrF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,YAAY,CAAC;AAEvD,uCAAuC;AACvC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEtC,oCAAoC;AACpC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-platform-components",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Native UI components for React Native
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Native UI components for React Native, the real platform widgets on both iOS and Android: TextField, DatePicker, ContextMenu, SelectionMenu, SegmentedControl, Button, ButtonGroup, FloatingToolbar and LiquidGlass. UIKit and SwiftUI on iOS, Material 3 Expressive on Android. Fabric, TypeScript, Expo config plugin.",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
7
7
|
"browser": "./lib/module/index.web.js",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"./package.json": "./package.json",
|
|
31
|
-
"./app.plugin": "./app.plugin.
|
|
31
|
+
"./app.plugin": "./app.plugin.js",
|
|
32
|
+
"./app.plugin.js": "./app.plugin.js"
|
|
32
33
|
},
|
|
33
34
|
"files": [
|
|
34
35
|
"src",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"plugin",
|
|
41
42
|
"*.podspec",
|
|
42
43
|
"react-native.config.js",
|
|
43
|
-
"app.plugin.
|
|
44
|
+
"app.plugin.js",
|
|
44
45
|
"expo-module.config.json",
|
|
45
46
|
"!ios/build",
|
|
46
47
|
"!android/build",
|
|
@@ -68,7 +69,8 @@
|
|
|
68
69
|
"test": "jest",
|
|
69
70
|
"upgrade:check": "yarn dlx npm-check-updates",
|
|
70
71
|
"upgrade:apply": "yarn dlx npm-check-updates -u && rm -rf node_modules && rm -rf package-lock.json && yarn install",
|
|
71
|
-
"generate:gifs": "./scripts/generate-readme-gifs.sh"
|
|
72
|
+
"generate:gifs": "./scripts/generate-readme-gifs.sh",
|
|
73
|
+
"generate:visuals": "node scripts/visuals/stills.mjs && node scripts/visuals/showreel.mjs"
|
|
72
74
|
},
|
|
73
75
|
"keywords": [
|
|
74
76
|
"react-native",
|
|
@@ -80,6 +82,12 @@
|
|
|
80
82
|
"new-architecture",
|
|
81
83
|
"native-ui",
|
|
82
84
|
"ui-components",
|
|
85
|
+
"textfield",
|
|
86
|
+
"text-field",
|
|
87
|
+
"textinput",
|
|
88
|
+
"text-input",
|
|
89
|
+
"textinputlayout",
|
|
90
|
+
"uitextfield",
|
|
83
91
|
"datepicker",
|
|
84
92
|
"date-picker",
|
|
85
93
|
"time-picker",
|
|
@@ -100,6 +108,16 @@
|
|
|
100
108
|
"segmentedbuttons",
|
|
101
109
|
"uisegmentedcontrol",
|
|
102
110
|
"tabs",
|
|
111
|
+
"button",
|
|
112
|
+
"buttons",
|
|
113
|
+
"button-group",
|
|
114
|
+
"toggle-buttons",
|
|
115
|
+
"floating-toolbar",
|
|
116
|
+
"toolbar",
|
|
117
|
+
"uibutton",
|
|
118
|
+
"material3-expressive",
|
|
119
|
+
"material-3-expressive",
|
|
120
|
+
"expressive",
|
|
103
121
|
"liquid-glass",
|
|
104
122
|
"liquidglass",
|
|
105
123
|
"glass-effect",
|
|
@@ -202,7 +220,11 @@
|
|
|
202
220
|
"PCDatePicker": "PCDatePicker",
|
|
203
221
|
"PCContextMenu": "PCContextMenu",
|
|
204
222
|
"PCSegmentedControl": "PCSegmentedControl",
|
|
205
|
-
"
|
|
223
|
+
"PCButton": "PCButton",
|
|
224
|
+
"PCButtonGroup": "PCButtonGroup",
|
|
225
|
+
"PCFloatingToolbar": "PCFloatingToolbar",
|
|
226
|
+
"PCLiquidGlass": "PCLiquidGlass",
|
|
227
|
+
"PCTextField": "PCTextField"
|
|
206
228
|
}
|
|
207
229
|
}
|
|
208
230
|
},
|
package/react-native.config.js
CHANGED
|
@@ -6,6 +6,9 @@ module.exports = {
|
|
|
6
6
|
'MeasuringPCSelectionMenuComponentDescriptor',
|
|
7
7
|
'MeasuringPCDatePickerComponentDescriptor',
|
|
8
8
|
'MeasuringPCSegmentedControlComponentDescriptor',
|
|
9
|
+
'MeasuringPCButtonComponentDescriptor',
|
|
10
|
+
'MeasuringPCButtonGroupComponentDescriptor',
|
|
11
|
+
'MeasuringPCTextFieldComponentDescriptor',
|
|
9
12
|
],
|
|
10
13
|
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
|
|
11
14
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
4
|
+
|
|
5
|
+
// Forward declaration to avoid circular includes
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
class MeasuringPCButtonShadowNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Include the actual shadow node definition
|
|
11
|
+
#include "PCButtonShadowNode-custom.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Custom component descriptor that uses our measuring shadow node
|
|
17
|
+
* instead of the generated one.
|
|
18
|
+
*/
|
|
19
|
+
using MeasuringPCButtonComponentDescriptor =
|
|
20
|
+
ConcreteComponentDescriptor<MeasuringPCButtonShadowNode>;
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
4
|
+
|
|
5
|
+
// Forward declaration to avoid circular includes
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
class MeasuringPCButtonGroupShadowNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Include the actual shadow node definition
|
|
11
|
+
#include "PCButtonGroupShadowNode-custom.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Custom component descriptor that uses our measuring shadow node
|
|
17
|
+
* instead of the generated one.
|
|
18
|
+
*/
|
|
19
|
+
using MeasuringPCButtonGroupComponentDescriptor =
|
|
20
|
+
ConcreteComponentDescriptor<MeasuringPCButtonGroupShadowNode>;
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#include "PCButtonGroupShadowNode-custom.h"
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
|
|
8
|
+
Size MeasuringPCButtonGroupShadowNode::measureContent(
|
|
9
|
+
const LayoutContext& /*layoutContext*/,
|
|
10
|
+
const LayoutConstraints& layoutConstraints) const {
|
|
11
|
+
|
|
12
|
+
// Native measures the actual group and reports its intrinsic size
|
|
13
|
+
const auto& stateData = this->getStateData();
|
|
14
|
+
Float measuredW = stateData.frameSize.width;
|
|
15
|
+
Float measuredH = stateData.frameSize.height;
|
|
16
|
+
|
|
17
|
+
const Float fallbackHeight =
|
|
18
|
+
#ifdef __ANDROID__
|
|
19
|
+
static_cast<Float>(kFallbackHeightAndroid);
|
|
20
|
+
#else
|
|
21
|
+
static_cast<Float>(kFallbackHeightIOS);
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
const bool usingFallback = (measuredH <= 0);
|
|
25
|
+
if (usingFallback) {
|
|
26
|
+
measuredH = fallbackHeight;
|
|
27
|
+
}
|
|
28
|
+
if (measuredW <= 0) {
|
|
29
|
+
measuredW = static_cast<Float>(kFallbackWidth);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const Float kHuge = static_cast<Float>(1.0e9);
|
|
33
|
+
|
|
34
|
+
measuredW = std::max<Float>(measuredW, layoutConstraints.minimumSize.width);
|
|
35
|
+
if (layoutConstraints.maximumSize.width > 0 && layoutConstraints.maximumSize.width < kHuge) {
|
|
36
|
+
measuredW = std::min<Float>(measuredW, layoutConstraints.maximumSize.width);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
measuredH = std::max<Float>(measuredH, layoutConstraints.minimumSize.height);
|
|
40
|
+
// Only clamp to max height if we have real measured data (not fallback)
|
|
41
|
+
if (!usingFallback && layoutConstraints.maximumSize.height > 0 && layoutConstraints.maximumSize.height < kHuge) {
|
|
42
|
+
measuredH = std::min<Float>(measuredH, layoutConstraints.maximumSize.height);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return Size{measuredW, measuredH};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
4
|
+
|
|
5
|
+
// Only include what we need for the shadow node definition
|
|
6
|
+
// Do NOT include ComponentDescriptors.h here to avoid circular dependency
|
|
7
|
+
#include <react/renderer/components/PlatformComponentsViewSpec/EventEmitters.h>
|
|
8
|
+
#include <react/renderer/components/PlatformComponentsViewSpec/Props.h>
|
|
9
|
+
|
|
10
|
+
#include "PCButtonGroupState-custom.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
extern const char PCButtonGroupComponentName[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Custom ShadowNode for ButtonGroup that supports Yoga measurement.
|
|
18
|
+
*
|
|
19
|
+
* - Native measures the actual group and updates state with frameSize
|
|
20
|
+
* - measureContent() returns the size from state for proper Yoga layout
|
|
21
|
+
* - Falls back to platform-specific defaults if state hasn't been set yet
|
|
22
|
+
*/
|
|
23
|
+
class MeasuringPCButtonGroupShadowNode final : public ConcreteViewShadowNode<
|
|
24
|
+
PCButtonGroupComponentName,
|
|
25
|
+
PCButtonGroupProps,
|
|
26
|
+
PCButtonGroupEventEmitter,
|
|
27
|
+
PCButtonGroupStateFrameSize> {
|
|
28
|
+
public:
|
|
29
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
30
|
+
|
|
31
|
+
// Fallback sizes used when native hasn't reported measurements yet
|
|
32
|
+
// iOS: a row of small UIButtons
|
|
33
|
+
static constexpr float kFallbackHeightIOS = 34.0f;
|
|
34
|
+
|
|
35
|
+
// Android: small Material 3 buttons (40dp) plus their 4dp touch insets
|
|
36
|
+
static constexpr float kFallbackHeightAndroid = 48.0f;
|
|
37
|
+
|
|
38
|
+
static constexpr float kFallbackWidth = 160.0f;
|
|
39
|
+
|
|
40
|
+
static ShadowNodeTraits BaseTraits() {
|
|
41
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
42
|
+
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
|
|
43
|
+
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
|
|
44
|
+
return traits;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Called by Yoga when it needs the intrinsic size of the component.
|
|
49
|
+
*/
|
|
50
|
+
Size measureContent(
|
|
51
|
+
const LayoutContext& layoutContext,
|
|
52
|
+
const LayoutConstraints& layoutConstraints) const override;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/LayoutPrimitives.h>
|
|
4
|
+
#include <memory>
|
|
5
|
+
|
|
6
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
7
|
+
#include <folly/dynamic.h>
|
|
8
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Custom state for ButtonGroup that holds the measured frame size from native.
|
|
16
|
+
* The native side measures the actual group and communicates the size to
|
|
17
|
+
* the shadow node for proper Yoga layout.
|
|
18
|
+
*/
|
|
19
|
+
struct PCButtonGroupStateFrameSize {
|
|
20
|
+
using Shared = std::shared_ptr<const PCButtonGroupStateFrameSize>;
|
|
21
|
+
|
|
22
|
+
Size frameSize{}; // {width, height} in points
|
|
23
|
+
|
|
24
|
+
PCButtonGroupStateFrameSize() = default;
|
|
25
|
+
|
|
26
|
+
explicit PCButtonGroupStateFrameSize(Size size) : frameSize(size) {}
|
|
27
|
+
|
|
28
|
+
bool operator==(const PCButtonGroupStateFrameSize& other) const {
|
|
29
|
+
return frameSize.width == other.frameSize.width &&
|
|
30
|
+
frameSize.height == other.frameSize.height;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
bool operator!=(const PCButtonGroupStateFrameSize& other) const {
|
|
34
|
+
return !(*this == other);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
38
|
+
// Required for Android state serialization
|
|
39
|
+
PCButtonGroupStateFrameSize(
|
|
40
|
+
const PCButtonGroupStateFrameSize& previousState,
|
|
41
|
+
folly::dynamic data)
|
|
42
|
+
: frameSize(previousState.frameSize) {
|
|
43
|
+
if (data.isObject()) {
|
|
44
|
+
if (data.count("width") && data.count("height")) {
|
|
45
|
+
frameSize.width = static_cast<Float>(data["width"].asDouble());
|
|
46
|
+
frameSize.height = static_cast<Float>(data["height"].asDouble());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
folly::dynamic getDynamic() const {
|
|
52
|
+
return folly::dynamic::object("width", frameSize.width)("height", frameSize.height);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
MapBuffer getMapBuffer() const {
|
|
56
|
+
return MapBufferBuilder::EMPTY();
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#include "PCButtonShadowNode-custom.h"
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
|
|
8
|
+
Size MeasuringPCButtonShadowNode::measureContent(
|
|
9
|
+
const LayoutContext& /*layoutContext*/,
|
|
10
|
+
const LayoutConstraints& layoutConstraints) const {
|
|
11
|
+
|
|
12
|
+
// Native measures the actual button and reports its intrinsic size
|
|
13
|
+
const auto& stateData = this->getStateData();
|
|
14
|
+
Float measuredW = stateData.frameSize.width;
|
|
15
|
+
Float measuredH = stateData.frameSize.height;
|
|
16
|
+
|
|
17
|
+
const Float fallbackHeight =
|
|
18
|
+
#ifdef __ANDROID__
|
|
19
|
+
static_cast<Float>(kFallbackHeightAndroid);
|
|
20
|
+
#else
|
|
21
|
+
static_cast<Float>(kFallbackHeightIOS);
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
const bool usingFallback = (measuredH <= 0);
|
|
25
|
+
if (usingFallback) {
|
|
26
|
+
measuredH = fallbackHeight;
|
|
27
|
+
}
|
|
28
|
+
if (measuredW <= 0) {
|
|
29
|
+
measuredW = static_cast<Float>(kFallbackWidth);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const Float kHuge = static_cast<Float>(1.0e9);
|
|
33
|
+
|
|
34
|
+
measuredW = std::max<Float>(measuredW, layoutConstraints.minimumSize.width);
|
|
35
|
+
if (layoutConstraints.maximumSize.width > 0 && layoutConstraints.maximumSize.width < kHuge) {
|
|
36
|
+
measuredW = std::min<Float>(measuredW, layoutConstraints.maximumSize.width);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
measuredH = std::max<Float>(measuredH, layoutConstraints.minimumSize.height);
|
|
40
|
+
// Only clamp to max height if we have real measured data (not fallback)
|
|
41
|
+
if (!usingFallback && layoutConstraints.maximumSize.height > 0 && layoutConstraints.maximumSize.height < kHuge) {
|
|
42
|
+
measuredH = std::min<Float>(measuredH, layoutConstraints.maximumSize.height);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return Size{measuredW, measuredH};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
4
|
+
|
|
5
|
+
// Only include what we need for the shadow node definition
|
|
6
|
+
// Do NOT include ComponentDescriptors.h here to avoid circular dependency
|
|
7
|
+
#include <react/renderer/components/PlatformComponentsViewSpec/EventEmitters.h>
|
|
8
|
+
#include <react/renderer/components/PlatformComponentsViewSpec/Props.h>
|
|
9
|
+
|
|
10
|
+
#include "PCButtonState-custom.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
extern const char PCButtonComponentName[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Custom ShadowNode for Button that supports Yoga measurement.
|
|
18
|
+
*
|
|
19
|
+
* - Native measures the actual button and updates state with frameSize
|
|
20
|
+
* - measureContent() returns the size from state for proper Yoga layout
|
|
21
|
+
* - Falls back to platform-specific defaults if state hasn't been set yet
|
|
22
|
+
*/
|
|
23
|
+
class MeasuringPCButtonShadowNode final : public ConcreteViewShadowNode<
|
|
24
|
+
PCButtonComponentName,
|
|
25
|
+
PCButtonProps,
|
|
26
|
+
PCButtonEventEmitter,
|
|
27
|
+
PCButtonStateFrameSize> {
|
|
28
|
+
public:
|
|
29
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
30
|
+
|
|
31
|
+
// Fallback sizes used when native hasn't reported measurements yet
|
|
32
|
+
// iOS UIButton.Configuration small size
|
|
33
|
+
static constexpr float kFallbackHeightIOS = 34.0f;
|
|
34
|
+
|
|
35
|
+
// Android Material 3 small button (40dp) plus its 4dp touch insets
|
|
36
|
+
static constexpr float kFallbackHeightAndroid = 48.0f;
|
|
37
|
+
|
|
38
|
+
static constexpr float kFallbackWidth = 64.0f;
|
|
39
|
+
|
|
40
|
+
static ShadowNodeTraits BaseTraits() {
|
|
41
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
42
|
+
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
|
|
43
|
+
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
|
|
44
|
+
return traits;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Called by Yoga when it needs the intrinsic size of the component.
|
|
49
|
+
*/
|
|
50
|
+
Size measureContent(
|
|
51
|
+
const LayoutContext& layoutContext,
|
|
52
|
+
const LayoutConstraints& layoutConstraints) const override;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/LayoutPrimitives.h>
|
|
4
|
+
#include <memory>
|
|
5
|
+
|
|
6
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
7
|
+
#include <folly/dynamic.h>
|
|
8
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Custom state for Button that holds the measured frame size from native.
|
|
16
|
+
* The native side measures the actual button and communicates the size to
|
|
17
|
+
* the shadow node for proper Yoga layout.
|
|
18
|
+
*/
|
|
19
|
+
struct PCButtonStateFrameSize {
|
|
20
|
+
using Shared = std::shared_ptr<const PCButtonStateFrameSize>;
|
|
21
|
+
|
|
22
|
+
Size frameSize{}; // {width, height} in points
|
|
23
|
+
|
|
24
|
+
PCButtonStateFrameSize() = default;
|
|
25
|
+
|
|
26
|
+
explicit PCButtonStateFrameSize(Size size) : frameSize(size) {}
|
|
27
|
+
|
|
28
|
+
bool operator==(const PCButtonStateFrameSize& other) const {
|
|
29
|
+
return frameSize.width == other.frameSize.width &&
|
|
30
|
+
frameSize.height == other.frameSize.height;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
bool operator!=(const PCButtonStateFrameSize& other) const {
|
|
34
|
+
return !(*this == other);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
38
|
+
// Required for Android state serialization
|
|
39
|
+
PCButtonStateFrameSize(
|
|
40
|
+
const PCButtonStateFrameSize& previousState,
|
|
41
|
+
folly::dynamic data)
|
|
42
|
+
: frameSize(previousState.frameSize) {
|
|
43
|
+
if (data.isObject()) {
|
|
44
|
+
if (data.count("width") && data.count("height")) {
|
|
45
|
+
frameSize.width = static_cast<Float>(data["width"].asDouble());
|
|
46
|
+
frameSize.height = static_cast<Float>(data["height"].asDouble());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
folly::dynamic getDynamic() const {
|
|
52
|
+
return folly::dynamic::object("width", frameSize.width)("height", frameSize.height);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
MapBuffer getMapBuffer() const {
|
|
56
|
+
return MapBufferBuilder::EMPTY();
|
|
57
|
+
}
|
|
58
|
+
#endif
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace facebook::react
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include <react/renderer/core/LayoutPrimitives.h>
|
|
4
4
|
#include <memory>
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
7
7
|
#include <folly/dynamic.h>
|
|
8
8
|
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
9
|
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
@@ -37,7 +37,7 @@ struct PCDatePickerStateFrameSize {
|
|
|
37
37
|
return !(*this == other);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
41
41
|
// Required for Android state serialization
|
|
42
42
|
PCDatePickerStateFrameSize(
|
|
43
43
|
const PCDatePickerStateFrameSize& previousState,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include <react/renderer/core/LayoutPrimitives.h>
|
|
4
4
|
#include <memory>
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
7
7
|
#include <folly/dynamic.h>
|
|
8
8
|
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
9
|
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
@@ -34,7 +34,7 @@ struct PCSegmentedControlStateFrameSize {
|
|
|
34
34
|
return !(*this == other);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
38
38
|
// Required for Android state serialization
|
|
39
39
|
PCSegmentedControlStateFrameSize(
|
|
40
40
|
const PCSegmentedControlStateFrameSize& previousState,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include <react/renderer/core/LayoutPrimitives.h>
|
|
4
4
|
#include <memory>
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
7
7
|
#include <folly/dynamic.h>
|
|
8
8
|
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
9
|
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
@@ -37,7 +37,7 @@ struct PCSelectionMenuStateFrameSize {
|
|
|
37
37
|
return !(*this == other);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
#if defined(RN_SERIALIZABLE_STATE) || defined(ANDROID)
|
|
41
41
|
// Required for Android state serialization
|
|
42
42
|
PCSelectionMenuStateFrameSize(
|
|
43
43
|
const PCSelectionMenuStateFrameSize& previousState,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
4
|
+
|
|
5
|
+
// Forward declaration to avoid circular includes
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
class MeasuringPCTextFieldShadowNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Include the actual shadow node definition
|
|
11
|
+
#include "PCTextFieldShadowNode-custom.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Custom component descriptor that uses our measuring shadow node
|
|
17
|
+
* instead of the generated one.
|
|
18
|
+
*/
|
|
19
|
+
using MeasuringPCTextFieldComponentDescriptor =
|
|
20
|
+
ConcreteComponentDescriptor<MeasuringPCTextFieldShadowNode>;
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#include "PCTextFieldShadowNode-custom.h"
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
|
|
6
|
+
namespace facebook::react {
|
|
7
|
+
|
|
8
|
+
Size MeasuringPCTextFieldShadowNode::measureContent(
|
|
9
|
+
const LayoutContext& /*layoutContext*/,
|
|
10
|
+
const LayoutConstraints& layoutConstraints) const {
|
|
11
|
+
|
|
12
|
+
const auto& stateData = this->getStateData();
|
|
13
|
+
Float measuredW = stateData.frameSize.width;
|
|
14
|
+
Float measuredH = stateData.frameSize.height;
|
|
15
|
+
|
|
16
|
+
const Float kHuge = static_cast<Float>(1.0e9);
|
|
17
|
+
|
|
18
|
+
// A text field fills the width it is offered; only an unbounded row (no
|
|
19
|
+
// width at all) gets a fixed fallback.
|
|
20
|
+
if (measuredW <= 0) {
|
|
21
|
+
const Float maxW = layoutConstraints.maximumSize.width;
|
|
22
|
+
measuredW = (maxW > 0 && maxW < kHuge) ? maxW : static_cast<Float>(kFallbackWidth);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const bool usingFallback = (measuredH <= 0);
|
|
26
|
+
if (usingFallback) {
|
|
27
|
+
#ifdef __ANDROID__
|
|
28
|
+
measuredH = static_cast<Float>(kFallbackHeightAndroid);
|
|
29
|
+
#else
|
|
30
|
+
measuredH = static_cast<Float>(kFallbackHeightIOS);
|
|
31
|
+
#endif
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
measuredW = std::max<Float>(measuredW, layoutConstraints.minimumSize.width);
|
|
35
|
+
measuredW = std::min<Float>(measuredW, layoutConstraints.maximumSize.width);
|
|
36
|
+
|
|
37
|
+
measuredH = std::max<Float>(measuredH, layoutConstraints.minimumSize.height);
|
|
38
|
+
// Only clamp to max height if we have real measured data (not fallback)
|
|
39
|
+
if (!usingFallback && layoutConstraints.maximumSize.height > 0 &&
|
|
40
|
+
layoutConstraints.maximumSize.height < kHuge) {
|
|
41
|
+
measuredH = std::min<Float>(measuredH, layoutConstraints.maximumSize.height);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return Size{measuredW, measuredH};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
} // namespace facebook::react
|