ferns-ui 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +22 -0
  3. package/dist/ActionSheet.d.ts +490 -0
  4. package/dist/ActionSheet.js +647 -0
  5. package/dist/ActionSheet.js.map +1 -0
  6. package/dist/Banner.d.ts +27 -0
  7. package/dist/Banner.js +56 -0
  8. package/dist/Banner.js.map +1 -0
  9. package/dist/Banner.stories.d.ts +1 -0
  10. package/dist/Banner.stories.js +13 -0
  11. package/dist/Banner.stories.js.map +1 -0
  12. package/dist/BlurBox.d.ts +5 -0
  13. package/dist/BlurBox.js +28 -0
  14. package/dist/BlurBox.js.map +1 -0
  15. package/dist/BlurBox.native.d.ts +6 -0
  16. package/dist/BlurBox.native.js +30 -0
  17. package/dist/BlurBox.native.js.map +1 -0
  18. package/dist/Body.d.ts +6 -0
  19. package/dist/Body.js +21 -0
  20. package/dist/Body.js.map +1 -0
  21. package/dist/Box.d.ts +18 -0
  22. package/dist/Box.js +228 -0
  23. package/dist/Box.js.map +1 -0
  24. package/dist/Box.stories.d.ts +1 -0
  25. package/dist/Box.stories.js +45 -0
  26. package/dist/Box.stories.js.map +1 -0
  27. package/dist/Button.d.ts +20 -0
  28. package/dist/Button.js +103 -0
  29. package/dist/Button.js.map +1 -0
  30. package/dist/Button.stories.d.ts +1 -0
  31. package/dist/Button.stories.js +41 -0
  32. package/dist/Button.stories.js.map +1 -0
  33. package/dist/Card.d.ts +5 -0
  34. package/dist/Card.js +8 -0
  35. package/dist/Card.js.map +1 -0
  36. package/dist/Card.stories.d.ts +6 -0
  37. package/dist/Card.stories.js +18 -0
  38. package/dist/Card.stories.js.map +1 -0
  39. package/dist/CheckBox.d.ts +6 -0
  40. package/dist/CheckBox.js +27 -0
  41. package/dist/CheckBox.js.map +1 -0
  42. package/dist/CheckBox.stories.d.ts +1 -0
  43. package/dist/CheckBox.stories.js +28 -0
  44. package/dist/CheckBox.stories.js.map +1 -0
  45. package/dist/Common.d.ts +868 -0
  46. package/dist/Common.js +46 -0
  47. package/dist/Common.js.map +1 -0
  48. package/dist/DateTimeActionSheet.d.ts +15 -0
  49. package/dist/DateTimeActionSheet.js +28 -0
  50. package/dist/DateTimeActionSheet.js.map +1 -0
  51. package/dist/DecimalRangeActionSheet.d.ts +18 -0
  52. package/dist/DecimalRangeActionSheet.js +65 -0
  53. package/dist/DecimalRangeActionSheet.js.map +1 -0
  54. package/dist/ErrorBoundary.d.ts +19 -0
  55. package/dist/ErrorBoundary.js +31 -0
  56. package/dist/ErrorBoundary.js.map +1 -0
  57. package/dist/ErrorPage.d.ts +10 -0
  58. package/dist/ErrorPage.js +20 -0
  59. package/dist/ErrorPage.js.map +1 -0
  60. package/dist/Field.d.ts +15 -0
  61. package/dist/Field.js +136 -0
  62. package/dist/Field.js.map +1 -0
  63. package/dist/Field.stories.d.ts +6 -0
  64. package/dist/Field.stories.js +38 -0
  65. package/dist/Field.stories.js.map +1 -0
  66. package/dist/FieldWithLabels.d.ts +3 -0
  67. package/dist/FieldWithLabels.js +8 -0
  68. package/dist/FieldWithLabels.js.map +1 -0
  69. package/dist/FlatList.d.ts +2 -0
  70. package/dist/FlatList.js +3 -0
  71. package/dist/FlatList.js.map +1 -0
  72. package/dist/Form.d.ts +22 -0
  73. package/dist/Form.js +89 -0
  74. package/dist/Form.js.map +1 -0
  75. package/dist/Form.stories.d.ts +6 -0
  76. package/dist/Form.stories.js +36 -0
  77. package/dist/Form.stories.js.map +1 -0
  78. package/dist/HeaderButtons.d.ts +31 -0
  79. package/dist/HeaderButtons.js +53 -0
  80. package/dist/HeaderButtons.js.map +1 -0
  81. package/dist/HeaderButtons.stories.d.ts +6 -0
  82. package/dist/HeaderButtons.stories.js +6 -0
  83. package/dist/HeaderButtons.stories.js.map +1 -0
  84. package/dist/Heading.d.ts +11 -0
  85. package/dist/Heading.js +46 -0
  86. package/dist/Heading.js.map +1 -0
  87. package/dist/Heading.stories.d.ts +1 -0
  88. package/dist/Heading.stories.js +22 -0
  89. package/dist/Heading.stories.js.map +1 -0
  90. package/dist/HeightActionSheet.d.ts +16 -0
  91. package/dist/HeightActionSheet.js +58 -0
  92. package/dist/HeightActionSheet.js.map +1 -0
  93. package/dist/Icon.d.ts +9 -0
  94. package/dist/Icon.js +125 -0
  95. package/dist/Icon.js.map +1 -0
  96. package/dist/Icon.stories.d.ts +1 -0
  97. package/dist/Icon.stories.js +30 -0
  98. package/dist/Icon.stories.js.map +1 -0
  99. package/dist/IconButton.d.ts +5 -0
  100. package/dist/IconButton.js +41 -0
  101. package/dist/IconButton.js.map +1 -0
  102. package/dist/IconButton.stories.d.ts +1 -0
  103. package/dist/IconButton.stories.js +16 -0
  104. package/dist/IconButton.stories.js.map +1 -0
  105. package/dist/Image.d.ts +8 -0
  106. package/dist/Image.js +37 -0
  107. package/dist/Image.js.map +1 -0
  108. package/dist/ImageBackground.d.ts +9 -0
  109. package/dist/ImageBackground.js +8 -0
  110. package/dist/ImageBackground.js.map +1 -0
  111. package/dist/Layer.d.ts +9 -0
  112. package/dist/Layer.js +12 -0
  113. package/dist/Layer.js.map +1 -0
  114. package/dist/Link.d.ts +9 -0
  115. package/dist/Link.js +12 -0
  116. package/dist/Link.js.map +1 -0
  117. package/dist/Link.stories.d.ts +1 -0
  118. package/dist/Link.stories.js +18 -0
  119. package/dist/Link.stories.js.map +1 -0
  120. package/dist/Mask.d.ts +5 -0
  121. package/dist/Mask.js +22 -0
  122. package/dist/Mask.js.map +1 -0
  123. package/dist/Mask.stories.d.ts +1 -0
  124. package/dist/Mask.stories.js +28 -0
  125. package/dist/Mask.stories.js.map +1 -0
  126. package/dist/MediaQuery.d.ts +2 -0
  127. package/dist/MediaQuery.js +33 -0
  128. package/dist/MediaQuery.js.map +1 -0
  129. package/dist/Meta.d.ts +5 -0
  130. package/dist/Meta.js +7 -0
  131. package/dist/Meta.js.map +1 -0
  132. package/dist/ModalSheet.d.ts +7 -0
  133. package/dist/ModalSheet.js +42 -0
  134. package/dist/ModalSheet.js.map +1 -0
  135. package/dist/NumberPickerActionSheet.d.ts +16 -0
  136. package/dist/NumberPickerActionSheet.js +29 -0
  137. package/dist/NumberPickerActionSheet.js.map +1 -0
  138. package/dist/Page.d.ts +26 -0
  139. package/dist/Page.js +38 -0
  140. package/dist/Page.js.map +1 -0
  141. package/dist/Permissions.d.ts +2 -0
  142. package/dist/Permissions.js +35 -0
  143. package/dist/Permissions.js.map +1 -0
  144. package/dist/PickerSelect.d.ts +174 -0
  145. package/dist/PickerSelect.js +426 -0
  146. package/dist/PickerSelect.js.map +1 -0
  147. package/dist/Pill.d.ts +5 -0
  148. package/dist/Pill.js +10 -0
  149. package/dist/Pill.js.map +1 -0
  150. package/dist/Pill.stories.d.ts +1 -0
  151. package/dist/Pill.stories.js +38 -0
  152. package/dist/Pill.stories.js.map +1 -0
  153. package/dist/Pog.d.ts +15 -0
  154. package/dist/Pog.js +144 -0
  155. package/dist/Pog.js.map +1 -0
  156. package/dist/ProgressBar.d.ts +9 -0
  157. package/dist/ProgressBar.js +41 -0
  158. package/dist/ProgressBar.js.map +1 -0
  159. package/dist/ScrollView.d.ts +2 -0
  160. package/dist/ScrollView.js +3 -0
  161. package/dist/ScrollView.js.map +1 -0
  162. package/dist/SegmentedControl.d.ts +6 -0
  163. package/dist/SegmentedControl.js +18 -0
  164. package/dist/SegmentedControl.js.map +1 -0
  165. package/dist/SegmentedControl.stories.d.ts +1 -0
  166. package/dist/SegmentedControl.stories.js +31 -0
  167. package/dist/SegmentedControl.stories.js.map +1 -0
  168. package/dist/SelectList.d.ts +22 -0
  169. package/dist/SelectList.js +28 -0
  170. package/dist/SelectList.js.map +1 -0
  171. package/dist/SelectList.stories.d.ts +1 -0
  172. package/dist/SelectList.stories.js +26 -0
  173. package/dist/SelectList.stories.js.map +1 -0
  174. package/dist/Spinner.d.ts +21 -0
  175. package/dist/Spinner.js +58 -0
  176. package/dist/Spinner.js.map +1 -0
  177. package/dist/Spinner.stories.d.ts +1 -0
  178. package/dist/Spinner.stories.js +12 -0
  179. package/dist/Spinner.stories.js.map +1 -0
  180. package/dist/SplitPage.d.ts +31 -0
  181. package/dist/SplitPage.js +51 -0
  182. package/dist/SplitPage.js.map +1 -0
  183. package/dist/SplitPage.stories.d.ts +1 -0
  184. package/dist/SplitPage.stories.js +15 -0
  185. package/dist/SplitPage.stories.js.map +1 -0
  186. package/dist/StorybookContainer.d.ts +4 -0
  187. package/dist/StorybookContainer.js +8 -0
  188. package/dist/StorybookContainer.js.map +1 -0
  189. package/dist/Switch.d.ts +5 -0
  190. package/dist/Switch.js +10 -0
  191. package/dist/Switch.js.map +1 -0
  192. package/dist/Switch.stories.d.ts +1 -0
  193. package/dist/Switch.stories.js +34 -0
  194. package/dist/Switch.stories.js.map +1 -0
  195. package/dist/TapToEdit.d.ts +12 -0
  196. package/dist/TapToEdit.js +32 -0
  197. package/dist/TapToEdit.js.map +1 -0
  198. package/dist/Text.d.ts +11 -0
  199. package/dist/Text.js +85 -0
  200. package/dist/Text.js.map +1 -0
  201. package/dist/Text.stories.d.ts +1 -0
  202. package/dist/Text.stories.js +37 -0
  203. package/dist/Text.stories.js.map +1 -0
  204. package/dist/TextArea.d.ts +6 -0
  205. package/dist/TextArea.js +12 -0
  206. package/dist/TextArea.js.map +1 -0
  207. package/dist/TextArea.stories.d.ts +10 -0
  208. package/dist/TextArea.stories.js +24 -0
  209. package/dist/TextArea.stories.js.map +1 -0
  210. package/dist/TextField.d.ts +48 -0
  211. package/dist/TextField.js +207 -0
  212. package/dist/TextField.js.map +1 -0
  213. package/dist/TextField.stories.d.ts +6 -0
  214. package/dist/TextField.stories.js +18 -0
  215. package/dist/TextField.stories.js.map +1 -0
  216. package/dist/TextFieldNumberActionSheet.d.ts +15 -0
  217. package/dist/TextFieldNumberActionSheet.js +28 -0
  218. package/dist/TextFieldNumberActionSheet.js.map +1 -0
  219. package/dist/UnifiedScreens.d.ts +9 -0
  220. package/dist/UnifiedScreens.js +25 -0
  221. package/dist/UnifiedScreens.js.map +1 -0
  222. package/dist/Unifier.d.ts +40 -0
  223. package/dist/Unifier.js +203 -0
  224. package/dist/Unifier.js.map +1 -0
  225. package/dist/Utilities.d.ts +31 -0
  226. package/dist/Utilities.js +74 -0
  227. package/dist/Utilities.js.map +1 -0
  228. package/dist/WithLabel.d.ts +5 -0
  229. package/dist/WithLabel.js +27 -0
  230. package/dist/WithLabel.js.map +1 -0
  231. package/dist/dist/ActionSheet.d.ts +139 -0
  232. package/dist/dist/ActionSheet.js +637 -0
  233. package/dist/dist/ActionSheet.js.map +1 -0
  234. package/dist/dist/Banner.d.ts +12 -0
  235. package/dist/dist/Banner.js +49 -0
  236. package/dist/dist/Banner.js.map +1 -0
  237. package/dist/dist/Banner.stories.d.ts +1 -0
  238. package/dist/dist/Banner.stories.js +9 -0
  239. package/dist/dist/Banner.stories.js.map +1 -0
  240. package/dist/dist/BlurBox.d.ts +7 -0
  241. package/dist/dist/BlurBox.js +29 -0
  242. package/dist/dist/BlurBox.js.map +1 -0
  243. package/dist/dist/BlurBox.native.d.ts +9 -0
  244. package/dist/dist/BlurBox.native.js +32 -0
  245. package/dist/dist/BlurBox.native.js.map +1 -0
  246. package/dist/dist/Body.d.ts +12 -0
  247. package/dist/dist/Body.js +19 -0
  248. package/dist/dist/Body.js.map +1 -0
  249. package/dist/dist/Box.d.ts +205 -0
  250. package/dist/dist/Box.js +229 -0
  251. package/dist/dist/Box.js.map +1 -0
  252. package/dist/dist/Box.stories.d.ts +1 -0
  253. package/dist/dist/Box.stories.js +37 -0
  254. package/dist/dist/Box.stories.js.map +1 -0
  255. package/dist/dist/Button.d.ts +16 -0
  256. package/dist/dist/Button.js +98 -0
  257. package/dist/dist/Button.js.map +1 -0
  258. package/dist/dist/Button.stories.d.ts +13 -0
  259. package/dist/dist/Button.stories.js +26 -0
  260. package/dist/dist/Button.stories.js.map +1 -0
  261. package/dist/dist/Card.d.ts +6 -0
  262. package/dist/dist/Card.js +9 -0
  263. package/dist/dist/Card.js.map +1 -0
  264. package/dist/dist/Card.stories.d.ts +6 -0
  265. package/dist/dist/Card.stories.js +11 -0
  266. package/dist/dist/Card.stories.js.map +1 -0
  267. package/dist/dist/CheckBox.d.ts +8 -0
  268. package/dist/dist/CheckBox.js +23 -0
  269. package/dist/dist/CheckBox.js.map +1 -0
  270. package/dist/dist/CheckBox.stories.d.ts +1 -0
  271. package/dist/dist/CheckBox.stories.js +22 -0
  272. package/dist/dist/CheckBox.stories.js.map +1 -0
  273. package/dist/dist/Common.d.ts +5 -0
  274. package/dist/dist/Common.js +47 -0
  275. package/dist/dist/Common.js.map +1 -0
  276. package/dist/dist/DateTimeActionSheet.d.ts +5 -0
  277. package/dist/dist/DateTimeActionSheet.js +24 -0
  278. package/dist/dist/DateTimeActionSheet.js.map +1 -0
  279. package/dist/dist/DecimalRangeActionSheet.d.ts +9 -0
  280. package/dist/dist/DecimalRangeActionSheet.js +57 -0
  281. package/dist/dist/DecimalRangeActionSheet.js.map +1 -0
  282. package/dist/dist/ErrorBoundary.d.ts +12 -0
  283. package/dist/dist/ErrorBoundary.js +32 -0
  284. package/dist/dist/ErrorBoundary.js.map +1 -0
  285. package/dist/dist/ErrorPage.d.ts +7 -0
  286. package/dist/dist/ErrorPage.js +15 -0
  287. package/dist/dist/ErrorPage.js.map +1 -0
  288. package/dist/dist/Field.d.ts +17 -0
  289. package/dist/dist/Field.js +136 -0
  290. package/dist/dist/Field.js.map +1 -0
  291. package/dist/dist/Field.stories.d.ts +6 -0
  292. package/dist/dist/Field.stories.js +25 -0
  293. package/dist/dist/Field.stories.js.map +1 -0
  294. package/dist/dist/FieldWithLabels.d.ts +10 -0
  295. package/dist/dist/FieldWithLabels.js +7 -0
  296. package/dist/dist/FieldWithLabels.js.map +1 -0
  297. package/dist/dist/FlatList.d.ts +1 -0
  298. package/dist/dist/FlatList.js +4 -0
  299. package/dist/dist/FlatList.js.map +1 -0
  300. package/dist/dist/Form.d.ts +15 -0
  301. package/dist/dist/Form.js +56 -0
  302. package/dist/dist/Form.js.map +1 -0
  303. package/dist/dist/Form.stories.d.ts +6 -0
  304. package/dist/dist/Form.stories.js +27 -0
  305. package/dist/dist/Form.stories.js.map +1 -0
  306. package/dist/dist/HeaderButtons.d.ts +39 -0
  307. package/dist/dist/HeaderButtons.js +50 -0
  308. package/dist/dist/HeaderButtons.js.map +1 -0
  309. package/dist/dist/HeaderButtons.stories.d.ts +6 -0
  310. package/dist/dist/HeaderButtons.stories.js +7 -0
  311. package/dist/dist/HeaderButtons.stories.js.map +1 -0
  312. package/dist/dist/Heading.d.ts +32 -0
  313. package/dist/dist/Heading.js +47 -0
  314. package/dist/dist/Heading.js.map +1 -0
  315. package/dist/dist/Heading.stories.d.ts +1 -0
  316. package/dist/dist/Heading.stories.js +11 -0
  317. package/dist/dist/Heading.stories.js.map +1 -0
  318. package/dist/dist/HeightActionSheet.d.ts +9 -0
  319. package/dist/dist/HeightActionSheet.js +50 -0
  320. package/dist/dist/HeightActionSheet.js.map +1 -0
  321. package/dist/dist/Icon.d.ts +12 -0
  322. package/dist/dist/Icon.js +126 -0
  323. package/dist/dist/Icon.js.map +1 -0
  324. package/dist/dist/Icon.stories.d.ts +1 -0
  325. package/dist/dist/Icon.stories.js +11 -0
  326. package/dist/dist/Icon.stories.js.map +1 -0
  327. package/dist/dist/IconButton.d.ts +42 -0
  328. package/dist/dist/IconButton.js +41 -0
  329. package/dist/dist/IconButton.js.map +1 -0
  330. package/dist/dist/IconButton.stories.d.ts +1 -0
  331. package/dist/dist/IconButton.stories.js +8 -0
  332. package/dist/dist/IconButton.stories.js.map +1 -0
  333. package/dist/dist/Image.d.ts +9 -0
  334. package/dist/dist/Image.js +37 -0
  335. package/dist/dist/Image.js.map +1 -0
  336. package/dist/dist/ImageBackground.d.ts +6 -0
  337. package/dist/dist/ImageBackground.js +9 -0
  338. package/dist/dist/ImageBackground.js.map +1 -0
  339. package/dist/dist/Layer.d.ts +5 -0
  340. package/dist/dist/Layer.js +13 -0
  341. package/dist/dist/Layer.js.map +1 -0
  342. package/dist/dist/Link.d.ts +7 -0
  343. package/dist/dist/Link.js +13 -0
  344. package/dist/dist/Link.js.map +1 -0
  345. package/dist/dist/Link.stories.d.ts +1 -0
  346. package/dist/dist/Link.stories.js +8 -0
  347. package/dist/dist/Link.stories.js.map +1 -0
  348. package/dist/dist/Mask.d.ts +5 -0
  349. package/dist/dist/Mask.js +23 -0
  350. package/dist/dist/Mask.js.map +1 -0
  351. package/dist/dist/Mask.stories.d.ts +1 -0
  352. package/dist/dist/Mask.stories.js +13 -0
  353. package/dist/dist/Mask.stories.js.map +1 -0
  354. package/dist/dist/MediaQuery.d.ts +2 -0
  355. package/dist/dist/MediaQuery.js +34 -0
  356. package/dist/dist/MediaQuery.js.map +1 -0
  357. package/dist/dist/Meta.d.ts +6 -0
  358. package/dist/dist/Meta.js +8 -0
  359. package/dist/dist/Meta.js.map +1 -0
  360. package/dist/dist/ModalSheet.d.ts +3 -0
  361. package/dist/dist/ModalSheet.js +43 -0
  362. package/dist/dist/ModalSheet.js.map +1 -0
  363. package/dist/dist/NumberPickerActionSheet.d.ts +5 -0
  364. package/dist/dist/NumberPickerActionSheet.js +25 -0
  365. package/dist/dist/NumberPickerActionSheet.js.map +1 -0
  366. package/dist/dist/Page.d.ts +9 -0
  367. package/dist/dist/Page.js +26 -0
  368. package/dist/dist/Page.js.map +1 -0
  369. package/dist/dist/Permissions.d.ts +1 -0
  370. package/dist/dist/Permissions.js +36 -0
  371. package/dist/dist/Permissions.js.map +1 -0
  372. package/dist/dist/PickerSelect.d.ts +172 -0
  373. package/dist/dist/PickerSelect.js +403 -0
  374. package/dist/dist/PickerSelect.js.map +1 -0
  375. package/dist/dist/Pill.d.ts +7 -0
  376. package/dist/dist/Pill.js +10 -0
  377. package/dist/dist/Pill.js.map +1 -0
  378. package/dist/dist/Pill.stories.d.ts +1 -0
  379. package/dist/dist/Pill.stories.js +36 -0
  380. package/dist/dist/Pill.stories.js.map +1 -0
  381. package/dist/dist/Pog.d.ts +7 -0
  382. package/dist/dist/Pog.js +144 -0
  383. package/dist/dist/Pog.js.map +1 -0
  384. package/dist/dist/ProgressBar.d.ts +16 -0
  385. package/dist/dist/ProgressBar.js +40 -0
  386. package/dist/dist/ProgressBar.js.map +1 -0
  387. package/dist/dist/ScrollView.d.ts +1 -0
  388. package/dist/dist/ScrollView.js +4 -0
  389. package/dist/dist/ScrollView.js.map +1 -0
  390. package/dist/dist/SegmentedControl.d.ts +9 -0
  391. package/dist/dist/SegmentedControl.js +18 -0
  392. package/dist/dist/SegmentedControl.js.map +1 -0
  393. package/dist/dist/SegmentedControl.stories.d.ts +1 -0
  394. package/dist/dist/SegmentedControl.stories.js +32 -0
  395. package/dist/dist/SegmentedControl.stories.js.map +1 -0
  396. package/dist/dist/SelectList.d.ts +9 -0
  397. package/dist/dist/SelectList.js +29 -0
  398. package/dist/dist/SelectList.js.map +1 -0
  399. package/dist/dist/SelectList.stories.d.ts +1 -0
  400. package/dist/dist/SelectList.stories.js +24 -0
  401. package/dist/dist/SelectList.stories.js.map +1 -0
  402. package/dist/dist/Spinner.d.ts +44 -0
  403. package/dist/dist/Spinner.js +58 -0
  404. package/dist/dist/Spinner.js.map +1 -0
  405. package/dist/dist/Spinner.stories.d.ts +1 -0
  406. package/dist/dist/Spinner.stories.js +10 -0
  407. package/dist/dist/Spinner.stories.js.map +1 -0
  408. package/dist/dist/SplitPage.d.ts +7 -0
  409. package/dist/dist/SplitPage.js +20 -0
  410. package/dist/dist/SplitPage.js.map +1 -0
  411. package/dist/dist/SplitPage.stories.d.ts +1 -0
  412. package/dist/dist/SplitPage.stories.js +7 -0
  413. package/dist/dist/SplitPage.stories.js.map +1 -0
  414. package/dist/dist/StorybookContainer.d.ts +7 -0
  415. package/dist/dist/StorybookContainer.js +9 -0
  416. package/dist/dist/StorybookContainer.js.map +1 -0
  417. package/dist/dist/Switch.d.ts +6 -0
  418. package/dist/dist/Switch.js +10 -0
  419. package/dist/dist/Switch.js.map +1 -0
  420. package/dist/dist/Switch.stories.d.ts +1 -0
  421. package/dist/dist/Switch.stories.js +27 -0
  422. package/dist/dist/Switch.stories.js.map +1 -0
  423. package/dist/dist/TapToEdit.d.ts +9 -0
  424. package/dist/dist/TapToEdit.js +27 -0
  425. package/dist/dist/TapToEdit.js.map +1 -0
  426. package/dist/dist/Text.d.ts +36 -0
  427. package/dist/dist/Text.js +86 -0
  428. package/dist/dist/Text.js.map +1 -0
  429. package/dist/dist/Text.stories.d.ts +1 -0
  430. package/dist/dist/Text.stories.js +13 -0
  431. package/dist/dist/Text.stories.js.map +1 -0
  432. package/dist/dist/TextArea.d.ts +6 -0
  433. package/dist/dist/TextArea.js +13 -0
  434. package/dist/dist/TextArea.js.map +1 -0
  435. package/dist/dist/TextArea.stories.d.ts +12 -0
  436. package/dist/dist/TextArea.stories.js +21 -0
  437. package/dist/dist/TextArea.stories.js.map +1 -0
  438. package/dist/dist/TextField.d.ts +47 -0
  439. package/dist/dist/TextField.js +199 -0
  440. package/dist/dist/TextField.js.map +1 -0
  441. package/dist/dist/TextField.stories.d.ts +6 -0
  442. package/dist/dist/TextField.stories.js +15 -0
  443. package/dist/dist/TextField.stories.js.map +1 -0
  444. package/dist/dist/TextFieldNumberActionSheet.d.ts +5 -0
  445. package/dist/dist/TextFieldNumberActionSheet.js +24 -0
  446. package/dist/dist/TextFieldNumberActionSheet.js.map +1 -0
  447. package/dist/dist/UnifiedScreens.d.ts +2 -0
  448. package/dist/dist/UnifiedScreens.js +26 -0
  449. package/dist/dist/UnifiedScreens.js.map +1 -0
  450. package/dist/dist/Unifier.d.ts +131 -0
  451. package/dist/dist/Unifier.js +198 -0
  452. package/dist/dist/Unifier.js.map +1 -0
  453. package/dist/dist/Utilities.d.ts +51 -0
  454. package/dist/dist/Utilities.js +77 -0
  455. package/dist/dist/Utilities.js.map +1 -0
  456. package/dist/dist/WithLabel.d.ts +6 -0
  457. package/dist/dist/WithLabel.js +23 -0
  458. package/dist/dist/WithLabel.js.map +1 -0
  459. package/dist/dist/index.d.ts +43 -0
  460. package/dist/dist/index.js +49 -0
  461. package/dist/dist/index.js.map +1 -0
  462. package/dist/index.d.ts +1284 -0
  463. package/dist/index.js +49 -0
  464. package/dist/index.js.map +1 -0
  465. package/package.json +197 -0
  466. package/src/ActionSheet.tsx +1234 -0
  467. package/src/Banner.tsx +124 -0
  468. package/src/BlurBox.native.tsx +40 -0
  469. package/src/BlurBox.tsx +31 -0
  470. package/src/Body.tsx +32 -0
  471. package/src/Box.tsx +277 -0
  472. package/src/Button.tsx +139 -0
  473. package/src/Card.tsx +23 -0
  474. package/src/CheckBox.tsx +93 -0
  475. package/src/Common.ts +1376 -0
  476. package/src/DateTimeActionSheet.tsx +61 -0
  477. package/src/DecimalRangeActionSheet.tsx +113 -0
  478. package/src/ErrorBoundary.tsx +39 -0
  479. package/src/ErrorPage.tsx +44 -0
  480. package/src/Field.tsx +194 -0
  481. package/src/FieldWithLabels.tsx +36 -0
  482. package/src/FlatList.tsx +2 -0
  483. package/src/Form.tsx +182 -0
  484. package/src/HeaderButtons.tsx +107 -0
  485. package/src/Heading.tsx +53 -0
  486. package/src/HeightActionSheet.tsx +104 -0
  487. package/src/Icon.tsx +139 -0
  488. package/src/IconButton.tsx +52 -0
  489. package/src/Image.tsx +50 -0
  490. package/src/ImageBackground.tsx +13 -0
  491. package/src/Layer.tsx +17 -0
  492. package/src/Link.tsx +17 -0
  493. package/src/Mask.tsx +24 -0
  494. package/src/MediaQuery.ts +28 -0
  495. package/src/Meta.tsx +9 -0
  496. package/src/ModalSheet.tsx +58 -0
  497. package/src/NumberPickerActionSheet.tsx +66 -0
  498. package/src/Page.tsx +134 -0
  499. package/src/Permissions.ts +44 -0
  500. package/src/PickerSelect.tsx +673 -0
  501. package/src/Pill.tsx +24 -0
  502. package/src/Pog.tsx +211 -0
  503. package/src/ProgressBar.tsx +55 -0
  504. package/src/ScrollView.tsx +2 -0
  505. package/src/SegmentedControl.tsx +51 -0
  506. package/src/SelectList.tsx +48 -0
  507. package/src/Spinner.tsx +69 -0
  508. package/src/SplitPage.tsx +115 -0
  509. package/src/Switch.tsx +19 -0
  510. package/src/TapToEdit.tsx +48 -0
  511. package/src/Text.tsx +92 -0
  512. package/src/TextArea.tsx +15 -0
  513. package/src/TextField.tsx +291 -0
  514. package/src/TextFieldNumberActionSheet.tsx +61 -0
  515. package/src/UnifiedScreens.ts +24 -0
  516. package/src/Unifier.ts +268 -0
  517. package/src/Utilities.tsx +161 -0
  518. package/src/WithLabel.tsx +46 -0
  519. package/src/index.tsx +1332 -0
  520. package/src/polyfill.d.ts +11 -0
  521. package/tsconfig.json +29 -0
@@ -0,0 +1,1234 @@
1
+ /* eslint-disable react/prop-types */
2
+
3
+ import React, {Component, createRef} from "react";
4
+ import {
5
+ Animated,
6
+ Dimensions,
7
+ findNodeHandle,
8
+ FlatList,
9
+ Keyboard,
10
+ KeyboardEvent,
11
+ LayoutChangeEvent,
12
+ Modal,
13
+ NativeScrollEvent,
14
+ NativeSyntheticEvent,
15
+ Platform,
16
+ SafeAreaView,
17
+ StatusBar,
18
+ StyleSheet,
19
+ TextInput,
20
+ TouchableOpacity,
21
+ UIManager,
22
+ View,
23
+ ViewStyle,
24
+ } from "react-native";
25
+
26
+ export type ActionSheetProps = {
27
+ children?: React.ReactNode;
28
+ ref?: React.MutableRefObject<{
29
+ /**
30
+ * Open or close the ActionSheet.
31
+ */
32
+ setModalVisible(visible?: boolean): void;
33
+
34
+ /**
35
+ * Open the Action Sheet.
36
+ */
37
+ show(): void;
38
+
39
+ /**
40
+ * Close the ActionSheet.
41
+ */
42
+ hide(): void;
43
+
44
+ /**
45
+ * Attach this to any child ScrollView Component's onScrollEndDrag,
46
+ * onMomentumScrollEnd,onScrollAnimationEnd callbacks to handle the ActionSheet
47
+ * closing and bouncing back properly.
48
+ */
49
+ handleChildScrollEnd(): void;
50
+
51
+ /**
52
+ * Snap ActionSheet to given offset
53
+ */
54
+ snapToOffset(offset: number): void;
55
+ }>;
56
+ /**
57
+ * Animate the opening and closing of ActionSheet.
58
+
59
+ | Type | Required |
60
+ | ---- | -------- |
61
+ | boolean | no |
62
+
63
+ Default: `true`
64
+ */
65
+ animated?: boolean;
66
+
67
+ /**
68
+ * Use if you want to show the ActionSheet Partially on Opening. **Requires `gestureEnabled=true`**
69
+
70
+ | Type | Required |
71
+ | ---- | -------- |
72
+ | boolean | no |
73
+
74
+ Default:`1`
75
+ */
76
+
77
+ initialOffsetFromBottom?: number;
78
+
79
+ /**
80
+ * When touch ends and user has not moved farther from the set springOffset, the ActionSheet will return to previous position.
81
+
82
+ | Type | Required |
83
+ | ---- | -------- |
84
+ | number | no |
85
+
86
+ Default: `50`
87
+ */
88
+ springOffset?: number;
89
+ /**
90
+ * Add elevation to the ActionSheet container.
91
+
92
+ | Type | Required |
93
+ | ---- | -------- |
94
+ | number | no |
95
+
96
+ Default: `0`
97
+
98
+ #
99
+ */
100
+ elevation?: number;
101
+
102
+ /**
103
+ * Color of the gestureEnabled Indicator.
104
+
105
+ | Type | Required |
106
+ | ---- | -------- |
107
+ | string | no |
108
+
109
+ Default: `"#f0f0f0"`
110
+ */
111
+ indicatorColor?: string;
112
+
113
+ /**
114
+ * Normally when the ActionSheet is fully opened, a small portion from the bottom is hidden by default. Use this prop if you want the ActionSheet to hover over the bottom of screen and not hide a little behind it.
115
+
116
+ | Type | Required |
117
+ | ---- | -------- |
118
+ | number | no |
119
+
120
+ Default:`0`
121
+ */
122
+ extraScroll?: number;
123
+ /**
124
+ * Color of the overlay/backdrop.
125
+
126
+ | Type | Required |
127
+ | ---- | -------- |
128
+ | string | no |
129
+
130
+ Default: `"black"`
131
+ */
132
+ overlayColor?: string;
133
+
134
+ /**
135
+ * Keep the header always visible even when gestures are disabled.
136
+
137
+ | Type | Required |
138
+ | ---- | -------- |
139
+ | boolean | no |
140
+
141
+ Default: `false`
142
+ */
143
+ headerAlwaysVisible?: boolean;
144
+
145
+ /**
146
+ * Delay draw of ActionSheet on open for android.
147
+
148
+ | Type | Required |
149
+ | ---- | -------- |
150
+ | boolean | no |
151
+
152
+ Default: `false`
153
+ */
154
+
155
+ delayActionSheetDraw?: boolean;
156
+
157
+ /**
158
+ * Delay draw of ActionSheet on open for android time.
159
+
160
+ | Type | Required |
161
+ | ---- | -------- |
162
+ | number (ms) | no |
163
+
164
+ Default: `50`
165
+ */
166
+
167
+ delayActionSheetDrawTime?: number;
168
+
169
+ /**
170
+ * Your custom header component. Using this will hide the default indicator.
171
+
172
+ | Type | Required |
173
+ | ---- | -------- |
174
+ | React.Component | no |
175
+ */
176
+ CustomHeaderComponent?: React.ReactNode;
177
+
178
+ /**
179
+ * Any custom styles for the container.
180
+
181
+ | Type | Required |
182
+ | ---- | -------- |
183
+ | Object | no |
184
+ */
185
+ containerStyle?: ViewStyle;
186
+
187
+ /**
188
+ * Control closing ActionSheet by touching on backdrop.
189
+
190
+ | Type | Required |
191
+ | ---- | -------- |
192
+ | boolean | no |
193
+
194
+ Default: `true`
195
+ */
196
+ closeOnTouchBackdrop?: boolean;
197
+
198
+ /**
199
+ * Speed of opening animation. Higher means the ActionSheet will open more quickly.
200
+
201
+ | Type | Required |
202
+ | ---- | -------- |
203
+ | number | no |
204
+
205
+ Default: `12`
206
+ */
207
+ openAnimationSpeed?: number;
208
+ /**
209
+ * Duration of closing animation.
210
+
211
+ | Type | Required |
212
+ | ---- | -------- |
213
+ | number | no |
214
+
215
+ Default: `300`
216
+ */
217
+ closeAnimationDuration?: number;
218
+ /**
219
+ *
220
+ How much you want the ActionSheet to bounce when it is opened.
221
+
222
+ | Type | Required |
223
+ | ---- | -------- |
224
+ | number | no |
225
+
226
+ Default: `8`
227
+ */
228
+ bounciness?: number;
229
+
230
+ /**
231
+ * Will the ActionSheet close on `hardwareBackPress` event.
232
+
233
+ | Type | Required |
234
+ | ---- | -------- |
235
+ | boolean | no |
236
+
237
+ Default: `true`
238
+ */
239
+ closeOnPressBack?: boolean;
240
+ /**
241
+ * Default opacity of the overlay/backdrop.
242
+
243
+ | Type | Required |
244
+ | ---- | -------- |
245
+ | number 0 - 1 | no |
246
+
247
+ Default: `0.3`
248
+ */
249
+ defaultOverlayOpacity?: number;
250
+
251
+ /**
252
+ * Enables gesture control of ActionSheet
253
+
254
+ | Type | Required |
255
+ | ---- | -------- |
256
+ | boolean | no |
257
+
258
+ Default: `false`
259
+ */
260
+ gestureEnabled?: boolean;
261
+
262
+ /**
263
+ * Bounces the ActionSheet on open.
264
+
265
+ | Type | Required |
266
+ | ---- | -------- |
267
+ | boolean | no |
268
+
269
+ Default: `false`
270
+ */
271
+ bounceOnOpen?: boolean;
272
+
273
+ /**
274
+ * Setting the keyboard persistance of the ScrollView component, should be one of "never", "always", or "handled"
275
+
276
+ | Type | Required |
277
+ | ---- | -------- |
278
+ | string | no |
279
+
280
+ Default: `"never"`
281
+ */
282
+ keyboardShouldPersistTaps?: boolean | "always" | "never" | "handled";
283
+
284
+ /**
285
+ * Determine whether the modal should go under the system statusbar.
286
+
287
+ | Type | Required |
288
+ | ---- | -------- |
289
+ | boolean | no |
290
+
291
+ Default: `true`
292
+ */
293
+ statusBarTranslucent?: boolean;
294
+
295
+ /**
296
+ * Prevent ActionSheet from closing on
297
+ * gesture or tapping on backdrop.
298
+ * Instead snap it to `bottomOffset` location
299
+ *
300
+ *
301
+ * | Type | Required |
302
+ | ---- | -------- |
303
+ | boolean | no |
304
+ */
305
+ closable?: boolean;
306
+
307
+ /**
308
+ * Allow ActionSheet to draw under the StatusBar.
309
+ * This is enabled by default.
310
+ *
311
+ *
312
+ * | Type | Required |
313
+ | ---- | -------- |
314
+ | boolean | no |
315
+ Default: `true`
316
+ */
317
+ drawUnderStatusBar?: boolean;
318
+
319
+ /**
320
+ * Snap ActionSheet to this location if `closable` is set to false;
321
+ *
322
+ *
323
+ * | Type | Required |
324
+ | ---- | -------- |
325
+ | number | no |
326
+ */
327
+
328
+ bottomOffset?: number;
329
+
330
+ /**
331
+ * Change how ActionSheet behaves when keyboard is opened.
332
+ *
333
+ *
334
+ * | Type | Required |
335
+ | ---- | -------- |
336
+ | "padding" | "position" | no |
337
+ Default:`padding`
338
+ */
339
+
340
+ keyboardMode?: "padding" | "position";
341
+
342
+ /**
343
+ * Test ID for unit testing
344
+ */
345
+ testID?: string;
346
+
347
+ /**
348
+ *
349
+ Event called when the ActionSheet closes.
350
+
351
+
352
+ * | Type | Required |
353
+ | ---- | -------- |
354
+ | function | no |
355
+
356
+
357
+ #
358
+ */
359
+
360
+ onClose?: () => void;
361
+
362
+ /**
363
+ * An event called when the ActionSheet Opens.
364
+
365
+ | Type | Required |
366
+ | ---- | -------- |
367
+ | function | no |
368
+ */
369
+ onOpen?: () => void;
370
+
371
+ /**
372
+ * Event called when position of ActionSheet changes.
373
+ */
374
+ onPositionChanged?: (hasReachedTop: boolean) => void;
375
+ };
376
+
377
+ export const styles = StyleSheet.create({
378
+ scrollView: {
379
+ height: "100%",
380
+ width: "100%",
381
+ backgroundColor: "transparent",
382
+ },
383
+ container: {
384
+ width: "100%",
385
+ backgroundColor: "white",
386
+ alignSelf: "center",
387
+ },
388
+ safearea: {
389
+ position: "absolute",
390
+ top: 999999,
391
+ left: 999999,
392
+ },
393
+ indicator: {
394
+ height: 6,
395
+ width: 45,
396
+ borderRadius: 100,
397
+ backgroundColor: "#f0f0f0",
398
+ marginVertical: 5,
399
+ alignSelf: "center",
400
+ },
401
+ parentContainer: {
402
+ width: "100%",
403
+ height: "100%",
404
+ justifyContent: "center",
405
+ alignItems: "center",
406
+ },
407
+ });
408
+
409
+ export function getDeviceHeight(statusBarTranslucent: boolean | undefined): number {
410
+ const height = Dimensions.get("window").height;
411
+
412
+ if (Platform.OS === "android" && !statusBarTranslucent) {
413
+ return StatusBar.currentHeight ? height - StatusBar.currentHeight : height;
414
+ }
415
+
416
+ return height;
417
+ }
418
+
419
+ export const getElevation = (elevation?: number) => {
420
+ if (!elevation) {
421
+ return {};
422
+ }
423
+ return {
424
+ elevation,
425
+ shadowColor: "black",
426
+ shadowOffset: {width: 0.3 * elevation, height: 0.5 * elevation},
427
+ shadowOpacity: 0.2,
428
+ shadowRadius: 0.7 * elevation,
429
+ };
430
+ };
431
+
432
+ export const SUPPORTED_ORIENTATIONS: (
433
+ | "portrait"
434
+ | "portrait-upside-down"
435
+ | "landscape"
436
+ | "landscape-left"
437
+ | "landscape-right"
438
+ )[] = ["portrait", "portrait-upside-down", "landscape", "landscape-left", "landscape-right"];
439
+
440
+ export const waitAsync = (ms: number): Promise<null> =>
441
+ new Promise((resolve) => {
442
+ setTimeout(() => {
443
+ resolve(null);
444
+ }, ms);
445
+ });
446
+
447
+ const safeAreaInnerHeight = 0;
448
+ const dummyData = ["dummy"];
449
+ let safeAreaPaddingTop = Platform.OS === "android" ? StatusBar.currentHeight || 0 : 0;
450
+ let calculatedDeviceHeight = Dimensions.get("window").height;
451
+
452
+ type State = {
453
+ modalVisible: boolean;
454
+ scrollable: boolean;
455
+ layoutHasCalled: boolean;
456
+ keyboard: boolean;
457
+ deviceHeight: number;
458
+ deviceWidth: number;
459
+ portrait: boolean;
460
+ safeAreaInnerHeight: number;
461
+ paddingTop: number;
462
+ };
463
+
464
+ const defaultProps = {
465
+ animated: true,
466
+ closeOnPressBack: true,
467
+ bounciness: 8,
468
+ extraScroll: 0,
469
+ closeAnimationDuration: 300,
470
+ delayActionSheetDrawTime: 0,
471
+ openAnimationSpeed: 12,
472
+ springOffset: 100,
473
+ elevation: 5,
474
+ initialOffsetFromBottom: 1,
475
+ indicatorColor: "#f0f0f0",
476
+ defaultOverlayOpacity: 0.3,
477
+ overlayColor: "black",
478
+ closable: true,
479
+ bottomOffset: 0,
480
+ closeOnTouchBackdrop: true,
481
+ drawUnderStatusBar: true,
482
+ statusBarTranslucent: true,
483
+ keyboardMode: "padding",
484
+ gestureEnabled: false,
485
+ };
486
+
487
+ type Props = Partial<typeof defaultProps> & ActionSheetProps;
488
+
489
+ export class ActionSheet extends Component<Props, State, any> {
490
+ static defaultProps = defaultProps;
491
+
492
+ actionSheetHeight = 0;
493
+
494
+ prevScroll = 0;
495
+
496
+ timeout: any | null = null;
497
+
498
+ offsetY = 0;
499
+
500
+ currentOffsetFromBottom = 0;
501
+
502
+ scrollAnimationEndValue = 0;
503
+
504
+ hasBounced = false;
505
+
506
+ layoutHasCalled = false;
507
+
508
+ isClosing = false;
509
+
510
+ isRecoiling = false;
511
+
512
+ isReachedTop = false;
513
+
514
+ deviceLayoutCalled = false;
515
+
516
+ scrollViewRef: React.RefObject<any>;
517
+
518
+ safeAreaViewRef: React.RefObject<any>;
519
+
520
+ transformValue: Animated.Value;
521
+
522
+ opacityValue: Animated.Value;
523
+
524
+ borderRadius: Animated.Value;
525
+
526
+ underlayTranslateY: Animated.Value;
527
+
528
+ underlayScale: Animated.Value;
529
+
530
+ indicatorTranslateY: Animated.Value;
531
+
532
+ constructor(props: ActionSheetProps) {
533
+ super(props);
534
+ this.state = {
535
+ modalVisible: false,
536
+ scrollable: false,
537
+ layoutHasCalled: false,
538
+ keyboard: false,
539
+ deviceHeight: calculatedDeviceHeight || getDeviceHeight(this.props.statusBarTranslucent),
540
+ deviceWidth: Dimensions.get("window").width,
541
+ portrait: true,
542
+ safeAreaInnerHeight,
543
+ paddingTop: safeAreaPaddingTop,
544
+ };
545
+
546
+ this.actionSheetHeight = 0;
547
+ this.prevScroll = 0;
548
+ this.scrollAnimationEndValue = 0;
549
+ this.hasBounced = false;
550
+ this.scrollViewRef = createRef();
551
+ this.layoutHasCalled = false;
552
+ this.isClosing = false;
553
+ this.isRecoiling = false;
554
+ this.offsetY = 0;
555
+ this.safeAreaViewRef = createRef();
556
+ this.transformValue = new Animated.Value(0);
557
+ this.opacityValue = new Animated.Value(0);
558
+ this.borderRadius = new Animated.Value(10);
559
+ this.currentOffsetFromBottom = this.props.initialOffsetFromBottom as number;
560
+ this.underlayTranslateY = new Animated.Value(100);
561
+ this.underlayScale = new Animated.Value(1);
562
+ this.indicatorTranslateY = new Animated.Value(-this.state.paddingTop | 0);
563
+ this.isReachedTop = false;
564
+ this.deviceLayoutCalled = false;
565
+ this.timeout = null;
566
+ }
567
+
568
+ /**
569
+ * Snap ActionSheet to Offset
570
+ */
571
+
572
+ snapToOffset = (offset: number) => {
573
+ const correction = this.state.deviceHeight * 0.15;
574
+ const extraScroll = this.props.extraScroll || 0;
575
+ const scrollOffset = this.props.gestureEnabled
576
+ ? offset + correction + extraScroll
577
+ : offset + correction + extraScroll;
578
+ this.currentOffsetFromBottom = offset / this.actionSheetHeight;
579
+ this._scrollTo(scrollOffset);
580
+ this.updateActionSheetPosition(scrollOffset);
581
+ };
582
+
583
+ // Open the ActionSheet
584
+ show = () => {
585
+ this.setModalVisible(true);
586
+ };
587
+
588
+ // Close the ActionSheet
589
+ hide = () => {
590
+ this.setModalVisible(false);
591
+ };
592
+
593
+ /**
594
+ * Open/Close the ActionSheet
595
+ */
596
+ setModalVisible = (visible: boolean) => {
597
+ let modalVisible = this.state.modalVisible;
598
+ if (visible !== undefined) {
599
+ if (modalVisible === visible) {
600
+ return;
601
+ }
602
+ modalVisible = !visible;
603
+ }
604
+
605
+ if (!modalVisible) {
606
+ this.setState({
607
+ modalVisible: true,
608
+ scrollable: this.props.gestureEnabled || false,
609
+ });
610
+ } else {
611
+ this._hideModal();
612
+ }
613
+ };
614
+
615
+ _hideAnimation() {
616
+ const {
617
+ animated,
618
+ closeAnimationDuration,
619
+ bottomOffset,
620
+ initialOffsetFromBottom,
621
+ extraScroll,
622
+ closable,
623
+ } = this.props;
624
+
625
+ Animated.parallel([
626
+ Animated.timing(this.opacityValue, {
627
+ toValue: closable ? 0 : 1,
628
+ duration: animated ? closeAnimationDuration : 1,
629
+ useNativeDriver: true,
630
+ }),
631
+ Animated.timing(this.transformValue, {
632
+ toValue: closable ? this.actionSheetHeight * 2 : 0,
633
+ duration: animated ? closeAnimationDuration : 1,
634
+ useNativeDriver: true,
635
+ }),
636
+ ]).start();
637
+
638
+ waitAsync((closeAnimationDuration as number) / 1.5).then(() => {
639
+ if (!closable) {
640
+ if (bottomOffset && bottomOffset > 0) {
641
+ this.snapToOffset(bottomOffset);
642
+ } else {
643
+ this._scrollTo(
644
+ ((this.actionSheetHeight * (initialOffsetFromBottom || 0)) as number) +
645
+ this.state.deviceHeight * 0.1 +
646
+ (extraScroll ?? 0),
647
+ true
648
+ );
649
+ this.currentOffsetFromBottom = initialOffsetFromBottom as number;
650
+ }
651
+
652
+ this.isClosing = false;
653
+ } else {
654
+ this._scrollTo(0, false);
655
+ this.currentOffsetFromBottom = initialOffsetFromBottom as number;
656
+ this.setState(
657
+ {
658
+ modalVisible: !closable,
659
+ },
660
+ () => {
661
+ this.isClosing = false;
662
+ this.isReachedTop = false;
663
+ this.props.onPositionChanged && this.props.onPositionChanged(false);
664
+ this.indicatorTranslateY.setValue(-this.state.paddingTop);
665
+ this.layoutHasCalled = false;
666
+ this.deviceLayoutCalled = false;
667
+ this.props.onClose && this.props.onClose();
668
+ }
669
+ );
670
+ }
671
+ });
672
+ }
673
+
674
+ _hideModal = () => {
675
+ if (this.isClosing) return;
676
+ this.isClosing = true;
677
+ this._hideAnimation();
678
+ };
679
+
680
+ measure = async (): Promise<number> => {
681
+ return new Promise((resolve) => {
682
+ setTimeout(() => {
683
+ UIManager.measureInWindow(
684
+ this.safeAreaViewRef.current._nativeTag,
685
+ (x, y, width, height) => {
686
+ safeAreaPaddingTop = height;
687
+ resolve(height === 0 ? 20 : height);
688
+ }
689
+ );
690
+ }, 100);
691
+ });
692
+ };
693
+
694
+ _showModal = async (event: LayoutChangeEvent) => {
695
+ const {gestureEnabled, delayActionSheetDraw, delayActionSheetDrawTime} = this.props;
696
+
697
+ if (!event?.nativeEvent) return;
698
+ const height = event.nativeEvent.layout.height;
699
+ if (this.layoutHasCalled) {
700
+ this.actionSheetHeight = height;
701
+ this._returnToPrevScrollPosition(height);
702
+ return;
703
+ } else {
704
+ this.layoutHasCalled = true;
705
+ this.actionSheetHeight = height;
706
+ const scrollOffset = this.getInitialScrollPosition();
707
+ this.isRecoiling = false;
708
+ if (Platform.OS === "ios") {
709
+ await waitAsync(delayActionSheetDrawTime as number);
710
+ } else {
711
+ if (delayActionSheetDraw) {
712
+ await waitAsync(delayActionSheetDrawTime as number);
713
+ }
714
+ }
715
+ this._scrollTo(scrollOffset, false);
716
+ this.prevScroll = scrollOffset;
717
+ if (Platform.OS === "ios") {
718
+ await waitAsync(delayActionSheetDrawTime ?? 0 / 2);
719
+ } else {
720
+ if (delayActionSheetDraw) {
721
+ await waitAsync(delayActionSheetDrawTime ?? 0 / 2);
722
+ }
723
+ }
724
+ this._openAnimation(scrollOffset);
725
+ this.underlayScale.setValue(1);
726
+ this.underlayTranslateY.setValue(100);
727
+ if (!gestureEnabled) {
728
+ this.props.onPositionChanged && this.props.onPositionChanged(true);
729
+ }
730
+ this.updateActionSheetPosition(scrollOffset);
731
+ }
732
+ };
733
+
734
+ _openAnimation = (scrollOffset: number) => {
735
+ const {bounciness, bounceOnOpen, animated, openAnimationSpeed} = this.props;
736
+
737
+ if (animated) {
738
+ this.transformValue.setValue(scrollOffset);
739
+ Animated.parallel([
740
+ Animated.spring(this.transformValue, {
741
+ toValue: 0,
742
+ bounciness: bounceOnOpen ? bounciness : 1,
743
+ speed: openAnimationSpeed,
744
+ useNativeDriver: true,
745
+ }),
746
+ Animated.timing(this.opacityValue, {
747
+ toValue: 1,
748
+ duration: 150,
749
+ useNativeDriver: true,
750
+ }),
751
+ ]).start();
752
+ } else {
753
+ this.opacityValue.setValue(1);
754
+ }
755
+ };
756
+
757
+ _onScrollBegin = async () => {};
758
+
759
+ _onScrollBeginDrag = async (event: NativeSyntheticEvent<NativeScrollEvent>) => {
760
+ this.prevScroll = event.nativeEvent.contentOffset.y;
761
+ };
762
+
763
+ _applyHeightLimiter() {
764
+ if (this.actionSheetHeight > this.state.deviceHeight) {
765
+ this.actionSheetHeight =
766
+ this.actionSheetHeight - (this.actionSheetHeight - this.state.deviceHeight);
767
+ }
768
+ }
769
+
770
+ _onScrollEnd = async (event: NativeSyntheticEvent<NativeScrollEvent>) => {
771
+ const {springOffset, extraScroll} = this.props;
772
+ const verticalOffset = event.nativeEvent.contentOffset.y;
773
+
774
+ const correction = this.state.deviceHeight * 0.15;
775
+ if (this.isRecoiling) return;
776
+
777
+ if (this.prevScroll < verticalOffset) {
778
+ if (verticalOffset - this.prevScroll > (springOffset ?? 0) * 0.75) {
779
+ this.isRecoiling = true;
780
+
781
+ this._applyHeightLimiter();
782
+ this.currentOffsetFromBottom =
783
+ this.currentOffsetFromBottom < (this.props.initialOffsetFromBottom ?? 0)
784
+ ? (this.props.initialOffsetFromBottom as number)
785
+ : 1;
786
+ const scrollOffset =
787
+ this.actionSheetHeight * this.currentOffsetFromBottom + correction + (extraScroll ?? 0);
788
+
789
+ this._scrollTo(scrollOffset);
790
+ await waitAsync(300);
791
+ this.isRecoiling = false;
792
+ this.props.onPositionChanged && this.props.onPositionChanged(true);
793
+ } else {
794
+ this._returnToPrevScrollPosition(this.actionSheetHeight);
795
+ }
796
+ } else {
797
+ if (this.prevScroll - verticalOffset > (springOffset ?? 0)) {
798
+ this._hideModal();
799
+ } else {
800
+ if (this.isRecoiling) {
801
+ return;
802
+ }
803
+
804
+ this.isRecoiling = true;
805
+ this._returnToPrevScrollPosition(this.actionSheetHeight);
806
+ await waitAsync(300);
807
+ this.isRecoiling = false;
808
+ }
809
+ }
810
+ };
811
+
812
+ updateActionSheetPosition(scrollPosition: number) {
813
+ if (this.actionSheetHeight >= this.state.deviceHeight - 1) {
814
+ const correction = this.state.deviceHeight * 0.15;
815
+ const distanceFromTop = this.actionSheetHeight + correction - scrollPosition;
816
+ if (distanceFromTop < safeAreaPaddingTop) {
817
+ if (!this.props.drawUnderStatusBar) return;
818
+ this.indicatorTranslateY.setValue(0);
819
+ } else {
820
+ this.indicatorTranslateY.setValue(-safeAreaPaddingTop);
821
+ }
822
+ }
823
+ }
824
+
825
+ _returnToPrevScrollPosition(height: number) {
826
+ const correction = this.state.deviceHeight * 0.15;
827
+ const scrollOffset =
828
+ height * this.currentOffsetFromBottom + correction + (this.props.extraScroll ?? 0);
829
+
830
+ this.updateActionSheetPosition(scrollOffset);
831
+ this._scrollTo(scrollOffset);
832
+ }
833
+
834
+ _scrollTo = (y: number, animated = true) => {
835
+ this.scrollAnimationEndValue = y;
836
+ this.prevScroll = y;
837
+ this.scrollViewRef.current?._listRef._scrollRef.scrollTo({
838
+ x: 0,
839
+ y: this.scrollAnimationEndValue,
840
+ animated,
841
+ });
842
+ };
843
+
844
+ _onTouchMove = () => {
845
+ if (this.props.closeOnTouchBackdrop) {
846
+ this._hideModal();
847
+ }
848
+ this.setState({
849
+ scrollable: false,
850
+ });
851
+ };
852
+
853
+ _onTouchStart = () => {
854
+ if (this.props.closeOnTouchBackdrop) {
855
+ this._hideModal();
856
+ }
857
+ this.setState({
858
+ scrollable: false,
859
+ });
860
+ };
861
+
862
+ _onTouchEnd = () => {
863
+ this._returnToPrevScrollPosition(this.actionSheetHeight);
864
+ if (this.props.gestureEnabled) {
865
+ this.setState({
866
+ scrollable: true,
867
+ });
868
+ }
869
+ };
870
+
871
+ _onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
872
+ this.offsetY = event.nativeEvent.contentOffset.y;
873
+
874
+ const correction = this.state.deviceHeight * 0.15;
875
+ const distanceFromTop = this.actionSheetHeight + correction - this.offsetY;
876
+
877
+ if (this.actionSheetHeight < this.offsetY) {
878
+ if (!this.isReachedTop) {
879
+ this.isReachedTop = true;
880
+ this.props.onPositionChanged && this.props.onPositionChanged(true);
881
+ }
882
+ } else {
883
+ if (this.isReachedTop) {
884
+ this.isReachedTop = false;
885
+ this.props.onPositionChanged && this.props.onPositionChanged(false);
886
+ }
887
+ }
888
+
889
+ if (this.actionSheetHeight >= this.state.deviceHeight - 1) {
890
+ if (distanceFromTop < safeAreaPaddingTop) {
891
+ if (!this.props.drawUnderStatusBar) return;
892
+
893
+ this.indicatorTranslateY.setValue(
894
+ -this.state.paddingTop + (safeAreaPaddingTop - distanceFromTop)
895
+ );
896
+ } else {
897
+ this.indicatorTranslateY.setValue(-safeAreaPaddingTop);
898
+ }
899
+ }
900
+ };
901
+
902
+ _onRequestClose = () => {
903
+ if (this.props.closeOnPressBack) this._hideModal();
904
+ };
905
+
906
+ _onTouchBackdrop = () => {
907
+ if (this.props.closeOnTouchBackdrop) {
908
+ this._hideModal();
909
+ }
910
+ };
911
+
912
+ componentDidMount() {
913
+ Keyboard.addListener(
914
+ Platform.OS === "android" ? "keyboardDidShow" : "keyboardWillShow",
915
+ this._onKeyboardShow
916
+ );
917
+
918
+ Keyboard.addListener(
919
+ Platform.OS === "android" ? "keyboardDidHide" : "keyboardWillHide",
920
+ this._onKeyboardHide
921
+ );
922
+ }
923
+
924
+ _onKeyboardShow = (event: KeyboardEvent) => {
925
+ this.setState({
926
+ keyboard: true,
927
+ });
928
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
929
+ const ReactNativeVersion = require("react-native/Libraries/Core/ReactNativeVersion");
930
+
931
+ let v = ReactNativeVersion.version.major + ReactNativeVersion.version.minor;
932
+ v = parseInt(v);
933
+
934
+ if (v >= 63 || Platform.OS === "ios") {
935
+ const keyboardHeight = event.endCoordinates.height;
936
+ const {height: windowHeight} = Dimensions.get("window");
937
+
938
+ const currentlyFocusedField = TextInput.State.currentlyFocusedField
939
+ ? findNodeHandle(TextInput.State.currentlyFocusedField())
940
+ : TextInput.State.currentlyFocusedField();
941
+
942
+ if (!currentlyFocusedField) {
943
+ return;
944
+ }
945
+
946
+ UIManager.measure(currentlyFocusedField, (originX, originY, width, height, pageX, pageY) => {
947
+ const fieldHeight = height;
948
+ const fieldTop = pageY;
949
+ const gap = windowHeight - keyboardHeight - (fieldTop + fieldHeight);
950
+ if (gap >= 0) {
951
+ return;
952
+ }
953
+ const toValue = this.props.keyboardMode === "position" ? -(keyboardHeight + 15) : gap - 10;
954
+
955
+ Animated.timing(this.transformValue, {
956
+ toValue,
957
+ duration: 250,
958
+ useNativeDriver: true,
959
+ }).start();
960
+ });
961
+ } else {
962
+ Animated.timing(this.transformValue, {
963
+ toValue: -10,
964
+ duration: 250,
965
+ useNativeDriver: true,
966
+ }).start();
967
+ }
968
+ };
969
+
970
+ /**
971
+ * Attach this to any child ScrollView Component's onScrollEndDrag,
972
+ * onMomentumScrollEnd,onScrollAnimationEnd callbacks to handle the ActionSheet
973
+ * closing and bouncing back properly.
974
+ */
975
+
976
+ handleChildScrollEnd = async () => {
977
+ if (this.offsetY > this.prevScroll) return;
978
+ if (this.prevScroll - (this.props.springOffset ?? 0) > this.offsetY) {
979
+ const scrollOffset = this.getInitialScrollPosition();
980
+ if (this.offsetY > scrollOffset - 100) {
981
+ this.isRecoiling = true;
982
+ this._scrollTo(scrollOffset);
983
+ this.currentOffsetFromBottom = this.props.initialOffsetFromBottom ?? 0;
984
+ this.prevScroll = scrollOffset;
985
+ setTimeout(() => {
986
+ this.isRecoiling = false;
987
+ }, 500);
988
+ } else {
989
+ this._hideModal();
990
+ }
991
+ } else {
992
+ this.isRecoiling = true;
993
+ this._scrollTo(this.prevScroll, true);
994
+ setTimeout(() => {
995
+ this.isRecoiling = false;
996
+ }, 500);
997
+ }
998
+ };
999
+
1000
+ _onKeyboardHide = () => {
1001
+ this.setState({
1002
+ keyboard: false,
1003
+ });
1004
+ this.opacityValue.setValue(1);
1005
+ Animated.timing(this.transformValue, {
1006
+ toValue: 0,
1007
+ duration: 100,
1008
+ useNativeDriver: true,
1009
+ }).start();
1010
+ };
1011
+
1012
+ componentWillUnmount() {
1013
+ Keyboard.removeListener(
1014
+ Platform.OS === "android" ? "keyboardDidShow" : "keyboardWillShow",
1015
+ this._onKeyboardShow
1016
+ );
1017
+
1018
+ Keyboard.removeListener(
1019
+ Platform.OS === "android" ? "keyboardDidHide" : "keyboardWillHide",
1020
+ this._onKeyboardHide
1021
+ );
1022
+ }
1023
+
1024
+ _onDeviceLayout = async (_event: any) => {
1025
+ const event = {..._event};
1026
+
1027
+ if (this.timeout) {
1028
+ clearTimeout(this.timeout);
1029
+ }
1030
+
1031
+ this.timeout = setTimeout(async () => {
1032
+ let safeMarginFromTop = 0;
1033
+ const measuredPadding =
1034
+ Platform.OS === "ios" ? await this.measure() : StatusBar.currentHeight;
1035
+
1036
+ if (!this.props.drawUnderStatusBar) {
1037
+ if (Platform.OS === "android" && !this.props.statusBarTranslucent) return;
1038
+ safeMarginFromTop = measuredPadding ?? 0;
1039
+ this.indicatorTranslateY.setValue(-(measuredPadding as number));
1040
+ } else {
1041
+ this.updateActionSheetPosition(this.offsetY);
1042
+ }
1043
+ const height = event.nativeEvent.layout.height - safeMarginFromTop;
1044
+ const width = Dimensions.get("window").width;
1045
+ if (
1046
+ height?.toFixed(0) === calculatedDeviceHeight?.toFixed(0) &&
1047
+ width?.toFixed(0) === this.state.deviceWidth?.toFixed(0) &&
1048
+ this.deviceLayoutCalled
1049
+ )
1050
+ return;
1051
+ this.deviceLayoutCalled = true;
1052
+ calculatedDeviceHeight = height;
1053
+ this.setState({
1054
+ deviceHeight: height,
1055
+ deviceWidth: width,
1056
+ portrait: height > width,
1057
+ paddingTop: measuredPadding as any,
1058
+ });
1059
+ }, 1);
1060
+ };
1061
+
1062
+ getInitialScrollPosition() {
1063
+ this._applyHeightLimiter();
1064
+ const correction = this.state.deviceHeight * 0.15;
1065
+ const scrollPosition = this.props.gestureEnabled
1066
+ ? this.actionSheetHeight * (this.props.initialOffsetFromBottom ?? 0) +
1067
+ correction +
1068
+ (this.props.extraScroll ?? 0)
1069
+ : this.actionSheetHeight + correction + (this.props.extraScroll ?? 0);
1070
+ this.currentOffsetFromBottom = this.props.initialOffsetFromBottom ?? 0;
1071
+ this.updateActionSheetPosition(scrollPosition);
1072
+
1073
+ return scrollPosition;
1074
+ }
1075
+
1076
+ _keyExtractor = (item: any) => item;
1077
+
1078
+ render() {
1079
+ const {scrollable, modalVisible, keyboard} = this.state;
1080
+ const {
1081
+ onOpen,
1082
+ overlayColor,
1083
+ gestureEnabled,
1084
+ elevation,
1085
+ indicatorColor,
1086
+ defaultOverlayOpacity,
1087
+ children,
1088
+ containerStyle,
1089
+ CustomHeaderComponent,
1090
+ headerAlwaysVisible,
1091
+ keyboardShouldPersistTaps,
1092
+ statusBarTranslucent,
1093
+ } = this.props;
1094
+
1095
+ return (
1096
+ <Modal
1097
+ animationType="none"
1098
+ statusBarTranslucent={statusBarTranslucent}
1099
+ // testID={testID}
1100
+ supportedOrientations={SUPPORTED_ORIENTATIONS}
1101
+ transparent
1102
+ visible={modalVisible}
1103
+ onRequestClose={this._onRequestClose}
1104
+ onShow={onOpen}
1105
+ >
1106
+ <Animated.View
1107
+ style={[
1108
+ styles.parentContainer,
1109
+ {
1110
+ opacity: this.opacityValue,
1111
+ width: this.state.deviceWidth,
1112
+ },
1113
+ ]}
1114
+ onLayout={this._onDeviceLayout}
1115
+ >
1116
+ <SafeAreaView ref={this.safeAreaViewRef} style={styles.safearea}>
1117
+ <View />
1118
+ </SafeAreaView>
1119
+ <FlatList
1120
+ ref={this.scrollViewRef}
1121
+ bounces={false}
1122
+ contentContainerStyle={{
1123
+ width: this.state.deviceWidth,
1124
+ }}
1125
+ data={dummyData}
1126
+ keyExtractor={this._keyExtractor}
1127
+ keyboardShouldPersistTaps={keyboardShouldPersistTaps}
1128
+ renderItem={() => (
1129
+ <View
1130
+ style={{
1131
+ width: "100%",
1132
+ }}
1133
+ >
1134
+ <Animated.View
1135
+ style={{
1136
+ height: "100%",
1137
+ width: "100%",
1138
+ position: "absolute",
1139
+ zIndex: 1,
1140
+ backgroundColor: overlayColor,
1141
+ opacity: defaultOverlayOpacity,
1142
+ }}
1143
+ onTouchEnd={this._onTouchBackdrop}
1144
+ onTouchMove={this._onTouchBackdrop}
1145
+ onTouchStart={this._onTouchBackdrop}
1146
+ />
1147
+ <View
1148
+ style={{
1149
+ height: this.state.deviceHeight * 1.15,
1150
+ width: "100%",
1151
+ zIndex: 10,
1152
+ }}
1153
+ onTouchEnd={this._onTouchEnd}
1154
+ onTouchMove={this._onTouchMove}
1155
+ onTouchStart={this._onTouchStart}
1156
+ >
1157
+ <TouchableOpacity
1158
+ style={{
1159
+ height: this.state.deviceHeight * 1.15,
1160
+ width: "100%",
1161
+ }}
1162
+ onLongPress={this._onTouchBackdrop}
1163
+ onPress={this._onTouchBackdrop}
1164
+ />
1165
+ </View>
1166
+
1167
+ <Animated.View
1168
+ style={[
1169
+ styles.container,
1170
+ {
1171
+ borderRadius: 10,
1172
+ },
1173
+ containerStyle,
1174
+ {
1175
+ ...getElevation(elevation),
1176
+ zIndex: 11,
1177
+ opacity: this.opacityValue,
1178
+ transform: [
1179
+ {
1180
+ translateY: this.transformValue,
1181
+ },
1182
+ ],
1183
+ maxHeight: this.state.deviceHeight,
1184
+ },
1185
+ ]}
1186
+ onLayout={this._showModal}
1187
+ >
1188
+ <Animated.View
1189
+ style={{
1190
+ maxHeight: this.state.deviceHeight,
1191
+ transform: [
1192
+ {
1193
+ translateY: this.indicatorTranslateY,
1194
+ },
1195
+ ],
1196
+ marginTop: this.state.paddingTop,
1197
+ }}
1198
+ >
1199
+ {gestureEnabled || headerAlwaysVisible ? (
1200
+ CustomHeaderComponent ? (
1201
+ CustomHeaderComponent
1202
+ ) : (
1203
+ <Animated.View
1204
+ style={[styles.indicator, {backgroundColor: indicatorColor}]}
1205
+ />
1206
+ )
1207
+ ) : null}
1208
+
1209
+ {children}
1210
+ </Animated.View>
1211
+ </Animated.View>
1212
+ </View>
1213
+ )}
1214
+ scrollEnabled={scrollable && !keyboard}
1215
+ scrollEventThrottle={5}
1216
+ scrollsToTop={false}
1217
+ showsVerticalScrollIndicator={false}
1218
+ style={[
1219
+ styles.scrollView,
1220
+ {
1221
+ width: this.state.deviceWidth,
1222
+ },
1223
+ ]}
1224
+ onMomentumScrollBegin={this._onScrollBegin}
1225
+ onMomentumScrollEnd={this._onScrollEnd}
1226
+ onScroll={this._onScroll}
1227
+ onScrollBeginDrag={this._onScrollBeginDrag}
1228
+ onTouchEnd={this._onTouchEnd}
1229
+ />
1230
+ </Animated.View>
1231
+ </Modal>
1232
+ );
1233
+ }
1234
+ }