@vxrn/native 1.12.8-1774390675831

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 (176) hide show
  1. package/.turbo/turbo-build.log +2 -0
  2. package/android/build.gradle +32 -0
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/java/dev/vxrn/native/VxrnNativeModule.kt +117 -0
  5. package/android/src/main/java/dev/vxrn/native/VxrnNativePackage.kt +16 -0
  6. package/dist/cjs/color/android.dynamic.types.cjs +16 -0
  7. package/dist/cjs/color/android.dynamic.types.native.js +19 -0
  8. package/dist/cjs/color/android.dynamic.types.native.js.map +1 -0
  9. package/dist/cjs/color/android.material.types.cjs +16 -0
  10. package/dist/cjs/color/android.material.types.native.js +19 -0
  11. package/dist/cjs/color/android.material.types.native.js.map +1 -0
  12. package/dist/cjs/color/index.cjs +66 -0
  13. package/dist/cjs/color/index.native.js +69 -0
  14. package/dist/cjs/color/index.native.js.map +1 -0
  15. package/dist/cjs/color/ios.types.cjs +16 -0
  16. package/dist/cjs/color/ios.types.native.js +19 -0
  17. package/dist/cjs/color/ios.types.native.js.map +1 -0
  18. package/dist/cjs/color/materialColor.cjs +32 -0
  19. package/dist/cjs/color/materialColor.native.js +43 -0
  20. package/dist/cjs/color/materialColor.native.js.map +1 -0
  21. package/dist/cjs/index.cjs +37 -0
  22. package/dist/cjs/index.native.js +40 -0
  23. package/dist/cjs/index.native.js.map +1 -0
  24. package/dist/cjs/menu/index.cjs +28 -0
  25. package/dist/cjs/menu/index.native.js +47 -0
  26. package/dist/cjs/menu/index.native.js.map +1 -0
  27. package/dist/cjs/menu/types.cjs +16 -0
  28. package/dist/cjs/menu/types.native.js +19 -0
  29. package/dist/cjs/menu/types.native.js.map +1 -0
  30. package/dist/cjs/split-view/index.cjs +26 -0
  31. package/dist/cjs/split-view/index.native.js +29 -0
  32. package/dist/cjs/split-view/index.native.js.map +1 -0
  33. package/dist/cjs/split-view/split-view.cjs +80 -0
  34. package/dist/cjs/split-view/split-view.native.js +88 -0
  35. package/dist/cjs/split-view/split-view.native.js.map +1 -0
  36. package/dist/cjs/toolbar/index.cjs +32 -0
  37. package/dist/cjs/toolbar/index.native.js +60 -0
  38. package/dist/cjs/toolbar/index.native.js.map +1 -0
  39. package/dist/cjs/toolbar/types.cjs +16 -0
  40. package/dist/cjs/toolbar/types.native.js +19 -0
  41. package/dist/cjs/toolbar/types.native.js.map +1 -0
  42. package/dist/cjs/zoom/index.cjs +36 -0
  43. package/dist/cjs/zoom/index.native.js +65 -0
  44. package/dist/cjs/zoom/index.native.js.map +1 -0
  45. package/dist/cjs/zoom/types.cjs +16 -0
  46. package/dist/cjs/zoom/types.native.js +19 -0
  47. package/dist/cjs/zoom/types.native.js.map +1 -0
  48. package/dist/esm/color/android.dynamic.types.mjs +2 -0
  49. package/dist/esm/color/android.dynamic.types.mjs.map +1 -0
  50. package/dist/esm/color/android.dynamic.types.native.js +2 -0
  51. package/dist/esm/color/android.dynamic.types.native.js.map +1 -0
  52. package/dist/esm/color/android.material.types.mjs +2 -0
  53. package/dist/esm/color/android.material.types.mjs.map +1 -0
  54. package/dist/esm/color/android.material.types.native.js +2 -0
  55. package/dist/esm/color/android.material.types.native.js.map +1 -0
  56. package/dist/esm/color/index.mjs +42 -0
  57. package/dist/esm/color/index.mjs.map +1 -0
  58. package/dist/esm/color/index.native.js +42 -0
  59. package/dist/esm/color/index.native.js.map +1 -0
  60. package/dist/esm/color/ios.types.mjs +2 -0
  61. package/dist/esm/color/ios.types.mjs.map +1 -0
  62. package/dist/esm/color/ios.types.native.js +2 -0
  63. package/dist/esm/color/ios.types.native.js.map +1 -0
  64. package/dist/esm/color/materialColor.mjs +8 -0
  65. package/dist/esm/color/materialColor.mjs.map +1 -0
  66. package/dist/esm/color/materialColor.native.js +16 -0
  67. package/dist/esm/color/materialColor.native.js.map +1 -0
  68. package/dist/esm/index.mjs +7 -0
  69. package/dist/esm/index.mjs.map +1 -0
  70. package/dist/esm/index.native.js +7 -0
  71. package/dist/esm/index.native.js.map +1 -0
  72. package/dist/esm/menu/index.mjs +5 -0
  73. package/dist/esm/menu/index.mjs.map +1 -0
  74. package/dist/esm/menu/index.native.js +21 -0
  75. package/dist/esm/menu/index.native.js.map +1 -0
  76. package/dist/esm/menu/types.mjs +2 -0
  77. package/dist/esm/menu/types.mjs.map +1 -0
  78. package/dist/esm/menu/types.native.js +2 -0
  79. package/dist/esm/menu/types.native.js.map +1 -0
  80. package/dist/esm/split-view/index.mjs +3 -0
  81. package/dist/esm/split-view/index.mjs.map +1 -0
  82. package/dist/esm/split-view/index.native.js +3 -0
  83. package/dist/esm/split-view/index.native.js.map +1 -0
  84. package/dist/esm/split-view/split-view.mjs +46 -0
  85. package/dist/esm/split-view/split-view.mjs.map +1 -0
  86. package/dist/esm/split-view/split-view.native.js +51 -0
  87. package/dist/esm/split-view/split-view.native.js.map +1 -0
  88. package/dist/esm/toolbar/index.mjs +8 -0
  89. package/dist/esm/toolbar/index.mjs.map +1 -0
  90. package/dist/esm/toolbar/index.native.js +33 -0
  91. package/dist/esm/toolbar/index.native.js.map +1 -0
  92. package/dist/esm/toolbar/types.mjs +2 -0
  93. package/dist/esm/toolbar/types.mjs.map +1 -0
  94. package/dist/esm/toolbar/types.native.js +2 -0
  95. package/dist/esm/toolbar/types.native.js.map +1 -0
  96. package/dist/esm/zoom/index.mjs +11 -0
  97. package/dist/esm/zoom/index.mjs.map +1 -0
  98. package/dist/esm/zoom/index.native.js +37 -0
  99. package/dist/esm/zoom/index.native.js.map +1 -0
  100. package/dist/esm/zoom/types.mjs +2 -0
  101. package/dist/esm/zoom/types.mjs.map +1 -0
  102. package/dist/esm/zoom/types.native.js +2 -0
  103. package/dist/esm/zoom/types.native.js.map +1 -0
  104. package/ios/Menu/MenuActionView.swift +339 -0
  105. package/ios/Menu/VxrnMenuActionManager.m +47 -0
  106. package/ios/Toolbar/FontUtils.swift +46 -0
  107. package/ios/Toolbar/ToolbarHostView.swift +138 -0
  108. package/ios/Toolbar/ToolbarItemView.swift +334 -0
  109. package/ios/Toolbar/VxrnToolbarHostManager.m +20 -0
  110. package/ios/Toolbar/VxrnToolbarItemManager.m +41 -0
  111. package/ios/VxrnNative-Bridging-Header.h +7 -0
  112. package/ios/VxrnNative.podspec +31 -0
  113. package/ios/ZoomTransition/VxrnZoomAlignmentManager.m +22 -0
  114. package/ios/ZoomTransition/VxrnZoomEnablerManager.m +23 -0
  115. package/ios/ZoomTransition/VxrnZoomSourceManager.m +24 -0
  116. package/ios/ZoomTransition/ZoomTransition.swift +384 -0
  117. package/package.json +82 -0
  118. package/react-native.config.js +14 -0
  119. package/src/color/android.dynamic.types.ts +384 -0
  120. package/src/color/android.material.types.ts +291 -0
  121. package/src/color/index.native.ts +75 -0
  122. package/src/color/index.ts +75 -0
  123. package/src/color/ios.types.ts +156 -0
  124. package/src/color/materialColor.native.ts +15 -0
  125. package/src/color/materialColor.ts +7 -0
  126. package/src/index.ts +20 -0
  127. package/src/menu/index.native.tsx +28 -0
  128. package/src/menu/index.ts +7 -0
  129. package/src/menu/types.ts +32 -0
  130. package/src/split-view/index.ts +2 -0
  131. package/src/split-view/split-view.tsx +80 -0
  132. package/src/toolbar/index.native.tsx +39 -0
  133. package/src/toolbar/index.ts +11 -0
  134. package/src/toolbar/types.ts +39 -0
  135. package/src/zoom/index.native.tsx +56 -0
  136. package/src/zoom/index.ts +28 -0
  137. package/src/zoom/types.ts +30 -0
  138. package/tsconfig.json +7 -0
  139. package/types/color/android.dynamic.types.d.ts +384 -0
  140. package/types/color/android.dynamic.types.d.ts.map +1 -0
  141. package/types/color/android.material.types.d.ts +291 -0
  142. package/types/color/android.material.types.d.ts.map +1 -0
  143. package/types/color/index.d.ts +25 -0
  144. package/types/color/index.d.ts.map +1 -0
  145. package/types/color/index.native.d.ts +25 -0
  146. package/types/color/index.native.d.ts.map +1 -0
  147. package/types/color/ios.types.d.ts +156 -0
  148. package/types/color/ios.types.d.ts.map +1 -0
  149. package/types/color/materialColor.d.ts +3 -0
  150. package/types/color/materialColor.d.ts.map +1 -0
  151. package/types/color/materialColor.native.d.ts +3 -0
  152. package/types/color/materialColor.native.d.ts.map +1 -0
  153. package/types/index.d.ts +10 -0
  154. package/types/index.d.ts.map +1 -0
  155. package/types/menu/index.d.ts +4 -0
  156. package/types/menu/index.d.ts.map +1 -0
  157. package/types/menu/index.native.d.ts +4 -0
  158. package/types/menu/index.native.d.ts.map +1 -0
  159. package/types/menu/types.d.ts +32 -0
  160. package/types/menu/types.d.ts.map +1 -0
  161. package/types/split-view/index.d.ts +3 -0
  162. package/types/split-view/index.d.ts.map +1 -0
  163. package/types/split-view/split-view.d.ts +19 -0
  164. package/types/split-view/split-view.d.ts.map +1 -0
  165. package/types/toolbar/index.d.ts +5 -0
  166. package/types/toolbar/index.d.ts.map +1 -0
  167. package/types/toolbar/index.native.d.ts +5 -0
  168. package/types/toolbar/index.native.d.ts.map +1 -0
  169. package/types/toolbar/types.d.ts +37 -0
  170. package/types/toolbar/types.d.ts.map +1 -0
  171. package/types/zoom/index.d.ts +6 -0
  172. package/types/zoom/index.d.ts.map +1 -0
  173. package/types/zoom/index.native.d.ts +6 -0
  174. package/types/zoom/index.native.d.ts.map +1 -0
  175. package/types/zoom/types.d.ts +26 -0
  176. package/types/zoom/types.d.ts.map +1 -0
@@ -0,0 +1,75 @@
1
+ // adapted from expo-router (MIT license) - https://github.com/expo/expo
2
+ import { PlatformColor, Platform, type ColorValue } from 'react-native'
3
+ import type { AndroidDynamicMaterialColorType } from './android.dynamic.types'
4
+ import type { AndroidStaticMaterialColorType } from './android.material.types'
5
+ import type { IOSBaseColor } from './ios.types'
6
+ import { Material3Color, Material3DynamicColor } from './materialColor'
7
+
8
+ export * from './android.dynamic.types'
9
+ export * from './android.material.types'
10
+ export * from './ios.types'
11
+
12
+ export type AndroidMaterialColor = AndroidStaticMaterialColorType & {
13
+ [key: string]: ColorValue
14
+ }
15
+
16
+ export type AndroidDynamicMaterialColor = AndroidDynamicMaterialColorType & {
17
+ [key: string]: ColorValue
18
+ }
19
+
20
+ export interface ColorType {
21
+ ios: IOSBaseColor & { [key: string]: ColorValue }
22
+ android: {
23
+ material: AndroidMaterialColor
24
+ dynamic: AndroidDynamicMaterialColor
25
+ [key: string]: any
26
+ }
27
+ }
28
+
29
+ const iosColor = new Proxy({} as ColorType['ios'], {
30
+ get(_, prop: string) {
31
+ if (Platform.OS === 'ios') return PlatformColor(prop)
32
+ return null
33
+ },
34
+ })
35
+
36
+ const androidMaterialColor = new Proxy({} as ColorType['android']['material'], {
37
+ get(_, prop: string) {
38
+ if (Platform.OS === 'android') return Material3Color(prop)
39
+ return null
40
+ },
41
+ })
42
+
43
+ const androidDynamicColor = new Proxy({} as ColorType['android']['dynamic'], {
44
+ get(_, prop: string) {
45
+ if (Platform.OS === 'android') return Material3DynamicColor(prop)
46
+ return null
47
+ },
48
+ })
49
+
50
+ const androidColor = new Proxy(
51
+ {
52
+ get material() {
53
+ return androidMaterialColor
54
+ },
55
+ get dynamic() {
56
+ return androidDynamicColor
57
+ },
58
+ } as ColorType['android'],
59
+ {
60
+ get(target, prop: string) {
61
+ if (prop in target) return (target as any)[prop]
62
+ if (Platform.OS === 'android') return PlatformColor('@android:color/' + prop)
63
+ return null
64
+ },
65
+ }
66
+ )
67
+
68
+ export const Color: ColorType = {
69
+ get ios() {
70
+ return iosColor
71
+ },
72
+ get android() {
73
+ return androidColor
74
+ },
75
+ }
@@ -0,0 +1,75 @@
1
+ // adapted from expo-router (MIT license) - https://github.com/expo/expo
2
+ import { Platform, type ColorValue } from 'react-native'
3
+ import type { AndroidDynamicMaterialColorType } from './android.dynamic.types'
4
+ import type { AndroidStaticMaterialColorType } from './android.material.types'
5
+ import type { IOSBaseColor } from './ios.types'
6
+ import { Material3Color, Material3DynamicColor } from './materialColor'
7
+
8
+ export * from './android.dynamic.types'
9
+ export * from './android.material.types'
10
+ export * from './ios.types'
11
+
12
+ export type AndroidMaterialColor = AndroidStaticMaterialColorType & {
13
+ [key: string]: ColorValue
14
+ }
15
+
16
+ export type AndroidDynamicMaterialColor = AndroidDynamicMaterialColorType & {
17
+ [key: string]: ColorValue
18
+ }
19
+
20
+ export interface ColorType {
21
+ ios: IOSBaseColor & { [key: string]: ColorValue }
22
+ android: {
23
+ material: AndroidMaterialColor
24
+ dynamic: AndroidDynamicMaterialColor
25
+ [key: string]: any
26
+ }
27
+ }
28
+
29
+ // on web/ssr, return null for all platform colors
30
+ // on native, these are overridden by the .native.ts version
31
+ const iosColor = new Proxy({} as ColorType['ios'], {
32
+ get() {
33
+ return null
34
+ },
35
+ })
36
+
37
+ const androidMaterialColor = new Proxy({} as ColorType['android']['material'], {
38
+ get(_, prop: string) {
39
+ if (Platform.OS === 'android') return Material3Color(prop)
40
+ return null
41
+ },
42
+ })
43
+
44
+ const androidDynamicColor = new Proxy({} as ColorType['android']['dynamic'], {
45
+ get(_, prop: string) {
46
+ if (Platform.OS === 'android') return Material3DynamicColor(prop)
47
+ return null
48
+ },
49
+ })
50
+
51
+ const androidColor = new Proxy(
52
+ {
53
+ get material() {
54
+ return androidMaterialColor
55
+ },
56
+ get dynamic() {
57
+ return androidDynamicColor
58
+ },
59
+ } as ColorType['android'],
60
+ {
61
+ get(target, prop: string) {
62
+ if (prop in target) return (target as any)[prop]
63
+ return null
64
+ },
65
+ }
66
+ )
67
+
68
+ export const Color: ColorType = {
69
+ get ios() {
70
+ return iosColor
71
+ },
72
+ get android() {
73
+ return androidColor
74
+ },
75
+ }
@@ -0,0 +1,156 @@
1
+ import type { ColorValue } from 'react-native'
2
+
3
+ export interface IOSBaseColor {
4
+ /**
5
+ * PlatformColor("systemBlue")
6
+ */
7
+ systemBlue: ColorValue
8
+ /**
9
+ * PlatformColor("systemBrown")
10
+ */
11
+ systemBrown: ColorValue
12
+ /**
13
+ * PlatformColor("systemCyan")
14
+ */
15
+ systemCyan: ColorValue
16
+ /**
17
+ * PlatformColor("systemGreen")
18
+ */
19
+ systemGreen: ColorValue
20
+ /**
21
+ * PlatformColor("systemIndigo")
22
+ */
23
+ systemIndigo: ColorValue
24
+ /**
25
+ * PlatformColor("systemMint")
26
+ */
27
+ systemMint: ColorValue
28
+ /**
29
+ * PlatformColor("systemOrange")
30
+ */
31
+ systemOrange: ColorValue
32
+ /**
33
+ * PlatformColor("systemPink")
34
+ */
35
+ systemPink: ColorValue
36
+ /**
37
+ * PlatformColor("systemPurple")
38
+ */
39
+ systemPurple: ColorValue
40
+ /**
41
+ * PlatformColor("systemRed")
42
+ */
43
+ systemRed: ColorValue
44
+ /**
45
+ * PlatformColor("systemTeal")
46
+ */
47
+ systemTeal: ColorValue
48
+ /**
49
+ * PlatformColor("systemYellow")
50
+ */
51
+ systemYellow: ColorValue
52
+ /**
53
+ * PlatformColor("systemGray")
54
+ */
55
+ systemGray: ColorValue
56
+ /**
57
+ * PlatformColor("systemGray2")
58
+ */
59
+ systemGray2: ColorValue
60
+ /**
61
+ * PlatformColor("systemGray3")
62
+ */
63
+ systemGray3: ColorValue
64
+ /**
65
+ * PlatformColor("systemGray4")
66
+ */
67
+ systemGray4: ColorValue
68
+ /**
69
+ * PlatformColor("systemGray5")
70
+ */
71
+ systemGray5: ColorValue
72
+ /**
73
+ * PlatformColor("systemGray6")
74
+ */
75
+ systemGray6: ColorValue
76
+ /**
77
+ * PlatformColor("label")
78
+ */
79
+ label: ColorValue
80
+ /**
81
+ * PlatformColor("secondaryLabel")
82
+ */
83
+ secondaryLabel: ColorValue
84
+ /**
85
+ * PlatformColor("tertiaryLabel")
86
+ */
87
+ tertiaryLabel: ColorValue
88
+ /**
89
+ * PlatformColor("quaternaryLabel")
90
+ */
91
+ quaternaryLabel: ColorValue
92
+ /**
93
+ * PlatformColor("systemFill")
94
+ */
95
+ systemFill: ColorValue
96
+ /**
97
+ * PlatformColor("secondarySystemFill")
98
+ */
99
+ secondarySystemFill: ColorValue
100
+ /**
101
+ * PlatformColor("tertiarySystemFill")
102
+ */
103
+ tertiarySystemFill: ColorValue
104
+ /**
105
+ * PlatformColor("quaternarySystemFill")
106
+ */
107
+ quaternarySystemFill: ColorValue
108
+ /**
109
+ * PlatformColor("placeholderText")
110
+ */
111
+ placeholderText: ColorValue
112
+ /**
113
+ * PlatformColor("systemBackground")
114
+ */
115
+ systemBackground: ColorValue
116
+ /**
117
+ * PlatformColor("secondarySystemBackground")
118
+ */
119
+ secondarySystemBackground: ColorValue
120
+ /**
121
+ * PlatformColor("tertiarySystemBackground")
122
+ */
123
+ tertiarySystemBackground: ColorValue
124
+ /**
125
+ * PlatformColor("systemGroupedBackground")
126
+ */
127
+ systemGroupedBackground: ColorValue
128
+ /**
129
+ * PlatformColor("secondarySystemGroupedBackground")
130
+ */
131
+ secondarySystemGroupedBackground: ColorValue
132
+ /**
133
+ * PlatformColor("tertiarySystemGroupedBackground")
134
+ */
135
+ tertiarySystemGroupedBackground: ColorValue
136
+ /**
137
+ * PlatformColor("separator")
138
+ */
139
+ separator: ColorValue
140
+ /**
141
+ * PlatformColor("opaqueSeparator")
142
+ */
143
+ opaqueSeparator: ColorValue
144
+ /**
145
+ * PlatformColor("link")
146
+ */
147
+ link: ColorValue
148
+ /**
149
+ * PlatformColor("darkText")
150
+ */
151
+ darkText: ColorValue
152
+ /**
153
+ * PlatformColor("lightText")
154
+ */
155
+ lightText: ColorValue
156
+ }
@@ -0,0 +1,15 @@
1
+ import { NativeModules, Platform, Appearance } from 'react-native'
2
+
3
+ const { VxrnNative } = NativeModules
4
+
5
+ export function Material3DynamicColor(name: string): string | null {
6
+ if (Platform.OS !== 'android' || !VxrnNative) return null
7
+ const scheme = Appearance.getColorScheme()
8
+ return VxrnNative.Material3DynamicColor(name, scheme ?? 'unspecified')
9
+ }
10
+
11
+ export function Material3Color(name: string): string | null {
12
+ if (Platform.OS !== 'android' || !VxrnNative) return null
13
+ const scheme = Appearance.getColorScheme()
14
+ return VxrnNative.Material3Color(name, scheme ?? 'unspecified')
15
+ }
@@ -0,0 +1,7 @@
1
+ export function Material3DynamicColor(_name: string): string | null {
2
+ return null
3
+ }
4
+
5
+ export function Material3Color(_name: string): string | null {
6
+ return null
7
+ }
package/src/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ // @vxrn/native - native navigation features for One
2
+ // adapted from expo-router (MIT license) - https://github.com/expo/expo
3
+
4
+ export { Color } from './color'
5
+ export type { ColorType } from './color'
6
+
7
+ export {
8
+ ZoomTransitionSource,
9
+ ZoomTransitionEnabler,
10
+ ZoomTransitionAlignmentRectDetector,
11
+ } from './zoom'
12
+
13
+ export { ToolbarHost, ToolbarItem } from './toolbar'
14
+ export type { ToolbarHostProps, ToolbarItemProps } from './toolbar'
15
+
16
+ export { MenuAction } from './menu'
17
+ export type { MenuActionProps } from './menu'
18
+
19
+ export { SplitView } from './split-view'
20
+ export type { SplitViewProps, SplitViewColumnProps } from './split-view'
@@ -0,0 +1,28 @@
1
+ import { Platform, requireNativeComponent, type ViewProps } from 'react-native'
2
+ import type { MenuActionProps } from './types'
3
+
4
+ export type { MenuActionProps } from './types'
5
+
6
+ const isAvailable = Platform.OS === 'ios' && !Platform.isTV
7
+
8
+ const MenuActionNative = isAvailable
9
+ ? requireNativeComponent<
10
+ ViewProps &
11
+ Omit<MenuActionProps, 'image' | 'onSelected'> & {
12
+ imageSource?: any
13
+ onSelected?: (event: any) => void
14
+ }
15
+ >('VxrnMenuAction')
16
+ : null
17
+
18
+ export function MenuAction(props: MenuActionProps) {
19
+ if (!MenuActionNative) return null
20
+ const { image, onSelected, ...rest } = props
21
+ return (
22
+ <MenuActionNative
23
+ {...rest}
24
+ imageSource={image}
25
+ onSelected={onSelected ? () => onSelected() : undefined}
26
+ />
27
+ )
28
+ }
@@ -0,0 +1,7 @@
1
+ export type { MenuActionProps } from './types'
2
+
3
+ import type { MenuActionProps } from './types'
4
+
5
+ export function MenuAction(_props: MenuActionProps) {
6
+ return null
7
+ }
@@ -0,0 +1,32 @@
1
+ import type { ColorValue, ImageSourcePropType } from 'react-native'
2
+ import type { BasicTextStyle } from '../toolbar/types'
3
+
4
+ export interface MenuActionProps {
5
+ identifier: string
6
+ title: string
7
+ label?: string
8
+ icon?: string
9
+ xcassetName?: string
10
+ image?: ImageSourcePropType
11
+ imageRenderingMode?: 'template' | 'original'
12
+ children?: React.ReactNode
13
+ disabled?: boolean
14
+ destructive?: boolean
15
+ discoverabilityLabel?: string
16
+ subtitle?: string
17
+ accessibilityLabel?: string
18
+ accessibilityHint?: string
19
+ displayAsPalette?: boolean
20
+ displayInline?: boolean
21
+ preferredElementSize?: 'auto' | 'small' | 'medium' | 'large'
22
+ isOn?: boolean
23
+ keepPresented?: boolean
24
+ hidden?: boolean
25
+ tintColor?: ColorValue
26
+ barButtonItemStyle?: 'plain' | 'prominent'
27
+ sharesBackground?: boolean
28
+ hidesSharedBackground?: boolean
29
+ onSelected?: () => void
30
+ singleSelection?: boolean
31
+ titleStyle?: BasicTextStyle
32
+ }
@@ -0,0 +1,2 @@
1
+ export { SplitView } from './split-view'
2
+ export type { SplitViewProps, SplitViewColumnProps } from './split-view'
@@ -0,0 +1,80 @@
1
+ // adapted from expo-router (MIT license) - https://github.com/expo/expo
2
+ import React, { createContext, isValidElement, useContext, type ReactNode } from 'react'
3
+ import { Platform } from 'react-native'
4
+ import { SafeAreaProvider } from 'react-native-safe-area-context'
5
+ import { Split, type SplitHostProps } from 'react-native-screens/experimental'
6
+
7
+ const IsWithinSplitViewContext = createContext(false)
8
+
9
+ export interface SplitViewColumnProps {
10
+ children?: React.ReactNode
11
+ }
12
+
13
+ function SplitViewColumnComponent(props: SplitViewColumnProps) {
14
+ return (
15
+ <Split.Column>
16
+ <SafeAreaProvider>{props.children}</SafeAreaProvider>
17
+ </Split.Column>
18
+ )
19
+ }
20
+
21
+ function SplitViewInspectorComponent(props: SplitViewColumnProps) {
22
+ return <Split.Inspector>{props.children}</Split.Inspector>
23
+ }
24
+
25
+ export interface SplitViewProps extends Omit<SplitHostProps, 'children'> {
26
+ children?: ReactNode
27
+ /** slot component to render for the main content area */
28
+ slot?: React.ComponentType
29
+ }
30
+
31
+ function SplitViewNavigator({
32
+ children,
33
+ slot: Slot,
34
+ ...splitViewHostProps
35
+ }: SplitViewProps) {
36
+ if (useContext(IsWithinSplitViewContext)) {
37
+ throw new Error('There can only be one SplitView in the navigation hierarchy.')
38
+ }
39
+
40
+ if (Platform.OS !== 'ios') {
41
+ console.warn('SplitView is only supported on iOS.')
42
+ return Slot ? <Slot /> : null
43
+ }
44
+
45
+ const allChildrenArray = React.Children.toArray(children)
46
+ const columnChildren = allChildrenArray.filter(
47
+ (child) => isValidElement(child) && child.type === SplitViewColumnComponent
48
+ )
49
+ const inspectorChildren = allChildrenArray.filter(
50
+ (child) => isValidElement(child) && child.type === SplitViewInspectorComponent
51
+ )
52
+ const numberOfSidebars = columnChildren.length
53
+
54
+ if (numberOfSidebars > 2) {
55
+ throw new Error('There can only be two SplitView.Column in the SplitView.')
56
+ }
57
+
58
+ if (numberOfSidebars + inspectorChildren.length === 0) {
59
+ console.warn('No SplitView.Column found in SplitView.')
60
+ return Slot ? <Slot /> : null
61
+ }
62
+
63
+ return (
64
+ <IsWithinSplitViewContext value>
65
+ <Split.Host
66
+ key={numberOfSidebars + inspectorChildren.length}
67
+ {...splitViewHostProps}
68
+ >
69
+ {columnChildren}
70
+ <Split.Column>{Slot ? <Slot /> : null}</Split.Column>
71
+ {inspectorChildren}
72
+ </Split.Host>
73
+ </IsWithinSplitViewContext>
74
+ )
75
+ }
76
+
77
+ export const SplitView = Object.assign(SplitViewNavigator, {
78
+ Column: SplitViewColumnComponent,
79
+ Inspector: SplitViewInspectorComponent,
80
+ })
@@ -0,0 +1,39 @@
1
+ import { requireNativeComponent, type ViewProps } from 'react-native'
2
+
3
+ import type { ToolbarHostProps, ToolbarItemProps } from './types'
4
+
5
+ export type { ToolbarHostProps, ToolbarItemProps, BasicTextStyle } from './types'
6
+
7
+ const ToolbarHostNative = requireNativeComponent<
8
+ ViewProps & { children?: React.ReactNode }
9
+ >('VxrnToolbarHost')
10
+
11
+ export function ToolbarHost(props: ToolbarHostProps) {
12
+ return (
13
+ <ToolbarHostNative
14
+ {...props}
15
+ style={{
16
+ position: 'absolute',
17
+ top: 0,
18
+ left: 0,
19
+ width: 1,
20
+ height: 1,
21
+ backgroundColor: 'transparent',
22
+ }}
23
+ />
24
+ )
25
+ }
26
+
27
+ const ToolbarItemNative: React.ComponentType<any> =
28
+ requireNativeComponent('VxrnToolbarItem')
29
+
30
+ export function ToolbarItem(props: ToolbarItemProps) {
31
+ const { image, onSelected, ...rest } = props
32
+ return (
33
+ <ToolbarItemNative
34
+ {...rest}
35
+ imageSource={image}
36
+ onSelected={onSelected ? () => onSelected() : undefined}
37
+ />
38
+ )
39
+ }
@@ -0,0 +1,11 @@
1
+ export type { ToolbarHostProps, ToolbarItemProps, BasicTextStyle } from './types'
2
+
3
+ import type { ToolbarHostProps, ToolbarItemProps } from './types'
4
+
5
+ export function ToolbarHost(_props: ToolbarHostProps) {
6
+ return null
7
+ }
8
+
9
+ export function ToolbarItem(_props: ToolbarItemProps) {
10
+ return null
11
+ }
@@ -0,0 +1,39 @@
1
+ import type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native'
2
+
3
+ export interface BasicTextStyle {
4
+ fontFamily?: string
5
+ fontSize?: number
6
+ fontWeight?: TextStyle['fontWeight']
7
+ color?: ColorValue
8
+ }
9
+
10
+ export interface ToolbarHostProps {
11
+ children?: React.ReactNode
12
+ }
13
+
14
+ export interface ToolbarItemProps {
15
+ children?: React.ReactNode
16
+ identifier: string
17
+ title?: string
18
+ systemImageName?: string
19
+ xcassetName?: string
20
+ image?: ImageSourcePropType
21
+ imageRenderingMode?: 'template' | 'original'
22
+ type?: 'normal' | 'fixedSpacer' | 'fluidSpacer' | 'searchBar'
23
+ tintColor?: ColorValue
24
+ hidesSharedBackground?: boolean
25
+ sharesBackground?: boolean
26
+ barButtonItemStyle?: 'plain' | 'prominent'
27
+ width?: number
28
+ hidden?: boolean
29
+ selected?: boolean
30
+ badgeConfiguration?: {
31
+ value?: string
32
+ backgroundColor?: ColorValue
33
+ } & BasicTextStyle
34
+ titleStyle?: BasicTextStyle
35
+ accessibilityLabel?: string
36
+ accessibilityHint?: string
37
+ disabled?: boolean
38
+ onSelected?: () => void
39
+ }
@@ -0,0 +1,56 @@
1
+ import { Platform, requireNativeComponent, type ViewProps } from 'react-native'
2
+
3
+ import type {
4
+ ZoomTransitionSourceProps,
5
+ ZoomTransitionEnablerProps,
6
+ ZoomTransitionAlignmentRectDetectorProps,
7
+ } from './types'
8
+
9
+ export type {
10
+ ZoomTransitionSourceProps,
11
+ ZoomTransitionEnablerProps,
12
+ ZoomTransitionAlignmentRectDetectorProps,
13
+ DismissalBoundsRect,
14
+ SourceAlignmentRect,
15
+ } from './types'
16
+
17
+ const isAvailable = Platform.OS === 'ios' && !Platform.isTV
18
+
19
+ const ZoomEnablerNative = isAvailable
20
+ ? requireNativeComponent<
21
+ ViewProps & { zoomTransitionSourceIdentifier: string; dismissalBoundsRect?: any }
22
+ >('VxrnZoomEnabler')
23
+ : null
24
+
25
+ export function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps) {
26
+ if (!ZoomEnablerNative) return null
27
+ return (
28
+ <ZoomEnablerNative
29
+ {...props}
30
+ collapsable={false}
31
+ style={{ position: 'absolute', width: 1, height: 1, opacity: 0 }}
32
+ />
33
+ )
34
+ }
35
+
36
+ const ZoomSourceNative = isAvailable
37
+ ? requireNativeComponent<ViewProps & ZoomTransitionSourceProps>('VxrnZoomSource')
38
+ : null
39
+
40
+ export function ZoomTransitionSource(props: ZoomTransitionSourceProps) {
41
+ if (!ZoomSourceNative) return null
42
+ return <ZoomSourceNative {...props} collapsable={false} style={{ display: 'flex' }} />
43
+ }
44
+
45
+ const ZoomAlignmentNative = isAvailable
46
+ ? requireNativeComponent<ViewProps & { identifier: string }>('VxrnZoomAlignment')
47
+ : null
48
+
49
+ export function ZoomTransitionAlignmentRectDetector(
50
+ props: ZoomTransitionAlignmentRectDetectorProps
51
+ ) {
52
+ if (!ZoomAlignmentNative) return null
53
+ return (
54
+ <ZoomAlignmentNative {...props} collapsable={false} style={{ display: 'flex' }} />
55
+ )
56
+ }
@@ -0,0 +1,28 @@
1
+ // web stubs - native features return null on web
2
+ export type {
3
+ ZoomTransitionSourceProps,
4
+ ZoomTransitionEnablerProps,
5
+ ZoomTransitionAlignmentRectDetectorProps,
6
+ DismissalBoundsRect,
7
+ SourceAlignmentRect,
8
+ } from './types'
9
+
10
+ import type {
11
+ ZoomTransitionSourceProps,
12
+ ZoomTransitionEnablerProps,
13
+ ZoomTransitionAlignmentRectDetectorProps,
14
+ } from './types'
15
+
16
+ export function ZoomTransitionEnabler(_props: ZoomTransitionEnablerProps) {
17
+ return null
18
+ }
19
+
20
+ export function ZoomTransitionSource(_props: ZoomTransitionSourceProps) {
21
+ return null
22
+ }
23
+
24
+ export function ZoomTransitionAlignmentRectDetector(
25
+ _props: ZoomTransitionAlignmentRectDetectorProps
26
+ ) {
27
+ return null
28
+ }