@expo/ui 56.0.15 → 56.0.17

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 (130) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +54 -6
  4. package/android/src/main/java/expo/modules/ui/HostView.kt +0 -2
  5. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +65 -0
  6. package/android/src/main/java/expo/modules/ui/NavigationBarView.kt +95 -0
  7. package/android/src/main/java/expo/modules/ui/RNHostView.kt +182 -6
  8. package/android/src/main/java/expo/modules/ui/textfield/BasicTextField.kt +203 -0
  9. package/android/src/main/java/expo/modules/ui/{TextFieldView.kt → textfield/TextField.kt} +63 -267
  10. package/android/src/main/java/expo/modules/ui/textfield/TextFieldShared.kt +299 -0
  11. package/build/State/useNativeState.d.ts +8 -3
  12. package/build/State/useNativeState.d.ts.map +1 -1
  13. package/build/community/pager-view/PagerView.android.d.ts.map +1 -1
  14. package/build/jetpack-compose/NavigationBar/index.d.ts +101 -0
  15. package/build/jetpack-compose/NavigationBar/index.d.ts.map +1 -0
  16. package/build/jetpack-compose/TextField/BasicTextField.d.ts +36 -0
  17. package/build/jetpack-compose/TextField/BasicTextField.d.ts.map +1 -0
  18. package/build/jetpack-compose/TextField/TextField.d.ts +131 -0
  19. package/build/jetpack-compose/TextField/TextField.d.ts.map +1 -0
  20. package/build/jetpack-compose/TextField/index.d.ts +3 -244
  21. package/build/jetpack-compose/TextField/index.d.ts.map +1 -1
  22. package/build/jetpack-compose/TextField/shared.d.ts +171 -0
  23. package/build/jetpack-compose/TextField/shared.d.ts.map +1 -0
  24. package/build/jetpack-compose/index.d.ts +2 -1
  25. package/build/jetpack-compose/index.d.ts.map +1 -1
  26. package/build/jetpack-compose/modifiers/index.d.ts +42 -0
  27. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  28. package/build/swift-ui/DisclosureGroup/index.d.ts +11 -2
  29. package/build/swift-ui/DisclosureGroup/index.d.ts.map +1 -1
  30. package/build/swift-ui/Image/index.d.ts +7 -1
  31. package/build/swift-ui/Image/index.d.ts.map +1 -1
  32. package/build/swift-ui/Label/index.d.ts +5 -0
  33. package/build/swift-ui/Label/index.d.ts.map +1 -1
  34. package/build/swift-ui/modifiers/index.d.ts +100 -4
  35. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  36. package/build/universal/Collapsible/index.android.d.ts +1 -1
  37. package/build/universal/Collapsible/index.android.d.ts.map +1 -1
  38. package/build/universal/Collapsible/index.d.ts +1 -1
  39. package/build/universal/Collapsible/index.d.ts.map +1 -1
  40. package/build/universal/Collapsible/index.ios.d.ts +1 -1
  41. package/build/universal/Collapsible/index.ios.d.ts.map +1 -1
  42. package/build/universal/Collapsible/types.d.ts +5 -0
  43. package/build/universal/Collapsible/types.d.ts.map +1 -1
  44. package/build/universal/TextInput/index.android.d.ts.map +1 -1
  45. package/build/universal/TextInput/types.d.ts +5 -1
  46. package/build/universal/TextInput/types.d.ts.map +1 -1
  47. package/expo-module.config.json +1 -1
  48. package/ios/BottomSheetView.swift +1 -1
  49. package/ios/DisclosureGroupView.swift +36 -13
  50. package/ios/ImageView.swift +20 -14
  51. package/ios/Label.swift +26 -2
  52. package/ios/Modifiers/ButtonBorderShapeModifier.swift +46 -0
  53. package/ios/Modifiers/DynamicTypeSizeModifier.swift +56 -0
  54. package/ios/Modifiers/FontModifier.swift +4 -1
  55. package/ios/Modifiers/ImageScaleModifier.swift +29 -0
  56. package/ios/Modifiers/OnGeometryChangeModifier.swift +8 -16
  57. package/ios/Modifiers/ViewModifierRegistry.swift +89 -8
  58. package/ios/SecureFieldView.swift +17 -1
  59. package/ios/TextFieldView.swift +33 -2
  60. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15-sources.jar → 56.0.17/expo.modules.ui-56.0.17-sources.jar} +0 -0
  61. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.md5 +1 -0
  62. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha1 +1 -0
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha256 +1 -0
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha512 +1 -0
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar +0 -0
  66. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.md5 +1 -0
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha1 +1 -0
  68. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha256 +1 -0
  69. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha512 +1 -0
  70. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.module → 56.0.17/expo.modules.ui-56.0.17.module} +22 -22
  71. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.md5 +1 -0
  72. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha1 +1 -0
  73. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha256 +1 -0
  74. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha512 +1 -0
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.pom → 56.0.17/expo.modules.ui-56.0.17.pom} +1 -1
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.md5 +1 -0
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha1 +1 -0
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha256 +1 -0
  79. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha512 +1 -0
  80. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  83. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  84. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  85. package/package.json +4 -4
  86. package/src/State/index.fx.ts +4 -1
  87. package/src/State/useNativeState.ts +24 -13
  88. package/src/community/datetime-picker/DateTimePicker.tsx +1 -1
  89. package/src/community/menu/MenuView.ios.tsx +1 -1
  90. package/src/community/pager-view/PagerView.android.tsx +16 -2
  91. package/src/community/pager-view/PagerView.ios.tsx +1 -1
  92. package/src/community/picker/Picker.ios.tsx +1 -1
  93. package/src/community/segmented-control/SegmentedControl.ios.tsx +1 -1
  94. package/src/community/slider/Slider.ios.tsx +1 -1
  95. package/src/jetpack-compose/NavigationBar/index.tsx +174 -0
  96. package/src/jetpack-compose/TextField/BasicTextField.tsx +118 -0
  97. package/src/jetpack-compose/TextField/TextField.tsx +198 -0
  98. package/src/jetpack-compose/TextField/index.ts +19 -0
  99. package/src/jetpack-compose/TextField/{index.tsx → shared.ts} +71 -203
  100. package/src/jetpack-compose/index.ts +7 -0
  101. package/src/jetpack-compose/modifiers/index.ts +49 -0
  102. package/src/swift-ui/BottomSheet/index.tsx +1 -1
  103. package/src/swift-ui/DisclosureGroup/index.tsx +14 -2
  104. package/src/swift-ui/Image/index.tsx +16 -3
  105. package/src/swift-ui/Label/index.tsx +8 -1
  106. package/src/swift-ui/modifiers/index.ts +143 -5
  107. package/src/universal/Collapsible/index.android.tsx +10 -2
  108. package/src/universal/Collapsible/index.ios.tsx +17 -3
  109. package/src/universal/Collapsible/index.tsx +8 -2
  110. package/src/universal/Collapsible/types.ts +7 -0
  111. package/src/universal/TextInput/index.android.tsx +26 -33
  112. package/src/universal/TextInput/types.ts +5 -1
  113. package/android/src/main/java/expo/modules/ui/ShadowNodeSyncFlush.kt +0 -28
  114. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.md5 +0 -1
  115. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha1 +0 -1
  116. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha256 +0 -1
  117. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha512 +0 -1
  118. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar +0 -0
  119. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.md5 +0 -1
  120. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha1 +0 -1
  121. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha256 +0 -1
  122. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha512 +0 -1
  123. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.md5 +0 -1
  124. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha1 +0 -1
  125. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha256 +0 -1
  126. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha512 +0 -1
  127. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.md5 +0 -1
  128. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha1 +0 -1
  129. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha256 +0 -1
  130. package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha512 +0 -1
@@ -20,6 +20,16 @@ export type ObservableState<T> = SharedObject & {
20
20
  */
21
21
  value: T;
22
22
 
23
+ /**
24
+ * Reads the current value. A React Compiler compliant alternative to reading `.value`
25
+ */
26
+ get(): T;
27
+
28
+ /**
29
+ * Writes a new value. A React Compiler-compliant alternative to assigning `.value`
30
+ */
31
+ set(value: T): void;
32
+
23
33
  /**
24
34
  * A single listener invoked on the native UI runtime whenever the value changes
25
35
  * (after iOS `didSet` and Android's setter). Assigning replaces the previous
@@ -38,9 +48,6 @@ export type ObservableState<T> = SharedObject & {
38
48
  * 'worklet';
39
49
  * console.log('changed to', value);
40
50
  * };
41
- * return () => {
42
- * state.onChange = null;
43
- * };
44
51
  * }, []);
45
52
  * ```
46
53
  */
@@ -65,28 +72,25 @@ type NativeObservableState = {
65
72
  getValue(): unknown;
66
73
  setValue(v: { value: unknown }): void;
67
74
  setOnChange(callback: object | null): void;
75
+ get?: () => unknown;
76
+ set?: (value: unknown) => void;
68
77
  };
69
78
 
70
79
  /**
71
- * Adds a `value` property that delegates to the native `getValue`/`setValue` functions.
80
+ * Adds a `value` property plus `get`/`set` methods that delegate to the native
81
+ * `getValue`/`setValue` functions.
72
82
  */
73
83
  function defineValueProperty(state: NativeObservableState): void {
74
- let warnedOnJSWrite = false;
75
84
  Object.defineProperty(state, 'value', {
76
85
  get() {
77
86
  return state.getValue();
78
87
  },
79
88
  set(v: unknown) {
80
- if (__DEV__ && !warnedOnJSWrite && worklets && !worklets.isUIRuntime()) {
81
- warnedOnJSWrite = true;
82
- console.warn(
83
- 'ObservableState.value was set from the JS thread, the result may be unexpected. ' +
84
- 'Use a worklet to update the state.'
85
- );
86
- }
87
89
  state.setValue({ value: v });
88
90
  },
89
91
  });
92
+ state.get = () => state.getValue();
93
+ state.set = (v: unknown) => state.setValue({ value: v });
90
94
  }
91
95
 
92
96
  /**
@@ -104,7 +108,14 @@ function defineOnChangeProperty(state: NativeObservableState): void {
104
108
  set(fn: ((value: unknown) => void) | null | undefined) {
105
109
  if (!fn) {
106
110
  currentFn = null;
107
- state.setOnChange(null);
111
+ try {
112
+ state.setOnChange(null);
113
+ } catch {
114
+ // On unmount the shared object is often released before this cleanup
115
+ // runs (useReleasingSharedObject releases it earlier in the component),
116
+ // so setOnChange throws "already released". Clearing a listener on a
117
+ // gone object is a no-op, so ignore it rather than crash teardown.
118
+ }
108
119
  return;
109
120
  }
110
121
  if (!worklets) {
@@ -87,7 +87,7 @@ export function DateTimePicker(props: DateTimePickerProps) {
87
87
  };
88
88
 
89
89
  return (
90
- <Host matchContents={{ vertical: true }} style={style}>
90
+ <Host matchContents={{ vertical: true }} style={style} ignoreSafeArea="all">
91
91
  <DatePicker {...iosProps} />
92
92
  </Host>
93
93
  );
@@ -135,7 +135,7 @@ export function MenuView(props: MenuComponentProps & { ref?: React.Ref<MenuCompo
135
135
  );
136
136
 
137
137
  return (
138
- <Host matchContents style={style} testID={testID}>
138
+ <Host matchContents style={style} testID={testID} ignoreSafeArea="all">
139
139
  {shouldOpenOnLongPress ? (
140
140
  <ContextMenu>
141
141
  <ContextMenu.Trigger>{trigger}</ContextMenu.Trigger>
@@ -8,7 +8,7 @@ import {
8
8
  useState,
9
9
  type ReactElement,
10
10
  } from 'react';
11
- import { StyleSheet } from 'react-native';
11
+ import { StyleSheet, View } from 'react-native';
12
12
 
13
13
  import { wrapNativeEvent, type PagerViewProps } from './types';
14
14
  import { worklets } from '../../State';
@@ -43,6 +43,13 @@ export function PagerView(props: PagerViewProps) {
43
43
  setScrollEnabledState(scrollEnabled);
44
44
  }, [scrollEnabled]);
45
45
 
46
+ // All pages share the same (0,0) origin in RN's layout — Compose, not Yoga,
47
+ // applies the per-page offset — so off-screen pages overlap the visible one in
48
+ // RN's coordinate space and can steal its touches (#46386). Track the settled
49
+ // page and make only it interactive; non-settled pages are `pointerEvents`
50
+ // "none" so hit-testing resolves taps to the page actually on screen.
51
+ const [settledPage, setSettledPage] = useState(initialPage);
52
+
46
53
  // Synthesize pager-view's `idle | dragging | settling` from Compose's raw
47
54
  // signals: `isScrollInProgress` (drag or snap-animation in flight) plus
48
55
  // drag interactions (start/stop/cancel).
@@ -73,7 +80,9 @@ export function PagerView(props: PagerViewProps) {
73
80
  .filter((child): child is ReactElement => isValidElement(child))
74
81
  .map((child, index) => (
75
82
  <RNHostView key={child.key ?? String(index)} modifiers={[fillMaxSize()]}>
76
- {child}
83
+ <View style={styles.page} pointerEvents={index === settledPage ? 'auto' : 'none'}>
84
+ {child}
85
+ </View>
77
86
  </RNHostView>
78
87
  ));
79
88
 
@@ -101,6 +110,7 @@ export function PagerView(props: PagerViewProps) {
101
110
  beyondViewportPageCount={offscreenPageLimit}
102
111
  modifiers={pagerModifiers}
103
112
  onSettledPageChange={(page) => {
113
+ setSettledPage(page);
104
114
  onPageSelected?.(wrapNativeEvent({ position: page }));
105
115
  }}
106
116
  onPageScroll={pageScrollHandler}
@@ -222,3 +232,7 @@ function warnAboutStringBorderRadiusOnce(key: string, value: string): void {
222
232
  `Use a numeric pixel value, or omit the style key.`
223
233
  );
224
234
  }
235
+
236
+ const styles = StyleSheet.create({
237
+ page: { flex: 1 },
238
+ });
@@ -213,7 +213,7 @@ export function PagerView(props: PagerViewProps) {
213
213
  ];
214
214
 
215
215
  return (
216
- <Host style={style ?? { flex: 1 }} {...passthrough}>
216
+ <Host style={style ?? { flex: 1 }} ignoreSafeArea="all" {...passthrough}>
217
217
  <ScrollView axes="horizontal" showsIndicators={false} modifiers={modifiers}>
218
218
  <LazyHStack spacing={0} modifiers={[scrollTargetLayout()]}>
219
219
  {pages}
@@ -41,7 +41,7 @@ export function Picker<T extends PickerItemValue>(props: PickerProps<T>) {
41
41
  }));
42
42
 
43
43
  return (
44
- <Host matchContents={{ vertical: true }} style={style}>
44
+ <Host matchContents={{ vertical: true }} style={style} ignoreSafeArea="all">
45
45
  <SwiftUIPicker
46
46
  modifiers={modifiers}
47
47
  selection={selectedValue}
@@ -35,7 +35,7 @@ export function SegmentedControl(props: SegmentedControlProps) {
35
35
  };
36
36
 
37
37
  return (
38
- <Host matchContents={{ vertical: true }} style={style}>
38
+ <Host matchContents={{ vertical: true }} style={style} ignoreSafeArea="all">
39
39
  <Picker
40
40
  selection={selectedIndex}
41
41
  onSelectionChange={handleSelectionChange}
@@ -32,7 +32,7 @@ export function Slider(props: SliderProps) {
32
32
  modifiers.push(tintModifier(minimumTrackTintColor as string));
33
33
  }
34
34
  return (
35
- <Host matchContents={{ vertical: true }} style={hostStyle}>
35
+ <Host matchContents={{ vertical: true }} style={hostStyle} ignoreSafeArea="all">
36
36
  <SwiftUISlider
37
37
  value={value}
38
38
  min={minimumValue}
@@ -0,0 +1,174 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { type ColorValue } from 'react-native';
3
+
4
+ import { type ModifierConfig, type ViewEvent } from '../../types';
5
+ import { createViewModifierEventListener } from '../modifiers';
6
+
7
+ type SlotProps = {
8
+ children: React.ReactNode;
9
+ };
10
+
11
+ type NativeSlotViewProps = {
12
+ slotName: string;
13
+ children: React.ReactNode;
14
+ };
15
+
16
+ /**
17
+ * Colors for navigation bar items in different states.
18
+ */
19
+ export type NavigationBarItemColors = {
20
+ selectedIconColor?: ColorValue;
21
+ selectedTextColor?: ColorValue;
22
+ selectedIndicatorColor?: ColorValue;
23
+ unselectedIconColor?: ColorValue;
24
+ unselectedTextColor?: ColorValue;
25
+ disabledIconColor?: ColorValue;
26
+ disabledTextColor?: ColorValue;
27
+ };
28
+
29
+ export type NavigationBarProps = {
30
+ /**
31
+ * Background color of the navigation bar.
32
+ * @default NavigationBarDefaults.containerColor
33
+ */
34
+ containerColor?: ColorValue;
35
+ /**
36
+ * Preferred content color inside the navigation bar.
37
+ * @default contentColorFor(containerColor)
38
+ */
39
+ contentColor?: ColorValue;
40
+ /**
41
+ * Tonal elevation in dp.
42
+ * @default NavigationBarDefaults.Elevation
43
+ */
44
+ tonalElevation?: number;
45
+ /**
46
+ * Modifiers for the component.
47
+ */
48
+ modifiers?: ModifierConfig[];
49
+ /**
50
+ * Navigation bar items.
51
+ */
52
+ children?: React.ReactNode;
53
+ };
54
+
55
+ export type NavigationBarItemProps = {
56
+ /**
57
+ * Whether this item is currently selected.
58
+ */
59
+ selected: boolean;
60
+ /**
61
+ * Callback that is called when the item is clicked.
62
+ */
63
+ onClick?: () => void;
64
+ /**
65
+ * Whether the item is enabled.
66
+ * @default true
67
+ */
68
+ enabled?: boolean;
69
+ /**
70
+ * Whether to always show the label.
71
+ * @default true
72
+ */
73
+ alwaysShowLabel?: boolean;
74
+ /**
75
+ * Colors for the item in different states.
76
+ */
77
+ colors?: NavigationBarItemColors;
78
+ /**
79
+ * Modifiers for the component.
80
+ */
81
+ modifiers?: ModifierConfig[];
82
+ /**
83
+ * Children containing `Icon`, `SelectedIcon`, and `Label` slots.
84
+ */
85
+ children?: React.ReactNode;
86
+ };
87
+
88
+ type NativeNavigationBarItemProps = Omit<NavigationBarItemProps, 'onClick'> &
89
+ ViewEvent<'onButtonPressed', void>;
90
+
91
+ const NavigationBarNativeView: React.ComponentType<NavigationBarProps> = requireNativeView(
92
+ 'ExpoUI',
93
+ 'NavigationBarView'
94
+ );
95
+
96
+ const NavigationBarItemNativeView: React.ComponentType<NativeNavigationBarItemProps> =
97
+ requireNativeView('ExpoUI', 'NavigationBarItemView');
98
+
99
+ const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
100
+ 'ExpoUI',
101
+ 'SlotView'
102
+ );
103
+
104
+ function transformNavigationBarProps(props: NavigationBarProps): NavigationBarProps {
105
+ const { modifiers, ...restProps } = props;
106
+ return {
107
+ modifiers,
108
+ ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
109
+ ...restProps,
110
+ };
111
+ }
112
+
113
+ function transformNavigationBarItemProps(
114
+ props: NavigationBarItemProps
115
+ ): NativeNavigationBarItemProps {
116
+ const { modifiers, onClick, ...restProps } = props;
117
+ return {
118
+ modifiers,
119
+ ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
120
+ ...restProps,
121
+ onButtonPressed: () => onClick?.(),
122
+ };
123
+ }
124
+
125
+ /**
126
+ * Icon slot for `NavigationBarItem`.
127
+ */
128
+ function NavigationBarItemIcon(props: SlotProps) {
129
+ return <SlotNativeView slotName="icon">{props.children}</SlotNativeView>;
130
+ }
131
+
132
+ /**
133
+ * Selected icon slot for `NavigationBarItem`. Falls back to `Icon` when omitted.
134
+ */
135
+ function NavigationBarItemSelectedIcon(props: SlotProps) {
136
+ return <SlotNativeView slotName="selectedIcon">{props.children}</SlotNativeView>;
137
+ }
138
+
139
+ /**
140
+ * Label slot for `NavigationBarItem`.
141
+ */
142
+ function NavigationBarItemLabel(props: SlotProps) {
143
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
144
+ }
145
+
146
+ /**
147
+ * A Material Design 3 navigation bar.
148
+ */
149
+ export function NavigationBar(props: NavigationBarProps) {
150
+ const { children, ...restProps } = props;
151
+ return (
152
+ <NavigationBarNativeView {...transformNavigationBarProps(restProps)}>
153
+ {children}
154
+ </NavigationBarNativeView>
155
+ );
156
+ }
157
+
158
+ /**
159
+ * A Material Design 3 navigation bar item. Must be used inside `NavigationBar`.
160
+ */
161
+ function NavigationBarItemComponent(props: NavigationBarItemProps) {
162
+ const { children, ...restProps } = props;
163
+ return (
164
+ <NavigationBarItemNativeView {...transformNavigationBarItemProps(restProps)}>
165
+ {children}
166
+ </NavigationBarItemNativeView>
167
+ );
168
+ }
169
+
170
+ NavigationBarItemComponent.Icon = NavigationBarItemIcon;
171
+ NavigationBarItemComponent.SelectedIcon = NavigationBarItemSelectedIcon;
172
+ NavigationBarItemComponent.Label = NavigationBarItemLabel;
173
+
174
+ export { NavigationBarItemComponent as NavigationBarItem };
@@ -0,0 +1,118 @@
1
+ import { requireNativeView } from 'expo';
2
+ import type { ColorValue } from 'react-native';
3
+
4
+ import {
5
+ type CommonNativeTextFieldProps,
6
+ type CommonTextFieldProperties,
7
+ type TextFieldRef,
8
+ useCommonTextFieldProps,
9
+ } from './shared';
10
+ import { Slot } from '../SlotView';
11
+
12
+ // region Types
13
+
14
+ /**
15
+ * Imperative methods for `BasicTextField`. Identical to {@link TextFieldRef}.
16
+ */
17
+ export type BasicTextFieldRef = TextFieldRef;
18
+
19
+ /**
20
+ * Props for `BasicTextField`. Mirrors Compose's `BasicTextField`: a bare,
21
+ * unstyled text field with no Material chrome (no container, indicator, or
22
+ * built-in padding). Shares {@link CommonTextFieldProperties} with `TextField` and
23
+ * `OutlinedTextField`; use `BasicTextField.DecorationBox` to add your own
24
+ * decoration.
25
+ */
26
+ export type BasicTextFieldProps = CommonTextFieldProperties & {
27
+ /**
28
+ * Color of the text cursor. Maps to Compose's `cursorBrush` via
29
+ * `SolidColor(color)`. Defaults to the theme's primary color
30
+ * (`MaterialTheme.colorScheme.primary`) so it stays visible in light and dark.
31
+ */
32
+ cursorColor?: ColorValue;
33
+ };
34
+
35
+ // endregion Types
36
+
37
+ // region Native
38
+
39
+ type NativeBasicTextFieldProps = Omit<
40
+ BasicTextFieldProps,
41
+ | 'value'
42
+ | 'selection'
43
+ | 'onValueChange'
44
+ | 'onFocusChanged'
45
+ | 'onSelectionChange'
46
+ | 'keyboardActions'
47
+ | 'children'
48
+ > &
49
+ CommonNativeTextFieldProps;
50
+
51
+ const BasicTextFieldNativeView: React.ComponentType<NativeBasicTextFieldProps> = requireNativeView(
52
+ 'ExpoUI',
53
+ 'BasicTextFieldView'
54
+ );
55
+
56
+ const InnerTextFieldNativeView: React.ComponentType<object> = requireNativeView(
57
+ 'ExpoUI',
58
+ 'InnerTextFieldView'
59
+ );
60
+
61
+ const PlaceholderNativeView: React.ComponentType<{ children?: React.ReactNode }> =
62
+ requireNativeView('ExpoUI', 'PlaceholderView');
63
+
64
+ function useTransformedProps(props: BasicTextFieldProps): NativeBasicTextFieldProps {
65
+ return useCommonTextFieldProps(props);
66
+ }
67
+
68
+ // endregion Native
69
+
70
+ // region Slot components
71
+
72
+ /**
73
+ * Wraps the editable text with custom decoration. Maps to Compose's
74
+ * `decorationBox`. Place {@link InnerTextField} inside it where the text
75
+ * should render.
76
+ */
77
+ function DecorationBox(props: { children: React.ReactNode }) {
78
+ return <Slot slotName="decorationBox">{props.children}</Slot>;
79
+ }
80
+
81
+ /**
82
+ * The editable text itself, placed wherever you want it inside
83
+ * {@link DecorationBox}. Maps to the `innerTextField` lambda Compose passes to
84
+ * `decorationBox`.
85
+ */
86
+ function InnerTextField() {
87
+ return <InnerTextFieldNativeView />;
88
+ }
89
+
90
+ /**
91
+ * A placeholder shown only while the field is empty. Place it inside
92
+ * {@link DecorationBox}, typically overlaying {@link InnerTextField}. Its
93
+ * visibility is toggled natively from the field's text, so it stays correct for
94
+ * every change — typing, `clear()`, `setText`, and writes to the `value`
95
+ * observable — without a JS round-trip.
96
+ */
97
+ function Placeholder(props: { children: React.ReactNode }) {
98
+ return <PlaceholderNativeView>{props.children}</PlaceholderNativeView>;
99
+ }
100
+
101
+ // endregion Slot components
102
+
103
+ // region Component
104
+
105
+ /**
106
+ * A bare, unstyled Compose `BasicTextField` with no Material decoration.
107
+ */
108
+ function BasicTextFieldComponent(props: BasicTextFieldProps) {
109
+ return <BasicTextFieldNativeView {...useTransformedProps(props)} />;
110
+ }
111
+
112
+ BasicTextFieldComponent.DecorationBox = DecorationBox;
113
+ BasicTextFieldComponent.InnerTextField = InnerTextField;
114
+ BasicTextFieldComponent.Placeholder = Placeholder;
115
+
116
+ // endregion Component
117
+
118
+ export { BasicTextFieldComponent as BasicTextField };
@@ -0,0 +1,198 @@
1
+ import { requireNativeView } from 'expo';
2
+ import type { ColorValue } from 'react-native';
3
+
4
+ import {
5
+ type CommonNativeTextFieldProps,
6
+ type CommonTextFieldProperties,
7
+ useCommonTextFieldProps,
8
+ } from './shared';
9
+ import { type ObservableState } from '../../State';
10
+ import { parseJSXShape, type ShapeJSXElement, type ShapeRecordProps } from '../Shape';
11
+ import { Slot } from '../SlotView';
12
+
13
+ // region Types
14
+
15
+ /**
16
+ * Colors for `TextField` and `OutlinedTextField`.
17
+ * Maps to `TextFieldColors` in Compose, shared by both variants.
18
+ */
19
+ export type TextFieldColors = {
20
+ focusedTextColor?: ColorValue;
21
+ unfocusedTextColor?: ColorValue;
22
+ disabledTextColor?: ColorValue;
23
+ errorTextColor?: ColorValue;
24
+ focusedContainerColor?: ColorValue;
25
+ unfocusedContainerColor?: ColorValue;
26
+ disabledContainerColor?: ColorValue;
27
+ errorContainerColor?: ColorValue;
28
+ cursorColor?: ColorValue;
29
+ errorCursorColor?: ColorValue;
30
+ focusedIndicatorColor?: ColorValue;
31
+ unfocusedIndicatorColor?: ColorValue;
32
+ disabledIndicatorColor?: ColorValue;
33
+ errorIndicatorColor?: ColorValue;
34
+ focusedLeadingIconColor?: ColorValue;
35
+ unfocusedLeadingIconColor?: ColorValue;
36
+ disabledLeadingIconColor?: ColorValue;
37
+ errorLeadingIconColor?: ColorValue;
38
+ focusedTrailingIconColor?: ColorValue;
39
+ unfocusedTrailingIconColor?: ColorValue;
40
+ disabledTrailingIconColor?: ColorValue;
41
+ errorTrailingIconColor?: ColorValue;
42
+ focusedLabelColor?: ColorValue;
43
+ unfocusedLabelColor?: ColorValue;
44
+ disabledLabelColor?: ColorValue;
45
+ errorLabelColor?: ColorValue;
46
+ focusedPlaceholderColor?: ColorValue;
47
+ unfocusedPlaceholderColor?: ColorValue;
48
+ disabledPlaceholderColor?: ColorValue;
49
+ errorPlaceholderColor?: ColorValue;
50
+ focusedSupportingTextColor?: ColorValue;
51
+ unfocusedSupportingTextColor?: ColorValue;
52
+ disabledSupportingTextColor?: ColorValue;
53
+ errorSupportingTextColor?: ColorValue;
54
+ focusedPrefixColor?: ColorValue;
55
+ unfocusedPrefixColor?: ColorValue;
56
+ disabledPrefixColor?: ColorValue;
57
+ errorPrefixColor?: ColorValue;
58
+ focusedSuffixColor?: ColorValue;
59
+ unfocusedSuffixColor?: ColorValue;
60
+ disabledSuffixColor?: ColorValue;
61
+ errorSuffixColor?: ColorValue;
62
+ };
63
+
64
+ // Material props inlined per variant (not a shared named base) so docs render them directly.
65
+ export type TextFieldProps = CommonTextFieldProperties & {
66
+ /** @default false */
67
+ isError?: boolean;
68
+ /**
69
+ * Shape used for the field's container outline/fill. Use the helpers from
70
+ * `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
71
+ * Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
72
+ */
73
+ shape?: ShapeJSXElement;
74
+ colors?: TextFieldColors;
75
+ };
76
+
77
+ export type OutlinedTextFieldProps = CommonTextFieldProperties & {
78
+ /** @default false */
79
+ isError?: boolean;
80
+ /**
81
+ * Shape used for the field's container outline/fill. Use the helpers from
82
+ * `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
83
+ * Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
84
+ */
85
+ shape?: ShapeJSXElement;
86
+ colors?: TextFieldColors;
87
+ };
88
+
89
+ // endregion Types
90
+
91
+ // region Native
92
+
93
+ type NativeTextFieldProps = Omit<
94
+ TextFieldProps,
95
+ | 'value'
96
+ | 'selection'
97
+ | 'onValueChange'
98
+ | 'onFocusChanged'
99
+ | 'onSelectionChange'
100
+ | 'keyboardActions'
101
+ | 'children'
102
+ | 'shape'
103
+ > &
104
+ CommonNativeTextFieldProps & {
105
+ variant: 'filled' | 'outlined';
106
+ colors?: TextFieldColors;
107
+ shape?: ShapeRecordProps;
108
+ };
109
+
110
+ const TextFieldNativeView: React.ComponentType<NativeTextFieldProps> = requireNativeView(
111
+ 'ExpoUI',
112
+ 'TextFieldView'
113
+ );
114
+
115
+ function useTransformedProps(
116
+ props: TextFieldProps | OutlinedTextFieldProps,
117
+ variant: 'filled' | 'outlined'
118
+ ): NativeTextFieldProps {
119
+ const { shape, ...rest } = props;
120
+ return {
121
+ ...useCommonTextFieldProps(rest),
122
+ variant,
123
+ shape: parseJSXShape(shape),
124
+ };
125
+ }
126
+
127
+ // endregion Native
128
+
129
+ // region Slot components
130
+
131
+ function Label(props: { children: React.ReactNode }) {
132
+ return <Slot slotName="label">{props.children}</Slot>;
133
+ }
134
+
135
+ function Placeholder(props: { children: React.ReactNode }) {
136
+ return <Slot slotName="placeholder">{props.children}</Slot>;
137
+ }
138
+
139
+ function LeadingIcon(props: { children: React.ReactNode }) {
140
+ return <Slot slotName="leadingIcon">{props.children}</Slot>;
141
+ }
142
+
143
+ function TrailingIcon(props: { children: React.ReactNode }) {
144
+ return <Slot slotName="trailingIcon">{props.children}</Slot>;
145
+ }
146
+
147
+ function Prefix(props: { children: React.ReactNode }) {
148
+ return <Slot slotName="prefix">{props.children}</Slot>;
149
+ }
150
+
151
+ function Suffix(props: { children: React.ReactNode }) {
152
+ return <Slot slotName="suffix">{props.children}</Slot>;
153
+ }
154
+
155
+ function SupportingText(props: { children: React.ReactNode }) {
156
+ return <Slot slotName="supportingText">{props.children}</Slot>;
157
+ }
158
+
159
+ // endregion Slot components
160
+
161
+ // region Components
162
+
163
+ /**
164
+ * A Material3 `TextField`.
165
+ */
166
+ function TextFieldComponent(props: TextFieldProps) {
167
+ return <TextFieldNativeView {...useTransformedProps(props, 'filled')} />;
168
+ }
169
+
170
+ TextFieldComponent.Label = Label;
171
+ TextFieldComponent.Placeholder = Placeholder;
172
+ TextFieldComponent.LeadingIcon = LeadingIcon;
173
+ TextFieldComponent.TrailingIcon = TrailingIcon;
174
+ TextFieldComponent.Prefix = Prefix;
175
+ TextFieldComponent.Suffix = Suffix;
176
+ TextFieldComponent.SupportingText = SupportingText;
177
+
178
+ /**
179
+ * A Material3 `OutlinedTextField` with a transparent background and border outline.
180
+ */
181
+ function OutlinedTextFieldComponent(props: OutlinedTextFieldProps) {
182
+ return <TextFieldNativeView {...useTransformedProps(props, 'outlined')} />;
183
+ }
184
+
185
+ OutlinedTextFieldComponent.Label = Label;
186
+ OutlinedTextFieldComponent.Placeholder = Placeholder;
187
+ OutlinedTextFieldComponent.LeadingIcon = LeadingIcon;
188
+ OutlinedTextFieldComponent.TrailingIcon = TrailingIcon;
189
+ OutlinedTextFieldComponent.Prefix = Prefix;
190
+ OutlinedTextFieldComponent.Suffix = Suffix;
191
+ OutlinedTextFieldComponent.SupportingText = SupportingText;
192
+
193
+ // endregion Components
194
+
195
+ export { TextFieldComponent as TextField, OutlinedTextFieldComponent as OutlinedTextField };
196
+
197
+ // Exported for docs api data
198
+ export { type ObservableState };
@@ -0,0 +1,19 @@
1
+ export {
2
+ TextField,
3
+ OutlinedTextField,
4
+ type TextFieldColors,
5
+ type TextFieldProps,
6
+ type OutlinedTextFieldProps,
7
+ type ObservableState,
8
+ } from './TextField';
9
+ export { BasicTextField, type BasicTextFieldProps, type BasicTextFieldRef } from './BasicTextField';
10
+ export type {
11
+ TextFieldRef,
12
+ TextFieldCapitalization,
13
+ TextFieldImeAction,
14
+ TextFieldKeyboardType,
15
+ TextFieldKeyboardOptions,
16
+ TextFieldKeyboardActions,
17
+ TextFieldTextStyle,
18
+ CommonTextFieldProperties,
19
+ } from './shared';