react-native-platform-components 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +23 -12
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/platformcomponents/PCDatePickerView.kt +46 -2
  4. package/android/src/main/java/com/platformcomponents/PCNativeTheme.kt +174 -0
  5. package/android/src/main/java/com/platformcomponents/PCNativeThemeModule.kt +45 -0
  6. package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +36 -3
  7. package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +14 -0
  8. package/android/src/main/java/com/platformcomponents/PCThemeSupport.kt +40 -5
  9. package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +25 -5
  10. package/android/src/main/jni/CMakeLists.txt +13 -1
  11. package/android/src/main/res/values/styles.xml +131 -0
  12. package/ios/PCNativeTheme.swift +56 -0
  13. package/ios/PCNativeThemeModule.mm +49 -0
  14. package/ios/PCSelectionMenu.swift +9 -1
  15. package/lib/commonjs/ContextMenuNativeComponent.ts +5 -4
  16. package/lib/commonjs/DatePickerNativeComponent.ts +17 -11
  17. package/lib/commonjs/LiquidGlass.js +24 -4
  18. package/lib/commonjs/LiquidGlass.js.map +1 -1
  19. package/lib/commonjs/LiquidGlassNativeComponent.ts +6 -5
  20. package/lib/commonjs/NativePlatformComponentsTheme.js +10 -0
  21. package/lib/commonjs/NativePlatformComponentsTheme.js.map +1 -0
  22. package/lib/commonjs/NativeTheme.js +51 -0
  23. package/lib/commonjs/NativeTheme.js.map +1 -0
  24. package/lib/commonjs/SegmentedControlNativeComponent.ts +12 -11
  25. package/lib/commonjs/SelectionMenuNativeComponent.ts +6 -5
  26. package/lib/commonjs/codegenTypes.js +6 -0
  27. package/lib/commonjs/codegenTypes.js.map +1 -0
  28. package/lib/commonjs/index.js +11 -0
  29. package/lib/commonjs/index.js.map +1 -1
  30. package/lib/commonjs/index.web.js +10 -1
  31. package/lib/commonjs/index.web.js.map +1 -1
  32. package/lib/module/ContextMenuNativeComponent.ts +5 -4
  33. package/lib/module/DatePickerNativeComponent.ts +17 -11
  34. package/lib/module/LiquidGlass.js +24 -4
  35. package/lib/module/LiquidGlass.js.map +1 -1
  36. package/lib/module/LiquidGlassNativeComponent.ts +6 -5
  37. package/lib/module/NativePlatformComponentsTheme.js +7 -0
  38. package/lib/module/NativePlatformComponentsTheme.js.map +1 -0
  39. package/lib/module/NativeTheme.js +45 -0
  40. package/lib/module/NativeTheme.js.map +1 -0
  41. package/lib/module/SegmentedControlNativeComponent.ts +12 -11
  42. package/lib/module/SelectionMenuNativeComponent.ts +6 -5
  43. package/lib/module/codegenTypes.js +4 -0
  44. package/lib/module/codegenTypes.js.map +1 -0
  45. package/lib/module/index.js +1 -0
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/index.web.js +7 -0
  48. package/lib/module/index.web.js.map +1 -1
  49. package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts +5 -4
  50. package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts +12 -11
  52. package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/LiquidGlass.d.ts +4 -3
  54. package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +6 -5
  56. package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts +19 -0
  58. package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/src/NativeTheme.d.ts +30 -0
  60. package/lib/typescript/commonjs/src/NativeTheme.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +7 -6
  62. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts +6 -5
  64. package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/codegenTypes.d.ts +12 -0
  66. package/lib/typescript/commonjs/src/codegenTypes.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  68. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/src/index.web.d.ts +8 -1
  70. package/lib/typescript/commonjs/src/index.web.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/src/sharedTypes.d.ts +2 -2
  72. package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -1
  73. package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +5 -4
  74. package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -1
  75. package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +12 -11
  76. package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -1
  77. package/lib/typescript/module/src/LiquidGlass.d.ts +4 -3
  78. package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -1
  79. package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +6 -5
  80. package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -1
  81. package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts +19 -0
  82. package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts.map +1 -0
  83. package/lib/typescript/module/src/NativeTheme.d.ts +30 -0
  84. package/lib/typescript/module/src/NativeTheme.d.ts.map +1 -0
  85. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +7 -6
  86. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -1
  87. package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +6 -5
  88. package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -1
  89. package/lib/typescript/module/src/codegenTypes.d.ts +12 -0
  90. package/lib/typescript/module/src/codegenTypes.d.ts.map +1 -0
  91. package/lib/typescript/module/src/index.d.ts +1 -0
  92. package/lib/typescript/module/src/index.d.ts.map +1 -1
  93. package/lib/typescript/module/src/index.web.d.ts +8 -1
  94. package/lib/typescript/module/src/index.web.d.ts.map +1 -1
  95. package/lib/typescript/module/src/sharedTypes.d.ts +2 -2
  96. package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -1
  97. package/package.json +8 -4
  98. package/shared/PCDatePickerState-custom.h +2 -2
  99. package/shared/PCSegmentedControlState-custom.h +2 -2
  100. package/shared/PCSelectionMenuState-custom.h +2 -2
  101. package/src/ContextMenuNativeComponent.ts +5 -4
  102. package/src/DatePickerNativeComponent.ts +17 -11
  103. package/src/LiquidGlass.tsx +24 -5
  104. package/src/LiquidGlassNativeComponent.ts +6 -5
  105. package/src/NativePlatformComponentsTheme.ts +22 -0
  106. package/src/NativeTheme.ts +53 -0
  107. package/src/SegmentedControlNativeComponent.ts +12 -11
  108. package/src/SelectionMenuNativeComponent.ts +6 -5
  109. package/src/codegenTypes.ts +40 -0
  110. package/src/index.tsx +1 -0
  111. package/src/index.web.tsx +17 -1
  112. package/src/sharedTypes.ts +2 -2
  113. /package/{app.plugin.cjs → app.plugin.js} +0 -0
@@ -37,4 +37,135 @@
37
37
  <item name="imageButtonStyle">@style/Widget.Material3.MaterialTimePicker.ImageButton</item>
38
38
  <item name="materialTimePickerTitleStyle">@style/TextAppearance.Material3.MaterialTimePicker.Title</item>
39
39
  </style>
40
+
41
+ <!--
42
+ Native theme (useNativeTheme / setNativeTheme, see PCNativeTheme). DynamicColors
43
+ overrides Material's "personalized" color resources with the scheme generated from
44
+ the brand color and applies ThemeOverlay.Material3.PersonalizedColors to the
45
+ activity. This overlay points the accent attributes that platform and AppCompat
46
+ widgets (DatePicker, TimePicker, Spinner) read at the primary color (the
47
+ personalized control color is a light tone that white labels don't contrast
48
+ with), and is re-applied over the Material 3 fallback contexts, which would
49
+ otherwise reset the colors.
50
+ -->
51
+ <style name="PCNativeThemeOverlay" parent="ThemeOverlay.Material3.PersonalizedColors">
52
+ <item name="colorAccent">?attr/colorPrimary</item>
53
+ <item name="android:colorAccent">?attr/colorPrimary</item>
54
+ <item name="android:colorControlActivated">?attr/colorPrimary</item>
55
+ </style>
56
+
57
+ <!--
58
+ The fallback dialog themes are full themes, so they would also reset the colors;
59
+ these variants carry the PCNativeThemeOverlay items (a style has one parent, so
60
+ they are repeated here).
61
+ -->
62
+ <style name="PCMaterial3CalendarDialogTheme.NativeTheme">
63
+ <item name="colorPrimary">@color/material_personalized_color_primary</item>
64
+ <item name="colorOnPrimary">@color/material_personalized_color_on_primary</item>
65
+ <item name="colorPrimaryInverse">@color/material_personalized_color_primary_inverse</item>
66
+ <item name="colorPrimaryContainer">@color/material_personalized_color_primary_container</item>
67
+ <item name="colorOnPrimaryContainer">@color/material_personalized_color_on_primary_container</item>
68
+ <item name="colorSecondary">@color/material_personalized_color_secondary</item>
69
+ <item name="colorOnSecondary">@color/material_personalized_color_on_secondary</item>
70
+ <item name="colorSecondaryContainer">@color/material_personalized_color_secondary_container</item>
71
+ <item name="colorOnSecondaryContainer">@color/material_personalized_color_on_secondary_container</item>
72
+ <item name="colorTertiary">@color/material_personalized_color_tertiary</item>
73
+ <item name="colorOnTertiary">@color/material_personalized_color_on_tertiary</item>
74
+ <item name="colorTertiaryContainer">@color/material_personalized_color_tertiary_container</item>
75
+ <item name="colorOnTertiaryContainer">@color/material_personalized_color_on_tertiary_container</item>
76
+ <item name="android:colorBackground">@color/material_personalized_color_background</item>
77
+ <item name="colorOnBackground">@color/material_personalized_color_on_background</item>
78
+ <item name="colorSurface">@color/material_personalized_color_surface</item>
79
+ <item name="colorOnSurface">@color/material_personalized_color_on_surface</item>
80
+ <item name="colorSurfaceVariant">@color/material_personalized_color_surface_variant</item>
81
+ <item name="colorOnSurfaceVariant">@color/material_personalized_color_on_surface_variant</item>
82
+ <item name="colorSurfaceInverse">@color/material_personalized_color_surface_inverse</item>
83
+ <item name="colorOnSurfaceInverse">@color/material_personalized_color_on_surface_inverse</item>
84
+ <item name="colorSurfaceBright">@color/material_personalized_color_surface_bright</item>
85
+ <item name="colorSurfaceDim">@color/material_personalized_color_surface_dim</item>
86
+ <item name="colorSurfaceContainer">@color/material_personalized_color_surface_container</item>
87
+ <item name="colorSurfaceContainerLow">@color/material_personalized_color_surface_container_low</item>
88
+ <item name="colorSurfaceContainerHigh">@color/material_personalized_color_surface_container_high</item>
89
+ <item name="colorSurfaceContainerLowest">@color/material_personalized_color_surface_container_lowest</item>
90
+ <item name="colorSurfaceContainerHighest">@color/material_personalized_color_surface_container_highest</item>
91
+ <item name="colorOutline">@color/material_personalized_color_outline</item>
92
+ <item name="colorOutlineVariant">@color/material_personalized_color_outline_variant</item>
93
+ <item name="colorError">@color/material_personalized_color_error</item>
94
+ <item name="colorOnError">@color/material_personalized_color_on_error</item>
95
+ <item name="colorErrorContainer">@color/material_personalized_color_error_container</item>
96
+ <item name="colorOnErrorContainer">@color/material_personalized_color_on_error_container</item>
97
+ <item name="android:textColorPrimary">@color/material_personalized_color_primary_text</item>
98
+ <item name="android:textColorPrimaryInverse">@color/material_personalized_color_primary_text_inverse</item>
99
+ <item name="android:textColorSecondary">@color/material_personalized_color_secondary_text</item>
100
+ <item name="android:textColorSecondaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
101
+ <item name="android:textColorTertiary">@color/material_personalized_color_secondary_text</item>
102
+ <item name="android:textColorTertiaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
103
+ <item name="android:textColorPrimaryDisableOnly">@color/material_personalized_primary_text_disable_only</item>
104
+ <item name="android:textColorPrimaryInverseDisableOnly">@color/material_personalized_primary_inverse_text_disable_only</item>
105
+ <item name="android:textColorHint">@color/material_personalized_hint_foreground</item>
106
+ <item name="android:textColorHintInverse">@color/material_personalized_hint_foreground_inverse</item>
107
+ <item name="android:textColorHighlight">@color/material_personalized__highlighted_text</item>
108
+ <item name="android:textColorHighlightInverse">@color/material_personalized__highlighted_text_inverse</item>
109
+ <item name="android:textColorAlertDialogListItem">@color/material_personalized_color_primary_text</item>
110
+ <item name="android:colorControlNormal">@color/material_personalized_color_control_normal</item>
111
+ <item name="android:colorControlHighlight">@color/material_personalized_color_control_highlight</item>
112
+ <item name="colorAccent">?attr/colorPrimary</item>
113
+ <item name="android:colorAccent">?attr/colorPrimary</item>
114
+ <item name="android:colorControlActivated">?attr/colorPrimary</item>
115
+ </style>
116
+
117
+ <style name="PCMaterial3TimePickerDialogTheme.NativeTheme">
118
+ <item name="colorPrimary">@color/material_personalized_color_primary</item>
119
+ <item name="colorOnPrimary">@color/material_personalized_color_on_primary</item>
120
+ <item name="colorPrimaryInverse">@color/material_personalized_color_primary_inverse</item>
121
+ <item name="colorPrimaryContainer">@color/material_personalized_color_primary_container</item>
122
+ <item name="colorOnPrimaryContainer">@color/material_personalized_color_on_primary_container</item>
123
+ <item name="colorSecondary">@color/material_personalized_color_secondary</item>
124
+ <item name="colorOnSecondary">@color/material_personalized_color_on_secondary</item>
125
+ <item name="colorSecondaryContainer">@color/material_personalized_color_secondary_container</item>
126
+ <item name="colorOnSecondaryContainer">@color/material_personalized_color_on_secondary_container</item>
127
+ <item name="colorTertiary">@color/material_personalized_color_tertiary</item>
128
+ <item name="colorOnTertiary">@color/material_personalized_color_on_tertiary</item>
129
+ <item name="colorTertiaryContainer">@color/material_personalized_color_tertiary_container</item>
130
+ <item name="colorOnTertiaryContainer">@color/material_personalized_color_on_tertiary_container</item>
131
+ <item name="android:colorBackground">@color/material_personalized_color_background</item>
132
+ <item name="colorOnBackground">@color/material_personalized_color_on_background</item>
133
+ <item name="colorSurface">@color/material_personalized_color_surface</item>
134
+ <item name="colorOnSurface">@color/material_personalized_color_on_surface</item>
135
+ <item name="colorSurfaceVariant">@color/material_personalized_color_surface_variant</item>
136
+ <item name="colorOnSurfaceVariant">@color/material_personalized_color_on_surface_variant</item>
137
+ <item name="colorSurfaceInverse">@color/material_personalized_color_surface_inverse</item>
138
+ <item name="colorOnSurfaceInverse">@color/material_personalized_color_on_surface_inverse</item>
139
+ <item name="colorSurfaceBright">@color/material_personalized_color_surface_bright</item>
140
+ <item name="colorSurfaceDim">@color/material_personalized_color_surface_dim</item>
141
+ <item name="colorSurfaceContainer">@color/material_personalized_color_surface_container</item>
142
+ <item name="colorSurfaceContainerLow">@color/material_personalized_color_surface_container_low</item>
143
+ <item name="colorSurfaceContainerHigh">@color/material_personalized_color_surface_container_high</item>
144
+ <item name="colorSurfaceContainerLowest">@color/material_personalized_color_surface_container_lowest</item>
145
+ <item name="colorSurfaceContainerHighest">@color/material_personalized_color_surface_container_highest</item>
146
+ <item name="colorOutline">@color/material_personalized_color_outline</item>
147
+ <item name="colorOutlineVariant">@color/material_personalized_color_outline_variant</item>
148
+ <item name="colorError">@color/material_personalized_color_error</item>
149
+ <item name="colorOnError">@color/material_personalized_color_on_error</item>
150
+ <item name="colorErrorContainer">@color/material_personalized_color_error_container</item>
151
+ <item name="colorOnErrorContainer">@color/material_personalized_color_on_error_container</item>
152
+ <item name="android:textColorPrimary">@color/material_personalized_color_primary_text</item>
153
+ <item name="android:textColorPrimaryInverse">@color/material_personalized_color_primary_text_inverse</item>
154
+ <item name="android:textColorSecondary">@color/material_personalized_color_secondary_text</item>
155
+ <item name="android:textColorSecondaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
156
+ <item name="android:textColorTertiary">@color/material_personalized_color_secondary_text</item>
157
+ <item name="android:textColorTertiaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
158
+ <item name="android:textColorPrimaryDisableOnly">@color/material_personalized_primary_text_disable_only</item>
159
+ <item name="android:textColorPrimaryInverseDisableOnly">@color/material_personalized_primary_inverse_text_disable_only</item>
160
+ <item name="android:textColorHint">@color/material_personalized_hint_foreground</item>
161
+ <item name="android:textColorHintInverse">@color/material_personalized_hint_foreground_inverse</item>
162
+ <item name="android:textColorHighlight">@color/material_personalized__highlighted_text</item>
163
+ <item name="android:textColorHighlightInverse">@color/material_personalized__highlighted_text_inverse</item>
164
+ <item name="android:textColorAlertDialogListItem">@color/material_personalized_color_primary_text</item>
165
+ <item name="android:colorControlNormal">@color/material_personalized_color_control_normal</item>
166
+ <item name="android:colorControlHighlight">@color/material_personalized_color_control_highlight</item>
167
+ <item name="colorAccent">?attr/colorPrimary</item>
168
+ <item name="android:colorAccent">?attr/colorPrimary</item>
169
+ <item name="android:colorControlActivated">?attr/colorPrimary</item>
170
+ </style>
40
171
  </resources>
@@ -0,0 +1,56 @@
1
+ import UIKit
2
+
3
+ /// The native theme set from JS with `useNativeTheme` / `setNativeTheme`.
4
+ ///
5
+ /// The brand color becomes the tint color of every window, which UIKit views inherit:
6
+ /// these components, alerts, text input cursors. Windows that appear later (an alert's
7
+ /// window, for example) are tinted when they become visible. Clearing the color resets
8
+ /// the tinted windows to UIKit's default tint (the app's accent color, if it has one).
9
+ ///
10
+ /// Light and dark mode need nothing here: UIKit views follow the window's appearance,
11
+ /// including `Appearance.setColorScheme`.
12
+ @objc(PCNativeTheme)
13
+ public final class PCNativeTheme: NSObject {
14
+ @objc public static let shared = PCNativeTheme()
15
+
16
+ private var primaryColor: UIColor?
17
+ private var windowObserver: NSObjectProtocol?
18
+ private let tintedWindows = NSHashTable<UIWindow>.weakObjects()
19
+
20
+ /// Main thread only.
21
+ @objc public func setPrimaryColor(_ color: UIColor?) {
22
+ primaryColor = color
23
+
24
+ guard let color else {
25
+ for window in tintedWindows.allObjects {
26
+ window.tintColor = nil
27
+ }
28
+ tintedWindows.removeAllObjects()
29
+ return
30
+ }
31
+
32
+ if windowObserver == nil {
33
+ windowObserver = NotificationCenter.default.addObserver(
34
+ forName: UIWindow.didBecomeVisibleNotification,
35
+ object: nil,
36
+ queue: .main
37
+ ) { [weak self] notification in
38
+ guard let self, let window = notification.object as? UIWindow,
39
+ let color = self.primaryColor else { return }
40
+ self.tint(window, with: color)
41
+ }
42
+ }
43
+
44
+ let windows = UIApplication.shared.connectedScenes
45
+ .compactMap { $0 as? UIWindowScene }
46
+ .flatMap { $0.windows }
47
+ for window in windows {
48
+ tint(window, with: color)
49
+ }
50
+ }
51
+
52
+ private func tint(_ window: UIWindow, with color: UIColor) {
53
+ window.tintColor = color
54
+ tintedWindows.add(window)
55
+ }
56
+ }
@@ -0,0 +1,49 @@
1
+ // ios/PCNativeThemeModule.mm
2
+
3
+ #import <PlatformComponentsViewSpec/PlatformComponentsViewSpec.h>
4
+ #import <React/RCTConvert.h>
5
+
6
+ #if __has_include(<PlatformComponents/PlatformComponents-Swift.h>)
7
+ #import <PlatformComponents/PlatformComponents-Swift.h>
8
+ #else
9
+ #import "PlatformComponents-Swift.h"
10
+ #endif
11
+
12
+ /// `setNativeTheme` / `useNativeTheme` on iOS. See PCNativeTheme.swift.
13
+ @interface PCNativeThemeModule : NSObject <NativePlatformComponentsThemeSpec>
14
+ @end
15
+
16
+ @implementation PCNativeThemeModule
17
+
18
+ RCT_EXPORT_MODULE(PlatformComponentsTheme)
19
+
20
+ - (void)setTheme:(NSDictionary *)theme
21
+ {
22
+ id primary = theme[@"primary"];
23
+ dispatch_async(dispatch_get_main_queue(), ^{
24
+ // Resolves PlatformColor and DynamicColorIOS values as well as plain colors.
25
+ UIColor *color = primary == nil || primary == [NSNull null] ? nil : [RCTConvert UIColor:primary];
26
+ [PCNativeTheme.shared setPrimaryColor:color];
27
+ });
28
+ }
29
+
30
+ /// Reports what this *build* can do, not just what the device runs: with an
31
+ /// older Xcode the glass code is compiled out (see PCLiquidGlass.swift), so
32
+ /// the iOS version alone would be a false positive.
33
+ - (NSNumber *)isLiquidGlassSupported
34
+ {
35
+ #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 260000
36
+ if (@available(iOS 26.0, *)) {
37
+ return @(PCLiquidGlassView.isSupported);
38
+ }
39
+ #endif
40
+ return @NO;
41
+ }
42
+
43
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
44
+ (const facebook::react::ObjCTurboModule::InitParams &)params
45
+ {
46
+ return std::make_shared<facebook::react::NativePlatformComponentsThemeSpecJSI>(params);
47
+ }
48
+
49
+ @end
@@ -473,8 +473,12 @@ private class PCMenuViewController: UIViewController, UITableViewDelegate, UITab
473
473
  menuContainer.clipsToBounds = true
474
474
  view.addSubview(menuContainer)
475
475
 
476
- // Use liquid glass on iOS 26+, fall back to system material blur on older versions
476
+ // Use liquid glass on iOS 26+, fall back to system material blur on older
477
+ // versions. UIGlassEffect only exists in the iOS 26 SDK, so the branch is
478
+ // compiled out entirely on older toolchains — same guard as
479
+ // PCLiquidGlass.swift, which keeps the library buildable without Xcode 26.
477
480
  let effectView: UIVisualEffectView
481
+ #if compiler(>=6.2)
478
482
  if #available(iOS 26, *) {
479
483
  let glassEffect = UIGlassEffect()
480
484
  glassEffect.isInteractive = true
@@ -483,6 +487,10 @@ private class PCMenuViewController: UIViewController, UITableViewDelegate, UITab
483
487
  let blurEffect = UIBlurEffect(style: .systemMaterial)
484
488
  effectView = UIVisualEffectView(effect: blurEffect)
485
489
  }
490
+ #else
491
+ let blurEffect = UIBlurEffect(style: .systemMaterial)
492
+ effectView = UIVisualEffectView(effect: blurEffect)
493
+ #endif
486
494
  effectView.frame = menuContainer.bounds
487
495
  effectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
488
496
  menuContainer.addSubview(effectView)
@@ -1,6 +1,7 @@
1
1
  // ContextMenuNativeComponent.ts
2
- import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ import type { HostComponent, ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
+ import type { BubblingEventHandler } from './codegenTypes';
4
5
 
5
6
  /**
6
7
  * Attributes for a context menu action.
@@ -120,17 +121,17 @@ export interface ContextMenuProps extends ViewProps {
120
121
  /**
121
122
  * Fired when user presses an action.
122
123
  */
123
- onPressAction?: CodegenTypes.BubblingEventHandler<ContextMenuPressActionEvent>;
124
+ onPressAction?: BubblingEventHandler<ContextMenuPressActionEvent>;
124
125
 
125
126
  /**
126
127
  * Fired when menu opens.
127
128
  */
128
- onMenuOpen?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
129
+ onMenuOpen?: BubblingEventHandler<Readonly<{}>>;
129
130
 
130
131
  /**
131
132
  * Fired when menu closes.
132
133
  */
133
- onMenuClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
134
+ onMenuClose?: BubblingEventHandler<Readonly<{}>>;
134
135
 
135
136
  ios?: IOSProps;
136
137
  android?: AndroidProps;
@@ -1,11 +1,17 @@
1
1
  // DatePickerNativeComponent.ts
2
- import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ import type { HostComponent, ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
+ import type {
5
+ BubblingEventHandler,
6
+ Double,
7
+ Int32,
8
+ WithDefault,
9
+ } from './codegenTypes';
4
10
 
5
- export type TimestampMs = CodegenTypes.Double;
11
+ export type TimestampMs = Double;
6
12
 
7
13
  export type DateChangeEvent = {
8
- timestampMs: CodegenTypes.Double;
14
+ timestampMs: Double;
9
15
  confirmed: boolean;
10
16
  };
11
17
 
@@ -18,14 +24,14 @@ export type IOSConfirmToolbar = 'show' | 'hide';
18
24
 
19
25
  export type IOSProps = {
20
26
  preferredStyle?: string; // IOSDatePickerStyle
21
- countDownDurationSeconds?: CodegenTypes.Double;
22
- minuteInterval?: CodegenTypes.Int32;
27
+ countDownDurationSeconds?: Double;
28
+ minuteInterval?: Int32;
23
29
  roundsToMinuteInterval?: string; // IOSRoundsToMinuteInterval
24
30
  confirmToolbar?: string; // IOSConfirmToolbar
25
31
  };
26
32
 
27
33
  export type AndroidProps = {
28
- firstDayOfWeek?: CodegenTypes.Int32;
34
+ firstDayOfWeek?: Int32;
29
35
  material?: string; // AndroidMaterialMode
30
36
  dialogTitle?: string;
31
37
  positiveButtonTitle?: string;
@@ -44,9 +50,9 @@ export type MacOSProps = Readonly<{}>;
44
50
  export type CommonProps = {
45
51
  mode?: string; // DatePickerMode
46
52
 
47
- dateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
48
- minDateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
49
- maxDateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
53
+ dateMs?: WithDefault<TimestampMs, -9007199254740991>;
54
+ minDateMs?: WithDefault<TimestampMs, -9007199254740991>;
55
+ maxDateMs?: WithDefault<TimestampMs, -9007199254740991>;
50
56
 
51
57
  locale?: string;
52
58
  timeZoneName?: string;
@@ -65,8 +71,8 @@ export interface NativeProps extends ViewProps, CommonProps {
65
71
  ios?: IOSProps;
66
72
  android?: AndroidProps;
67
73
 
68
- onConfirm?: CodegenTypes.BubblingEventHandler<DateChangeEvent>;
69
- onClosed?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
74
+ onConfirm?: BubblingEventHandler<DateChangeEvent>;
75
+ onClosed?: BubblingEventHandler<Readonly<{}>>;
70
76
  }
71
77
 
72
78
  export default codegenNativeComponent<NativeProps>(
@@ -8,18 +8,38 @@ exports.isLiquidGlassSupported = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _reactNative = require("react-native");
10
10
  var _LiquidGlassNativeComponent = _interopRequireDefault(require("./LiquidGlassNativeComponent"));
11
+ var _NativePlatformComponentsTheme = _interopRequireDefault(require("./NativePlatformComponentsTheme"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
15
  // LiquidGlass.tsx
15
16
 
17
+ function resolveLiquidGlassSupport() {
18
+ if (_reactNative.Platform.OS !== 'ios') {
19
+ return false;
20
+ }
21
+ try {
22
+ // The native module answers for this build: Liquid Glass is compiled out
23
+ // when the library is built with an Xcode that predates the iOS 26 SDK,
24
+ // and then no device version makes it available.
25
+ const supported = _NativePlatformComponentsTheme.default?.isLiquidGlassSupported();
26
+ if (typeof supported === 'boolean') {
27
+ return supported;
28
+ }
29
+ } catch {
30
+ // Native module not available (web, tests): fall back to the OS version.
31
+ }
32
+ return parseInt(String(_reactNative.Platform.Version), 10) >= 26;
33
+ }
34
+
16
35
  /**
17
- * Whether the LiquidGlass effect is supported on the current device.
18
- * Returns true on iOS 26+ (with Liquid Glass support), false otherwise.
36
+ * Whether the LiquidGlass effect is supported here: iOS 26 or newer, in a
37
+ * build compiled against the iOS 26 SDK. False on Android, on older iOS, and
38
+ * in builds made with an older Xcode, where the views fall back to a blur.
19
39
  *
20
- * Use this to conditionally render fallback UI on unsupported devices.
40
+ * Use this to conditionally render fallback UI.
21
41
  */
22
- const isLiquidGlassSupported = exports.isLiquidGlassSupported = _reactNative.Platform.OS === 'ios' && parseInt(String(_reactNative.Platform.Version), 10) >= 26;
42
+ const isLiquidGlassSupported = exports.isLiquidGlassSupported = resolveLiquidGlassSupport();
23
43
  function LiquidGlass(props) {
24
44
  const {
25
45
  style,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_LiquidGlassNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isLiquidGlassSupported","exports","Platform","OS","parseInt","String","Version","LiquidGlass","props","style","cornerRadius","ios","android","children","onPress","viewProps","nativeIos","useMemo","undefined","effect","interactive","tintColor","colorScheme","nativeAndroid","fallbackBackgroundColor","handlePress","useCallback","event","x","nativeEvent","y","jsx","onGlassPress"],"sourceRoot":"../../src","sources":["LiquidGlass.tsx"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAIsC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,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,C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IAAK;IACpDb,OAAO,GAAG;MAAEc,CAAC,EAAED,KAAK,CAACE,WAAW,CAACD,CAAC;MAAEE,CAAC,EAAEH,KAAK,CAACE,WAAW,CAACC;IAAE,CAAC,CAAC;EAC/D,CAAC,EACD,CAAChB,OAAO,CACV,CAAC;EAED,oBACE,IAAAlC,WAAA,CAAAmD,GAAA,EAACrD,2BAAA,CAAAK,OAAiB;IAChB0B,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,GAAG,EAAEK,SAAU;IACfJ,OAAO,EAAEW,aAAc;IACvBS,YAAY,EAAElB,OAAO,GAAGW,WAAW,GAAGP,SAAU;IAAA,GAC5CH,SAAS;IAAAF,QAAA,EAEZA;EAAQ,CACQ,CAAC;AAExB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_LiquidGlassNativeComponent","_interopRequireDefault","_NativePlatformComponentsTheme","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","resolveLiquidGlassSupport","Platform","OS","supported","NativePlatformComponentsTheme","isLiquidGlassSupported","parseInt","String","Version","exports","LiquidGlass","props","style","cornerRadius","ios","android","children","onPress","viewProps","nativeIos","useMemo","undefined","effect","interactive","tintColor","colorScheme","nativeAndroid","fallbackBackgroundColor","handlePress","useCallback","event","x","nativeEvent","y","jsx","onGlassPress"],"sourceRoot":"../../src","sources":["LiquidGlass.tsx"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,8BAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA4E,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,C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E,WAAW,CAACC;IAAE,CAAC,CAAC;EAC/D,CAAC,EACD,CAAChB,OAAO,CACV,CAAC;EAED,oBACE,IAAArC,WAAA,CAAAsD,GAAA,EAACzD,2BAAA,CAAAM,OAAiB;IAChB6B,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,GAAG,EAAEK,SAAU;IACfJ,OAAO,EAAEW,aAAc;IACvBS,YAAY,EAAElB,OAAO,GAAGW,WAAW,GAAGP,SAAU;IAAA,GAC5CH,SAAS;IAAAF,QAAA,EAEZA;EAAQ,CACQ,CAAC;AAExB","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  // LiquidGlassNativeComponent.ts
2
- import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ import type { HostComponent, ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
+ import type { DirectEventHandler, Float, WithDefault } from './codegenTypes';
4
5
 
5
6
  /**
6
7
  * Glass effect intensity/style.
@@ -64,9 +65,9 @@ export type LiquidGlassAndroidProps = Readonly<{
64
65
  */
65
66
  export type LiquidGlassPressEvent = Readonly<{
66
67
  /** X coordinate of touch relative to view bounds */
67
- x: CodegenTypes.Float;
68
+ x: Float;
68
69
  /** Y coordinate of touch relative to view bounds */
69
- y: CodegenTypes.Float;
70
+ y: Float;
70
71
  }>;
71
72
 
72
73
  export interface LiquidGlassNativeProps extends ViewProps {
@@ -75,7 +76,7 @@ export interface LiquidGlassNativeProps extends ViewProps {
75
76
  * Applied uniformly to all corners.
76
77
  * @default 0
77
78
  */
78
- cornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
79
+ cornerRadius?: WithDefault<Float, 0>;
79
80
 
80
81
  /**
81
82
  * iOS-specific props.
@@ -91,7 +92,7 @@ export interface LiquidGlassNativeProps extends ViewProps {
91
92
  * Fired when the glass view is pressed.
92
93
  * Includes touch coordinates relative to view bounds.
93
94
  */
94
- onGlassPress?: CodegenTypes.DirectEventHandler<LiquidGlassPressEvent>;
95
+ onGlassPress?: DirectEventHandler<LiquidGlassPressEvent>;
95
96
  }
96
97
 
97
98
  export default codegenNativeComponent<LiquidGlassNativeProps>(
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ // NativePlatformComponentsTheme.ts
9
+ var _default = exports.default = _reactNative.TurboModuleRegistry.get('PlatformComponentsTheme');
10
+ //# sourceMappingURL=NativePlatformComponentsTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativePlatformComponentsTheme.ts"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAqBeC,gCAAmB,CAACC,GAAG,CAAO,yBAAyB,CAAC","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setNativeTheme = setNativeTheme;
7
+ exports.useNativeTheme = useNativeTheme;
8
+ var _react = require("react");
9
+ var _reactNative = require("react-native");
10
+ var _NativePlatformComponentsTheme = _interopRequireDefault(require("./NativePlatformComponentsTheme"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ // NativeTheme.ts
13
+
14
+ /**
15
+ * The part of an app theme that is applied to the native platform theme. A
16
+ * React Navigation theme has this shape, so it can be passed as is.
17
+ */
18
+
19
+ function applyProcessedPrimary(primary) {
20
+ _NativePlatformComponentsTheme.default?.setTheme(primary == null ? {} : {
21
+ primary
22
+ });
23
+ }
24
+
25
+ /**
26
+ * Applies the theme's brand color to the native platform theme, app-wide:
27
+ * these components and other native views that use the theme colors (the
28
+ * window tint color on iOS, the Material theme on Android). Pass `null` to
29
+ * restore the app's own theme colors.
30
+ *
31
+ * Light and dark mode follow the native appearance; use
32
+ * `Appearance.setColorScheme` to change it from JavaScript.
33
+ */
34
+ function setNativeTheme(theme) {
35
+ applyProcessedPrimary(theme ? (0, _reactNative.processColor)(theme.colors.primary) : null);
36
+ }
37
+
38
+ /**
39
+ * Keeps the native platform theme's brand color in sync with `theme`. Call it
40
+ * once, near the root of the app. See {@link setNativeTheme}.
41
+ */
42
+ function useNativeTheme(theme) {
43
+ // Processed colors are numbers or plain objects (PlatformColor,
44
+ // DynamicColorIOS); compare them by value so a theme object recreated on
45
+ // every render does not re-apply the same color.
46
+ const primary = JSON.stringify(theme ? (0, _reactNative.processColor)(theme.colors.primary) ?? null : null);
47
+ (0, _react.useLayoutEffect)(() => {
48
+ applyProcessedPrimary(JSON.parse(primary));
49
+ }, [primary]);
50
+ }
51
+ //# sourceMappingURL=NativeTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_NativePlatformComponentsTheme","_interopRequireDefault","e","__esModule","default","applyProcessedPrimary","primary","NativePlatformComponentsTheme","setTheme","setNativeTheme","theme","processColor","colors","useNativeTheme","JSON","stringify","useLayoutEffect","parse"],"sourceRoot":"../../src","sources":["NativeTheme.ts"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,8BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA4E,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ5E;;AAMA;AACA;AACA;AACA;;AAWA,SAASG,qBAAqBA,CAACC,OAAgB,EAAQ;EACrDC,sCAA6B,EAAEC,QAAQ,CAACF,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG;IAAEA;EAAQ,CAAC,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAACC,KAAyB,EAAQ;EAC9DL,qBAAqB,CAACK,KAAK,GAAG,IAAAC,yBAAY,EAACD,KAAK,CAACE,MAAM,CAACN,OAAO,CAAC,GAAG,IAAI,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASO,cAAcA,CAACH,KAAqC,EAAQ;EAC1E;EACA;EACA;EACA,MAAMJ,OAAO,GAAGQ,IAAI,CAACC,SAAS,CAC5BL,KAAK,GAAI,IAAAC,yBAAY,EAACD,KAAK,CAACE,MAAM,CAACN,OAAO,CAAC,IAAI,IAAI,GAAI,IACzD,CAAC;EAED,IAAAU,sBAAe,EAAC,MAAM;IACpBX,qBAAqB,CAACS,IAAI,CAACG,KAAK,CAACX,OAAO,CAAC,CAAC;EAC5C,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AACf","ignoreList":[]}
@@ -1,11 +1,12 @@
1
1
  // SegmentedControlNativeComponent.ts
2
- import type {
3
- CodegenTypes,
4
- ColorValue,
5
- HostComponent,
6
- ViewProps,
7
- } from 'react-native';
2
+ import type { ColorValue, HostComponent, ViewProps } from 'react-native';
8
3
  import { codegenNativeComponent } from 'react-native';
4
+ import type {
5
+ BubblingEventHandler,
6
+ Double,
7
+ Int32,
8
+ WithDefault,
9
+ } from './codegenTypes';
9
10
 
10
11
  /**
11
12
  * A single segment in the control.
@@ -21,7 +22,7 @@ export type SegmentedControlSegment = Readonly<{
21
22
  iconType: string; // '' | 'sfSymbol' | 'drawable' | 'image'
22
23
  iconName: string; // SF Symbol (iOS) or drawable resource name (Android)
23
24
  iconUri: string; // Resolved image URI when iconType === 'image'
24
- iconScale: CodegenTypes.Double; // Resolved image scale when iconType === 'image'
25
+ iconScale: Double; // Resolved image scale when iconType === 'image'
25
26
  iconTinted: string; // 'true' | 'false' — draw the image as a tinted template
26
27
  badge: string; // Badge text, empty = no badge
27
28
  accessibilityLabel: string; // Screen-reader label, empty = use label
@@ -32,7 +33,7 @@ export type SegmentedControlSegment = Readonly<{
32
33
  */
33
34
  export type SegmentedControlSelectEvent = Readonly<{
34
35
  /** Selected segment index. -1 means the selection was cleared. */
35
- index: CodegenTypes.Int32;
36
+ index: Int32;
36
37
 
37
38
  /** Selected segment value. Empty when the selection was cleared. */
38
39
  value: string;
@@ -49,7 +50,7 @@ export type SegmentedControlLabelVisibility = 'auto' | 'labeled' | 'unlabeled';
49
50
  */
50
51
  export type LabelStyleProps = Readonly<{
51
52
  fontFamily?: string;
52
- fontSize?: CodegenTypes.Double;
53
+ fontSize?: Double;
53
54
  fontWeight?: string; // 'normal' | 'bold' | '100'..'900'
54
55
  fontStyle?: string; // 'normal' | 'italic'
55
56
  }>;
@@ -83,7 +84,7 @@ export interface SegmentedControlProps extends ViewProps {
83
84
  * Controlled selection by `value`.
84
85
  * Empty string means "no selection".
85
86
  */
86
- selectedValue?: CodegenTypes.WithDefault<string, ''>;
87
+ selectedValue?: WithDefault<string, ''>;
87
88
 
88
89
  /**
89
90
  * Enabled / disabled state.
@@ -122,7 +123,7 @@ export interface SegmentedControlProps extends ViewProps {
122
123
  /**
123
124
  * Fired when the user selects a segment.
124
125
  */
125
- onSelect?: CodegenTypes.BubblingEventHandler<SegmentedControlSelectEvent>;
126
+ onSelect?: BubblingEventHandler<SegmentedControlSelectEvent>;
126
127
 
127
128
  ios?: IOSProps;
128
129
  android?: AndroidProps;
@@ -1,6 +1,7 @@
1
1
  // SelectionMenuNativeComponent.ts
2
- import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
2
+ import type { HostComponent, ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
+ import type { BubblingEventHandler, Int32, WithDefault } from './codegenTypes';
4
5
 
5
6
  /**
6
7
  * A single option in the menu.
@@ -15,7 +16,7 @@ export type SelectionMenuOption = Readonly<{
15
16
  */
16
17
  export type SelectionMenuSelectEvent = Readonly<{
17
18
  /** Selected option index (implementation detail; stable for this render) */
18
- index: CodegenTypes.Int32;
19
+ index: Int32;
19
20
 
20
21
  /** Selected option label */
21
22
  label: string;
@@ -57,7 +58,7 @@ export interface SelectionMenuProps extends ViewProps {
57
58
  * - Empty string means "no selection".
58
59
  * - Native should treat this as the single source of truth.
59
60
  */
60
- selectedData?: CodegenTypes.WithDefault<string, ''>;
61
+ selectedData?: WithDefault<string, ''>;
61
62
 
62
63
  /**
63
64
  * Enabled / disabled state.
@@ -83,12 +84,12 @@ export interface SelectionMenuProps extends ViewProps {
83
84
  /**
84
85
  * Fired when the user selects an option.
85
86
  */
86
- onSelect?: CodegenTypes.BubblingEventHandler<SelectionMenuSelectEvent>;
87
+ onSelect?: BubblingEventHandler<SelectionMenuSelectEvent>;
87
88
 
88
89
  /**
89
90
  * Fired when dismissed without selection.
90
91
  */
91
- onRequestClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
92
+ onRequestClose?: BubblingEventHandler<Readonly<{}>>;
92
93
 
93
94
  ios?: IOSProps;
94
95
  android?: AndroidProps;