@react-navigation/elements 2.0.0-rc.2 → 2.0.0-rc.21

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 (345) hide show
  1. package/lib/commonjs/Background.js +4 -3
  2. package/lib/commonjs/Background.js.map +1 -1
  3. package/lib/commonjs/Button.js +29 -56
  4. package/lib/commonjs/Button.js.map +1 -1
  5. package/lib/commonjs/Header/Header.js +143 -62
  6. package/lib/commonjs/Header/Header.js.map +1 -1
  7. package/lib/commonjs/Header/HeaderBackButton.js +74 -76
  8. package/lib/commonjs/Header/HeaderBackButton.js.map +1 -1
  9. package/lib/commonjs/Header/HeaderBackContext.js +1 -1
  10. package/lib/commonjs/Header/HeaderBackground.js +9 -7
  11. package/lib/commonjs/Header/HeaderBackground.js.map +1 -1
  12. package/lib/commonjs/Header/HeaderButton.js +6 -7
  13. package/lib/commonjs/Header/HeaderButton.js.map +1 -1
  14. package/lib/commonjs/Header/HeaderHeightContext.js +1 -1
  15. package/lib/commonjs/Header/HeaderIcon.js +44 -0
  16. package/lib/commonjs/Header/HeaderIcon.js.map +1 -0
  17. package/lib/commonjs/Header/HeaderSearchBar.js +267 -0
  18. package/lib/commonjs/Header/HeaderSearchBar.js.map +1 -0
  19. package/lib/commonjs/Header/HeaderShownContext.js +1 -1
  20. package/lib/commonjs/Header/HeaderTitle.js +5 -8
  21. package/lib/commonjs/Header/HeaderTitle.js.map +1 -1
  22. package/lib/commonjs/Header/useHeaderHeight.js +1 -1
  23. package/lib/commonjs/Label/Label.js +6 -9
  24. package/lib/commonjs/Label/Label.js.map +1 -1
  25. package/lib/commonjs/MaskedView.android.js +1 -1
  26. package/lib/commonjs/MaskedView.ios.js +1 -1
  27. package/lib/commonjs/MaskedViewNative.js +5 -1
  28. package/lib/commonjs/MaskedViewNative.js.map +1 -1
  29. package/lib/commonjs/MissingIcon.js +6 -9
  30. package/lib/commonjs/MissingIcon.js.map +1 -1
  31. package/lib/commonjs/PlatformPressable.js +61 -6
  32. package/lib/commonjs/PlatformPressable.js.map +1 -1
  33. package/lib/commonjs/ResourceSavingView.js +19 -15
  34. package/lib/commonjs/ResourceSavingView.js.map +1 -1
  35. package/lib/commonjs/SafeAreaProviderCompat.js +26 -19
  36. package/lib/commonjs/SafeAreaProviderCompat.js.map +1 -1
  37. package/lib/commonjs/Screen.js +38 -28
  38. package/lib/commonjs/Screen.js.map +1 -1
  39. package/lib/commonjs/Text.js +6 -7
  40. package/lib/commonjs/Text.js.map +1 -1
  41. package/lib/commonjs/assets/back-icon-mask.png +0 -0
  42. package/lib/commonjs/assets/back-icon@4x.ios.png +0 -0
  43. package/lib/commonjs/assets/clear-icon.png +0 -0
  44. package/lib/commonjs/assets/clear-icon@1x.png +0 -0
  45. package/lib/commonjs/assets/clear-icon@2x.png +0 -0
  46. package/lib/commonjs/assets/clear-icon@3x.png +0 -0
  47. package/lib/commonjs/assets/clear-icon@4x.png +0 -0
  48. package/lib/commonjs/assets/close-icon.png +0 -0
  49. package/lib/commonjs/assets/close-icon@1x.png +0 -0
  50. package/lib/commonjs/assets/close-icon@2x.png +0 -0
  51. package/lib/commonjs/assets/close-icon@3x.png +0 -0
  52. package/lib/commonjs/assets/close-icon@4x.png +0 -0
  53. package/lib/commonjs/assets/search-icon.png +0 -0
  54. package/lib/commonjs/assets/search-icon@1x.android.png +0 -0
  55. package/lib/commonjs/assets/search-icon@1x.ios.png +0 -0
  56. package/lib/commonjs/assets/search-icon@2x.android.png +0 -0
  57. package/lib/commonjs/assets/search-icon@2x.ios.png +0 -0
  58. package/lib/commonjs/assets/search-icon@3x.android.png +0 -0
  59. package/lib/commonjs/assets/search-icon@3x.ios.png +0 -0
  60. package/lib/commonjs/assets/search-icon@4x.android.png +0 -0
  61. package/lib/commonjs/assets/search-icon@4x.ios.png +0 -0
  62. package/lib/commonjs/index.js +30 -28
  63. package/lib/commonjs/index.js.map +1 -1
  64. package/lib/commonjs/package.json +1 -0
  65. package/lib/module/Background.js +6 -3
  66. package/lib/module/Background.js.map +1 -1
  67. package/lib/module/Button.js +31 -56
  68. package/lib/module/Button.js.map +1 -1
  69. package/lib/module/Header/Header.js +144 -62
  70. package/lib/module/Header/Header.js.map +1 -1
  71. package/lib/module/Header/HeaderBackButton.js +75 -76
  72. package/lib/module/Header/HeaderBackButton.js.map +1 -1
  73. package/lib/module/Header/HeaderBackContext.js +3 -1
  74. package/lib/module/Header/HeaderBackContext.js.map +1 -1
  75. package/lib/module/Header/HeaderBackground.js +11 -7
  76. package/lib/module/Header/HeaderBackground.js.map +1 -1
  77. package/lib/module/Header/HeaderButton.js +8 -5
  78. package/lib/module/Header/HeaderButton.js.map +1 -1
  79. package/lib/module/Header/HeaderHeightContext.js +3 -1
  80. package/lib/module/Header/HeaderHeightContext.js.map +1 -1
  81. package/lib/module/Header/HeaderIcon.js +39 -0
  82. package/lib/module/Header/HeaderIcon.js.map +1 -0
  83. package/lib/module/Header/HeaderSearchBar.js +260 -0
  84. package/lib/module/Header/HeaderSearchBar.js.map +1 -0
  85. package/lib/module/Header/HeaderShownContext.js +3 -1
  86. package/lib/module/Header/HeaderShownContext.js.map +1 -1
  87. package/lib/module/Header/HeaderTitle.js +7 -6
  88. package/lib/module/Header/HeaderTitle.js.map +1 -1
  89. package/lib/module/Header/getDefaultHeaderHeight.js +2 -0
  90. package/lib/module/Header/getDefaultHeaderHeight.js.map +1 -1
  91. package/lib/module/Header/getHeaderTitle.js +2 -0
  92. package/lib/module/Header/getHeaderTitle.js.map +1 -1
  93. package/lib/module/Header/useHeaderHeight.js +3 -1
  94. package/lib/module/Header/useHeaderHeight.js.map +1 -1
  95. package/lib/module/Label/Label.js +8 -7
  96. package/lib/module/Label/Label.js.map +1 -1
  97. package/lib/module/Label/getLabel.js +2 -0
  98. package/lib/module/Label/getLabel.js.map +1 -1
  99. package/lib/module/MaskedView.android.js +3 -1
  100. package/lib/module/MaskedView.android.js.map +1 -1
  101. package/lib/module/MaskedView.ios.js +3 -1
  102. package/lib/module/MaskedView.ios.js.map +1 -1
  103. package/lib/module/MaskedView.js +2 -0
  104. package/lib/module/MaskedView.js.map +1 -1
  105. package/lib/module/MaskedViewNative.js +7 -1
  106. package/lib/module/MaskedViewNative.js.map +1 -1
  107. package/lib/module/MissingIcon.js +9 -7
  108. package/lib/module/MissingIcon.js.map +1 -1
  109. package/lib/module/PlatformPressable.js +63 -6
  110. package/lib/module/PlatformPressable.js.map +1 -1
  111. package/lib/module/ResourceSavingView.js +21 -15
  112. package/lib/module/ResourceSavingView.js.map +1 -1
  113. package/lib/module/SafeAreaProviderCompat.js +28 -19
  114. package/lib/module/SafeAreaProviderCompat.js.map +1 -1
  115. package/lib/module/Screen.js +40 -28
  116. package/lib/module/Screen.js.map +1 -1
  117. package/lib/module/Text.js +7 -6
  118. package/lib/module/Text.js.map +1 -1
  119. package/lib/module/assets/back-icon-mask.png +0 -0
  120. package/lib/module/assets/back-icon@4x.ios.png +0 -0
  121. package/lib/module/assets/clear-icon.png +0 -0
  122. package/lib/module/assets/clear-icon@1x.png +0 -0
  123. package/lib/module/assets/clear-icon@2x.png +0 -0
  124. package/lib/module/assets/clear-icon@3x.png +0 -0
  125. package/lib/module/assets/clear-icon@4x.png +0 -0
  126. package/lib/module/assets/close-icon.png +0 -0
  127. package/lib/module/assets/close-icon@1x.png +0 -0
  128. package/lib/module/assets/close-icon@2x.png +0 -0
  129. package/lib/module/assets/close-icon@3x.png +0 -0
  130. package/lib/module/assets/close-icon@4x.png +0 -0
  131. package/lib/module/assets/search-icon.png +0 -0
  132. package/lib/module/assets/search-icon@1x.android.png +0 -0
  133. package/lib/module/assets/search-icon@1x.ios.png +0 -0
  134. package/lib/module/assets/search-icon@2x.android.png +0 -0
  135. package/lib/module/assets/search-icon@2x.ios.png +0 -0
  136. package/lib/module/assets/search-icon@3x.android.png +0 -0
  137. package/lib/module/assets/search-icon@3x.ios.png +0 -0
  138. package/lib/module/assets/search-icon@4x.android.png +0 -0
  139. package/lib/module/assets/search-icon@4x.ios.png +0 -0
  140. package/lib/module/getDefaultSidebarWidth.js +2 -0
  141. package/lib/module/getDefaultSidebarWidth.js.map +1 -1
  142. package/lib/module/getNamedContext.js +2 -0
  143. package/lib/module/getNamedContext.js.map +1 -1
  144. package/lib/module/index.js +31 -28
  145. package/lib/module/index.js.map +1 -1
  146. package/lib/module/package.json +1 -0
  147. package/lib/module/types.js +2 -0
  148. package/lib/typescript/commonjs/package.json +1 -0
  149. package/lib/typescript/{src → commonjs/src}/Background.d.ts +1 -1
  150. package/lib/typescript/commonjs/src/Background.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/src/Header/Header.d.ts +31 -0
  153. package/lib/typescript/commonjs/src/Header/Header.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/src/Header/HeaderBackButton.d.ts +3 -0
  155. package/lib/typescript/commonjs/src/Header/HeaderBackButton.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/src/Header/HeaderBackContext.d.ts.map +1 -0
  157. package/lib/typescript/{src → commonjs/src}/Header/HeaderBackground.d.ts +1 -1
  158. package/lib/typescript/commonjs/src/Header/HeaderBackground.d.ts.map +1 -0
  159. package/lib/typescript/{src → commonjs/src}/Header/HeaderButton.d.ts +1 -2
  160. package/lib/typescript/commonjs/src/Header/HeaderButton.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/Header/HeaderHeightContext.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/src/Header/HeaderIcon.d.ts +5 -0
  163. package/lib/typescript/commonjs/src/Header/HeaderIcon.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/src/Header/HeaderSearchBar.d.ts +10 -0
  165. package/lib/typescript/commonjs/src/Header/HeaderSearchBar.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/src/Header/HeaderShownContext.d.ts.map +1 -0
  167. package/lib/typescript/{src → commonjs/src}/Header/HeaderTitle.d.ts +1 -2
  168. package/lib/typescript/commonjs/src/Header/HeaderTitle.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/Header/getDefaultHeaderHeight.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/src/Header/getHeaderTitle.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/Header/useHeaderHeight.d.ts.map +1 -0
  172. package/lib/typescript/{src → commonjs/src}/Label/Label.d.ts +1 -2
  173. package/lib/typescript/commonjs/src/Label/Label.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/src/Label/getLabel.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/MaskedView.android.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/src/MaskedView.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/MaskedView.ios.d.ts.map +1 -0
  178. package/lib/typescript/{src → commonjs/src}/MaskedViewNative.d.ts +1 -1
  179. package/lib/typescript/commonjs/src/MaskedViewNative.d.ts.map +1 -0
  180. package/lib/typescript/{src → commonjs/src}/MissingIcon.d.ts +1 -2
  181. package/lib/typescript/commonjs/src/MissingIcon.d.ts.map +1 -0
  182. package/lib/typescript/{src → commonjs/src}/PlatformPressable.d.ts +8 -1
  183. package/lib/typescript/commonjs/src/PlatformPressable.d.ts.map +1 -0
  184. package/lib/typescript/{src → commonjs/src}/ResourceSavingView.d.ts +1 -1
  185. package/lib/typescript/commonjs/src/ResourceSavingView.d.ts.map +1 -0
  186. package/lib/typescript/{src → commonjs/src}/SafeAreaProviderCompat.d.ts +1 -1
  187. package/lib/typescript/commonjs/src/SafeAreaProviderCompat.d.ts.map +1 -0
  188. package/lib/typescript/{src → commonjs/src}/Screen.d.ts +1 -1
  189. package/lib/typescript/commonjs/src/Screen.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/Text.d.ts +3 -0
  191. package/lib/typescript/commonjs/src/Text.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/src/getDefaultSidebarWidth.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/src/getNamedContext.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  195. package/lib/typescript/{src → commonjs/src}/types.d.ts +73 -10
  196. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
  198. package/lib/typescript/module/package.json +1 -0
  199. package/lib/typescript/module/src/Background.d.ts +9 -0
  200. package/lib/typescript/module/src/Background.d.ts.map +1 -0
  201. package/lib/typescript/module/src/Button.d.ts +13 -0
  202. package/lib/typescript/module/src/Button.d.ts.map +1 -0
  203. package/lib/typescript/module/src/Header/Header.d.ts +31 -0
  204. package/lib/typescript/module/src/Header/Header.d.ts.map +1 -0
  205. package/lib/typescript/module/src/Header/HeaderBackButton.d.ts +3 -0
  206. package/lib/typescript/module/src/Header/HeaderBackButton.d.ts.map +1 -0
  207. package/lib/typescript/module/src/Header/HeaderBackContext.d.ts +5 -0
  208. package/lib/typescript/module/src/Header/HeaderBackContext.d.ts.map +1 -0
  209. package/lib/typescript/module/src/Header/HeaderBackground.d.ts +9 -0
  210. package/lib/typescript/module/src/Header/HeaderBackground.d.ts.map +1 -0
  211. package/lib/typescript/module/src/Header/HeaderButton.d.ts +3 -0
  212. package/lib/typescript/module/src/Header/HeaderButton.d.ts.map +1 -0
  213. package/lib/typescript/module/src/Header/HeaderHeightContext.d.ts +2 -0
  214. package/lib/typescript/module/src/Header/HeaderHeightContext.d.ts.map +1 -0
  215. package/lib/typescript/module/src/Header/HeaderIcon.d.ts +5 -0
  216. package/lib/typescript/module/src/Header/HeaderIcon.d.ts.map +1 -0
  217. package/lib/typescript/module/src/Header/HeaderSearchBar.d.ts +10 -0
  218. package/lib/typescript/module/src/Header/HeaderSearchBar.d.ts.map +1 -0
  219. package/lib/typescript/module/src/Header/HeaderShownContext.d.ts +2 -0
  220. package/lib/typescript/module/src/Header/HeaderShownContext.d.ts.map +1 -0
  221. package/lib/typescript/module/src/Header/HeaderTitle.d.ts +9 -0
  222. package/lib/typescript/module/src/Header/HeaderTitle.d.ts.map +1 -0
  223. package/lib/typescript/module/src/Header/getDefaultHeaderHeight.d.ts +3 -0
  224. package/lib/typescript/module/src/Header/getDefaultHeaderHeight.d.ts.map +1 -0
  225. package/lib/typescript/module/src/Header/getHeaderTitle.d.ts +6 -0
  226. package/lib/typescript/module/src/Header/getHeaderTitle.d.ts.map +1 -0
  227. package/lib/typescript/module/src/Header/useHeaderHeight.d.ts +2 -0
  228. package/lib/typescript/module/src/Header/useHeaderHeight.d.ts.map +1 -0
  229. package/lib/typescript/module/src/Label/Label.d.ts +9 -0
  230. package/lib/typescript/module/src/Label/Label.d.ts.map +1 -0
  231. package/lib/typescript/module/src/Label/getLabel.d.ts +5 -0
  232. package/lib/typescript/module/src/Label/getLabel.d.ts.map +1 -0
  233. package/lib/typescript/module/src/MaskedView.android.d.ts +2 -0
  234. package/lib/typescript/module/src/MaskedView.android.d.ts.map +1 -0
  235. package/lib/typescript/module/src/MaskedView.d.ts +11 -0
  236. package/lib/typescript/module/src/MaskedView.d.ts.map +1 -0
  237. package/lib/typescript/module/src/MaskedView.ios.d.ts +2 -0
  238. package/lib/typescript/module/src/MaskedView.ios.d.ts.map +1 -0
  239. package/lib/typescript/module/src/MaskedViewNative.d.ts +11 -0
  240. package/lib/typescript/module/src/MaskedViewNative.d.ts.map +1 -0
  241. package/lib/typescript/module/src/MissingIcon.d.ts +9 -0
  242. package/lib/typescript/module/src/MissingIcon.d.ts.map +1 -0
  243. package/lib/typescript/module/src/PlatformPressable.d.ts +21 -0
  244. package/lib/typescript/module/src/PlatformPressable.d.ts.map +1 -0
  245. package/lib/typescript/module/src/ResourceSavingView.d.ts +10 -0
  246. package/lib/typescript/module/src/ResourceSavingView.d.ts.map +1 -0
  247. package/lib/typescript/module/src/SafeAreaProviderCompat.d.ts +13 -0
  248. package/lib/typescript/module/src/SafeAreaProviderCompat.d.ts.map +1 -0
  249. package/lib/typescript/module/src/Screen.d.ts +18 -0
  250. package/lib/typescript/module/src/Screen.d.ts.map +1 -0
  251. package/lib/typescript/module/src/Text.d.ts +3 -0
  252. package/lib/typescript/module/src/Text.d.ts.map +1 -0
  253. package/lib/typescript/module/src/getDefaultSidebarWidth.d.ts +4 -0
  254. package/lib/typescript/module/src/getDefaultSidebarWidth.d.ts.map +1 -0
  255. package/lib/typescript/module/src/getNamedContext.d.ts +6 -0
  256. package/lib/typescript/module/src/getNamedContext.d.ts.map +1 -0
  257. package/lib/typescript/module/src/index.d.ts +25 -0
  258. package/lib/typescript/module/src/index.d.ts.map +1 -0
  259. package/lib/typescript/module/src/types.d.ts +289 -0
  260. package/lib/typescript/module/src/types.d.ts.map +1 -0
  261. package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
  262. package/package.json +42 -13
  263. package/src/Button.tsx +3 -40
  264. package/src/Header/Header.tsx +157 -60
  265. package/src/Header/HeaderBackButton.tsx +87 -81
  266. package/src/Header/HeaderBackground.tsx +3 -3
  267. package/src/Header/HeaderButton.tsx +0 -1
  268. package/src/Header/HeaderIcon.tsx +36 -0
  269. package/src/Header/HeaderSearchBar.tsx +283 -0
  270. package/src/Header/HeaderTitle.tsx +0 -1
  271. package/src/Label/Label.tsx +0 -1
  272. package/src/MissingIcon.tsx +3 -4
  273. package/src/PlatformPressable.tsx +71 -2
  274. package/src/SafeAreaProviderCompat.tsx +1 -0
  275. package/src/Screen.tsx +19 -14
  276. package/src/Text.tsx +1 -3
  277. package/src/assets/back-icon-mask.png +0 -0
  278. package/src/assets/back-icon@4x.ios.png +0 -0
  279. package/src/assets/clear-icon.png +0 -0
  280. package/src/assets/clear-icon@1x.png +0 -0
  281. package/src/assets/clear-icon@2x.png +0 -0
  282. package/src/assets/clear-icon@3x.png +0 -0
  283. package/src/assets/clear-icon@4x.png +0 -0
  284. package/src/assets/close-icon.png +0 -0
  285. package/src/assets/close-icon@1x.png +0 -0
  286. package/src/assets/close-icon@2x.png +0 -0
  287. package/src/assets/close-icon@3x.png +0 -0
  288. package/src/assets/close-icon@4x.png +0 -0
  289. package/src/assets/search-icon.png +0 -0
  290. package/src/assets/search-icon@1x.android.png +0 -0
  291. package/src/assets/search-icon@1x.ios.png +0 -0
  292. package/src/assets/search-icon@2x.android.png +0 -0
  293. package/src/assets/search-icon@2x.ios.png +0 -0
  294. package/src/assets/search-icon@3x.android.png +0 -0
  295. package/src/assets/search-icon@3x.ios.png +0 -0
  296. package/src/assets/search-icon@4x.android.png +0 -0
  297. package/src/assets/search-icon@4x.ios.png +0 -0
  298. package/src/index.tsx +11 -4
  299. package/src/types.tsx +77 -10
  300. package/lib/typescript/src/Background.d.ts.map +0 -1
  301. package/lib/typescript/src/Button.d.ts.map +0 -1
  302. package/lib/typescript/src/Header/Header.d.ts +0 -19
  303. package/lib/typescript/src/Header/Header.d.ts.map +0 -1
  304. package/lib/typescript/src/Header/HeaderBackButton.d.ts +0 -4
  305. package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +0 -1
  306. package/lib/typescript/src/Header/HeaderBackContext.d.ts.map +0 -1
  307. package/lib/typescript/src/Header/HeaderBackground.d.ts.map +0 -1
  308. package/lib/typescript/src/Header/HeaderButton.d.ts.map +0 -1
  309. package/lib/typescript/src/Header/HeaderHeightContext.d.ts.map +0 -1
  310. package/lib/typescript/src/Header/HeaderShownContext.d.ts.map +0 -1
  311. package/lib/typescript/src/Header/HeaderTitle.d.ts.map +0 -1
  312. package/lib/typescript/src/Header/getDefaultHeaderHeight.d.ts.map +0 -1
  313. package/lib/typescript/src/Header/getHeaderTitle.d.ts.map +0 -1
  314. package/lib/typescript/src/Header/useHeaderHeight.d.ts.map +0 -1
  315. package/lib/typescript/src/Label/Label.d.ts.map +0 -1
  316. package/lib/typescript/src/Label/getLabel.d.ts.map +0 -1
  317. package/lib/typescript/src/MaskedView.android.d.ts.map +0 -1
  318. package/lib/typescript/src/MaskedView.d.ts.map +0 -1
  319. package/lib/typescript/src/MaskedView.ios.d.ts.map +0 -1
  320. package/lib/typescript/src/MaskedViewNative.d.ts.map +0 -1
  321. package/lib/typescript/src/MissingIcon.d.ts.map +0 -1
  322. package/lib/typescript/src/PlatformPressable.d.ts.map +0 -1
  323. package/lib/typescript/src/ResourceSavingView.d.ts.map +0 -1
  324. package/lib/typescript/src/SafeAreaProviderCompat.d.ts.map +0 -1
  325. package/lib/typescript/src/Screen.d.ts.map +0 -1
  326. package/lib/typescript/src/Text.d.ts +0 -4
  327. package/lib/typescript/src/Text.d.ts.map +0 -1
  328. package/lib/typescript/src/getDefaultSidebarWidth.d.ts.map +0 -1
  329. package/lib/typescript/src/getNamedContext.d.ts.map +0 -1
  330. package/lib/typescript/src/index.d.ts.map +0 -1
  331. package/lib/typescript/src/types.d.ts.map +0 -1
  332. /package/lib/typescript/{src → commonjs/src}/Button.d.ts +0 -0
  333. /package/lib/typescript/{src → commonjs/src}/Header/HeaderBackContext.d.ts +0 -0
  334. /package/lib/typescript/{src → commonjs/src}/Header/HeaderHeightContext.d.ts +0 -0
  335. /package/lib/typescript/{src → commonjs/src}/Header/HeaderShownContext.d.ts +0 -0
  336. /package/lib/typescript/{src → commonjs/src}/Header/getDefaultHeaderHeight.d.ts +0 -0
  337. /package/lib/typescript/{src → commonjs/src}/Header/getHeaderTitle.d.ts +0 -0
  338. /package/lib/typescript/{src → commonjs/src}/Header/useHeaderHeight.d.ts +0 -0
  339. /package/lib/typescript/{src → commonjs/src}/Label/getLabel.d.ts +0 -0
  340. /package/lib/typescript/{src → commonjs/src}/MaskedView.android.d.ts +0 -0
  341. /package/lib/typescript/{src → commonjs/src}/MaskedView.d.ts +0 -0
  342. /package/lib/typescript/{src → commonjs/src}/MaskedView.ios.d.ts +0 -0
  343. /package/lib/typescript/{src → commonjs/src}/getDefaultSidebarWidth.d.ts +0 -0
  344. /package/lib/typescript/{src → commonjs/src}/getNamedContext.d.ts +0 -0
  345. /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
@@ -3,15 +3,19 @@ import * as React from 'react';
3
3
  import {
4
4
  Animated,
5
5
  Image,
6
- type LayoutChangeEvent,
7
6
  Platform,
7
+ type StyleProp,
8
8
  StyleSheet,
9
+ type TextStyle,
9
10
  View,
10
11
  } from 'react-native';
11
12
 
13
+ import backIcon from '../assets/back-icon.png';
14
+ import backIconMask from '../assets/back-icon-mask.png';
12
15
  import { MaskedView } from '../MaskedView';
13
16
  import type { HeaderBackButtonProps } from '../types';
14
17
  import { HeaderButton } from './HeaderButton';
18
+ import { HeaderIcon, ICON_MARGIN } from './HeaderIcon';
15
19
 
16
20
  export function HeaderBackButton({
17
21
  disabled,
@@ -19,13 +23,13 @@ export function HeaderBackButton({
19
23
  backImage,
20
24
  label,
21
25
  labelStyle,
22
- labelVisible = Platform.OS === 'ios',
26
+ displayMode = Platform.OS === 'ios' ? 'default' : 'minimal',
23
27
  onLabelLayout,
24
28
  onPress,
25
29
  pressColor,
26
30
  pressOpacity,
27
31
  screenLayout,
28
- tintColor: customTintColor,
32
+ tintColor,
29
33
  titleLayout,
30
34
  truncatedLabel = 'Back',
31
35
  accessibilityLabel = label && label !== 'Back' ? `${label}, back` : 'Go back',
@@ -36,85 +40,97 @@ export function HeaderBackButton({
36
40
  const { colors, fonts } = useTheme();
37
41
  const { direction } = useLocale();
38
42
 
39
- const [initialLabelWidth, setInitialLabelWidth] = React.useState<
40
- undefined | number
41
- >(undefined);
42
-
43
- const tintColor =
44
- customTintColor !== undefined
45
- ? customTintColor
46
- : Platform.select({
47
- ios: colors.primary,
48
- default: colors.text,
49
- });
50
-
51
- const handleLabelLayout = (e: LayoutChangeEvent) => {
52
- onLabelLayout?.(e);
53
-
54
- const { layout } = e.nativeEvent;
55
-
56
- setInitialLabelWidth(
57
- (direction === 'rtl' ? layout.y : layout.x) + layout.width
58
- );
59
- };
60
-
61
- const shouldTruncateLabel = () => {
62
- return (
63
- !label ||
64
- (initialLabelWidth &&
65
- titleLayout &&
66
- screenLayout &&
67
- (screenLayout.width - titleLayout.width) / 2 < initialLabelWidth + 26)
68
- );
69
- };
43
+ const [labelWidth, setLabelWidth] = React.useState<number | null>(null);
44
+ const [truncatedLabelWidth, setTruncatedLabelWidth] = React.useState<
45
+ number | null
46
+ >(null);
70
47
 
71
48
  const renderBackImage = () => {
72
49
  if (backImage) {
73
- return backImage({ tintColor });
50
+ return backImage({ tintColor: tintColor ?? colors.text });
74
51
  } else {
75
52
  return (
76
- <Image
53
+ <HeaderIcon
77
54
  style={[
78
55
  styles.icon,
79
- direction === 'rtl' && styles.flip,
80
- Boolean(labelVisible) && styles.iconWithLabel,
56
+ displayMode !== 'minimal' && styles.iconWithLabel,
81
57
  Boolean(tintColor) && { tintColor },
82
58
  ]}
83
- resizeMode="contain"
84
- source={require('../assets/back-icon.png')}
85
- fadeDuration={0}
59
+ source={backIcon}
86
60
  />
87
61
  );
88
62
  }
89
63
  };
90
64
 
91
65
  const renderLabel = () => {
92
- const leftLabelText = shouldTruncateLabel() ? truncatedLabel : label;
93
-
94
- if (!labelVisible || leftLabelText === undefined) {
66
+ if (displayMode === 'minimal') {
95
67
  return null;
96
68
  }
97
69
 
70
+ const availableSpace =
71
+ titleLayout && screenLayout
72
+ ? (screenLayout.width - titleLayout.width) / 2 -
73
+ (ICON_WIDTH + ICON_MARGIN)
74
+ : null;
75
+
76
+ const potentialLabelText =
77
+ displayMode === 'default' ? label : truncatedLabel;
78
+ const finalLabelText =
79
+ availableSpace && labelWidth && truncatedLabelWidth
80
+ ? availableSpace > labelWidth
81
+ ? potentialLabelText
82
+ : availableSpace > truncatedLabelWidth
83
+ ? truncatedLabel
84
+ : null
85
+ : potentialLabelText;
86
+
87
+ const commonStyle: Animated.WithAnimatedValue<StyleProp<TextStyle>> = [
88
+ fonts.regular,
89
+ styles.label,
90
+ labelStyle,
91
+ ];
92
+
93
+ const hiddenStyle: Animated.WithAnimatedValue<StyleProp<TextStyle>> = [
94
+ commonStyle,
95
+ {
96
+ position: 'absolute',
97
+ top: 0,
98
+ left: 0,
99
+ opacity: 0,
100
+ },
101
+ ];
102
+
98
103
  const labelElement = (
99
104
  <View style={styles.labelWrapper}>
100
- <Animated.Text
101
- accessible={false}
102
- onLayout={
103
- // This measurement is used to determine if we should truncate the label when it doesn't fit
104
- // Only measure it when label is not truncated because we want the measurement of full label
105
- leftLabelText === label ? handleLabelLayout : undefined
106
- }
107
- style={[
108
- tintColor ? { color: tintColor } : null,
109
- fonts.regular,
110
- styles.label,
111
- labelStyle,
112
- ]}
113
- numberOfLines={1}
114
- allowFontScaling={!!allowFontScaling}
115
- >
116
- {leftLabelText}
117
- </Animated.Text>
105
+ {label && displayMode === 'default' ? (
106
+ <Animated.Text
107
+ style={hiddenStyle}
108
+ numberOfLines={1}
109
+ onLayout={(e) => setLabelWidth(e.nativeEvent.layout.width)}
110
+ >
111
+ {label}
112
+ </Animated.Text>
113
+ ) : null}
114
+ {truncatedLabel ? (
115
+ <Animated.Text
116
+ style={hiddenStyle}
117
+ numberOfLines={1}
118
+ onLayout={(e) => setTruncatedLabelWidth(e.nativeEvent.layout.width)}
119
+ >
120
+ {truncatedLabel}
121
+ </Animated.Text>
122
+ ) : null}
123
+ {finalLabelText ? (
124
+ <Animated.Text
125
+ accessible={false}
126
+ onLayout={onLabelLayout}
127
+ style={[tintColor ? { color: tintColor } : null, commonStyle]}
128
+ numberOfLines={1}
129
+ allowFontScaling={!!allowFontScaling}
130
+ >
131
+ {finalLabelText}
132
+ </Animated.Text>
133
+ ) : null}
118
134
  </View>
119
135
  );
120
136
 
@@ -135,7 +151,7 @@ export function HeaderBackButton({
135
151
  ]}
136
152
  >
137
153
  <Image
138
- source={require('../assets/back-icon-mask.png')}
154
+ source={backIconMask}
139
155
  resizeMode="contain"
140
156
  style={[styles.iconMask, direction === 'rtl' && styles.flip]}
141
157
  />
@@ -173,6 +189,9 @@ export function HeaderBackButton({
173
189
  );
174
190
  }
175
191
 
192
+ const ICON_WIDTH = Platform.OS === 'ios' ? 13 : 24;
193
+ const ICON_MARGIN_END = Platform.OS === 'ios' ? 22 : 3;
194
+
176
195
  const styles = StyleSheet.create({
177
196
  container: {
178
197
  paddingHorizontal: 0,
@@ -196,25 +215,12 @@ const styles = StyleSheet.create({
196
215
  // Otherwise it messes with the measurement of the label
197
216
  flexDirection: 'row',
198
217
  alignItems: 'flex-start',
199
- ...Platform.select({
200
- ios: { marginEnd: 8 },
201
- default: { marginEnd: 3 },
202
- }),
218
+ marginEnd: ICON_MARGIN,
219
+ },
220
+ icon: {
221
+ width: ICON_WIDTH,
222
+ marginEnd: ICON_MARGIN_END,
203
223
  },
204
- icon: Platform.select({
205
- ios: {
206
- height: 21,
207
- width: 13,
208
- marginStart: 8,
209
- marginEnd: 22,
210
- marginVertical: 8,
211
- },
212
- default: {
213
- height: 24,
214
- width: 24,
215
- margin: 3,
216
- },
217
- }),
218
224
  iconWithLabel:
219
225
  Platform.OS === 'ios'
220
226
  ? {
@@ -15,7 +15,7 @@ type Props = Omit<ViewProps, 'style'> & {
15
15
  };
16
16
 
17
17
  export function HeaderBackground({ style, ...rest }: Props) {
18
- const { colors } = useTheme();
18
+ const { colors, dark } = useTheme();
19
19
 
20
20
  return (
21
21
  <Animated.View
@@ -24,7 +24,7 @@ export function HeaderBackground({ style, ...rest }: Props) {
24
24
  {
25
25
  backgroundColor: colors.card,
26
26
  borderBottomColor: colors.border,
27
- shadowColor: colors.border,
27
+ shadowColor: dark ? 'rgba(255, 255, 255, 0.45)' : 'rgba(0, 0, 0, 1)',
28
28
  },
29
29
  style,
30
30
  ]}
@@ -41,7 +41,7 @@ const styles = StyleSheet.create({
41
41
  elevation: 4,
42
42
  },
43
43
  ios: {
44
- shadowOpacity: 0.85,
44
+ shadowOpacity: 0.3,
45
45
  shadowRadius: 0,
46
46
  shadowOffset: {
47
47
  width: 0,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { Platform, StyleSheet } from 'react-native';
3
2
 
4
3
  import { PlatformPressable } from '../PlatformPressable';
@@ -0,0 +1,36 @@
1
+ import { useLocale, useTheme } from '@react-navigation/native';
2
+ import { Image, type ImageProps, Platform, StyleSheet } from 'react-native';
3
+
4
+ export function HeaderIcon({ source, style, ...rest }: ImageProps) {
5
+ const { colors } = useTheme();
6
+ const { direction } = useLocale();
7
+
8
+ return (
9
+ <Image
10
+ source={source}
11
+ resizeMode="contain"
12
+ fadeDuration={0}
13
+ style={[
14
+ styles.icon,
15
+ direction === 'rtl' && styles.flip,
16
+ { tintColor: colors.text },
17
+ style,
18
+ ]}
19
+ {...rest}
20
+ />
21
+ );
22
+ }
23
+
24
+ export const ICON_SIZE = Platform.OS === 'ios' ? 21 : 24;
25
+ export const ICON_MARGIN = Platform.OS === 'ios' ? 8 : 3;
26
+
27
+ const styles = StyleSheet.create({
28
+ icon: {
29
+ width: ICON_SIZE,
30
+ height: ICON_SIZE,
31
+ margin: ICON_MARGIN,
32
+ },
33
+ flip: {
34
+ transform: 'scaleX(-1)',
35
+ },
36
+ });
@@ -0,0 +1,283 @@
1
+ import { useNavigation, useTheme } from '@react-navigation/native';
2
+ import Color from 'color';
3
+ import * as React from 'react';
4
+ import {
5
+ Animated,
6
+ Image,
7
+ Platform,
8
+ type StyleProp,
9
+ StyleSheet,
10
+ TextInput,
11
+ View,
12
+ type ViewStyle,
13
+ } from 'react-native';
14
+
15
+ import clearIcon from '../assets/clear-icon.png';
16
+ import closeIcon from '../assets/close-icon.png';
17
+ import searchIcon from '../assets/search-icon.png';
18
+ import { PlatformPressable } from '../PlatformPressable';
19
+ import { Text } from '../Text';
20
+ import type { HeaderOptions } from '../types';
21
+ import { HeaderButton } from './HeaderButton';
22
+ import { HeaderIcon } from './HeaderIcon';
23
+
24
+ type Props = HeaderOptions['headerSearchBarOptions'] & {
25
+ visible: boolean;
26
+ onClose: () => void;
27
+ style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
28
+ };
29
+
30
+ const INPUT_TYPE_TO_MODE = {
31
+ text: 'text',
32
+ number: 'numeric',
33
+ phone: 'tel',
34
+ email: 'email',
35
+ } as const;
36
+
37
+ export function HeaderSearchBar({
38
+ visible,
39
+ inputType,
40
+ autoFocus = true,
41
+ placeholder = 'Search',
42
+ cancelButtonText = 'Cancel',
43
+ onChangeText,
44
+ onClose,
45
+ style,
46
+ ...rest
47
+ }: Props) {
48
+ const navigation = useNavigation();
49
+ const { dark, colors, fonts } = useTheme();
50
+ const [value, setValue] = React.useState('');
51
+ const [rendered, setRendered] = React.useState(visible);
52
+ const [visibleAnim] = React.useState(
53
+ () => new Animated.Value(visible ? 1 : 0)
54
+ );
55
+ const [clearVisibleAnim] = React.useState(() => new Animated.Value(0));
56
+
57
+ const visibleValueRef = React.useRef(visible);
58
+ const clearVisibleValueRef = React.useRef(false);
59
+ const inputRef = React.useRef<TextInput>(null);
60
+
61
+ React.useEffect(() => {
62
+ // Avoid act warning in tests just by rendering header
63
+ if (visible === visibleValueRef.current) {
64
+ return;
65
+ }
66
+
67
+ Animated.timing(visibleAnim, {
68
+ toValue: visible ? 1 : 0,
69
+ duration: 100,
70
+ useNativeDriver: true,
71
+ }).start(({ finished }) => {
72
+ if (finished) {
73
+ setRendered(visible);
74
+ visibleValueRef.current = visible;
75
+ }
76
+ });
77
+
78
+ return () => {
79
+ visibleAnim.stopAnimation();
80
+ };
81
+ }, [visible, visibleAnim]);
82
+
83
+ const hasText = value !== '';
84
+
85
+ React.useEffect(() => {
86
+ if (clearVisibleValueRef.current === hasText) {
87
+ return;
88
+ }
89
+
90
+ Animated.timing(clearVisibleAnim, {
91
+ toValue: hasText ? 1 : 0,
92
+ duration: 100,
93
+ useNativeDriver: true,
94
+ }).start(({ finished }) => {
95
+ if (finished) {
96
+ clearVisibleValueRef.current = hasText;
97
+ }
98
+ });
99
+ }, [clearVisibleAnim, hasText]);
100
+
101
+ const onClear = React.useCallback(() => {
102
+ inputRef.current?.clear();
103
+ inputRef.current?.focus();
104
+ setValue('');
105
+ // FIXME: figure out how to create a SyntheticEvent
106
+ // @ts-expect-error: we don't have the native event here
107
+ onChangeText?.({ nativeEvent: { text: '' } });
108
+ }, [onChangeText]);
109
+
110
+ React.useEffect(
111
+ () =>
112
+ navigation?.addListener('blur', () => {
113
+ onClear();
114
+ onClose();
115
+ }),
116
+ [navigation, onClear, onClose]
117
+ );
118
+
119
+ if (!visible && !rendered) {
120
+ return null;
121
+ }
122
+
123
+ return (
124
+ <Animated.View
125
+ pointerEvents={visible ? 'auto' : 'none'}
126
+ accessibilityLiveRegion="polite"
127
+ accessibilityElementsHidden={!visible}
128
+ importantForAccessibility={visible ? 'auto' : 'no-hide-descendants'}
129
+ style={[styles.container, { opacity: visibleAnim }, style]}
130
+ >
131
+ <View style={styles.searchbarContainer}>
132
+ <HeaderIcon source={searchIcon} style={styles.inputSearchIcon} />
133
+ <TextInput
134
+ {...rest}
135
+ ref={inputRef}
136
+ onChange={onChangeText}
137
+ onChangeText={setValue}
138
+ autoFocus={autoFocus}
139
+ inputMode={INPUT_TYPE_TO_MODE[inputType ?? 'text']}
140
+ placeholder={placeholder}
141
+ placeholderTextColor={Color(colors.text).alpha(0.5).string()}
142
+ cursorColor={colors.primary}
143
+ selectionHandleColor={colors.primary}
144
+ selectionColor={Color(colors.primary).alpha(0.3).string()}
145
+ style={[
146
+ fonts.regular,
147
+ styles.searchbar,
148
+ {
149
+ backgroundColor: Platform.select({
150
+ ios: dark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)',
151
+ default: 'transparent',
152
+ }),
153
+ color: colors.text,
154
+ borderBottomColor: colors.border,
155
+ },
156
+ ]}
157
+ />
158
+ {Platform.OS === 'ios' ? (
159
+ <PlatformPressable
160
+ onPress={onClear}
161
+ style={[
162
+ {
163
+ opacity: clearVisibleAnim,
164
+ transform: [{ scale: clearVisibleAnim }],
165
+ },
166
+ styles.clearButton,
167
+ ]}
168
+ >
169
+ <Image
170
+ source={clearIcon}
171
+ resizeMode="contain"
172
+ style={[styles.clearIcon, { tintColor: colors.text }]}
173
+ />
174
+ </PlatformPressable>
175
+ ) : null}
176
+ </View>
177
+ {Platform.OS !== 'ios' ? (
178
+ <HeaderButton
179
+ onPress={() => {
180
+ if (value) {
181
+ onClear();
182
+ } else {
183
+ onClose();
184
+ }
185
+ }}
186
+ style={styles.closeButton}
187
+ >
188
+ <HeaderIcon source={closeIcon} />
189
+ </HeaderButton>
190
+ ) : null}
191
+ {Platform.OS === 'ios' ? (
192
+ <PlatformPressable
193
+ onPress={() => {
194
+ onClear();
195
+ onClose();
196
+ }}
197
+ style={styles.cancelButton}
198
+ >
199
+ <Text
200
+ style={[
201
+ fonts.regular,
202
+ { color: colors.primary },
203
+ styles.cancelText,
204
+ ]}
205
+ >
206
+ {cancelButtonText}
207
+ </Text>
208
+ </PlatformPressable>
209
+ ) : null}
210
+ </Animated.View>
211
+ );
212
+ }
213
+
214
+ const styles = StyleSheet.create({
215
+ container: {
216
+ flex: 1,
217
+ flexDirection: 'row',
218
+ alignItems: 'stretch',
219
+ },
220
+ inputSearchIcon: {
221
+ position: 'absolute',
222
+ opacity: 0.5,
223
+ left: Platform.select({ ios: 16, default: 4 }),
224
+ top: Platform.select({ ios: -1, default: 17 }),
225
+ ...Platform.select({
226
+ ios: {
227
+ height: 18,
228
+ width: 18,
229
+ },
230
+ default: {},
231
+ }),
232
+ },
233
+ closeButton: {
234
+ position: 'absolute',
235
+ opacity: 0.5,
236
+ right: Platform.select({ ios: 0, default: 8 }),
237
+ top: Platform.select({ ios: -2, default: 17 }),
238
+ },
239
+ clearButton: {
240
+ position: 'absolute',
241
+ right: 0,
242
+ top: -7,
243
+ bottom: 0,
244
+ justifyContent: 'center',
245
+ padding: 8,
246
+ },
247
+ clearIcon: {
248
+ height: 16,
249
+ width: 16,
250
+ opacity: 0.5,
251
+ },
252
+ cancelButton: {
253
+ alignSelf: 'center',
254
+ top: -4,
255
+ },
256
+ cancelText: {
257
+ fontSize: 17,
258
+ marginHorizontal: 12,
259
+ },
260
+ searchbarContainer: {
261
+ flex: 1,
262
+ },
263
+ searchbar: Platform.select({
264
+ ios: {
265
+ flex: 1,
266
+ fontSize: 17,
267
+ paddingHorizontal: 32,
268
+ marginLeft: 16,
269
+ marginTop: -2,
270
+ marginBottom: 5,
271
+ borderRadius: 8,
272
+ },
273
+ default: {
274
+ flex: 1,
275
+ fontSize: 18,
276
+ paddingHorizontal: 36,
277
+ marginRight: 8,
278
+ marginTop: 8,
279
+ marginBottom: 8,
280
+ borderBottomWidth: 1,
281
+ },
282
+ }),
283
+ });
@@ -1,5 +1,4 @@
1
1
  import { useTheme } from '@react-navigation/native';
2
- import * as React from 'react';
3
2
  import {
4
3
  Animated,
5
4
  Platform,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import {
3
2
  type StyleProp,
4
3
  StyleSheet,
@@ -1,7 +1,6 @@
1
- // TODO
2
- // @ts-expect-error: investigate why TypeScript errors here
3
- import * as React from 'react';
4
- import { type StyleProp, StyleSheet, Text, type TextStyle } from 'react-native';
1
+ import { type StyleProp, StyleSheet, type TextStyle } from 'react-native';
2
+
3
+ import { Text } from './Text';
5
4
 
6
5
  type Props = {
7
6
  color?: string;