@momo-kits/native-kits 0.157.1-beta.9-debug → 0.157.1-com.1-debug

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 (369) hide show
  1. package/compose/build.gradle.kts +1 -1
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +123 -0
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +224 -0
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +350 -0
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +360 -0
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +449 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +21 -7
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +192 -0
  17. package/gradle.properties +1 -1
  18. package/ios/Input/Input.swift +4 -0
  19. package/local.properties +2 -2
  20. package/package.json +1 -1
  21. package/src/doctor/README.md +73 -0
  22. package/src/doctor/package-lock.json +885 -0
  23. package/src/doctor/package.json +44 -0
  24. package/src/doctor/publish.sh +27 -0
  25. package/src/doctor/src/Users.json +112 -0
  26. package/src/doctor/src/Whitelist.json +6 -0
  27. package/src/doctor/src/commands/check.ts +81 -0
  28. package/src/doctor/src/commands/doctor.ts +193 -0
  29. package/src/doctor/src/index.ts +35 -0
  30. package/src/doctor/src/logger.ts +84 -0
  31. package/src/doctor/src/task/native.ts +21 -0
  32. package/src/doctor/src/task/utils.ts +20 -0
  33. package/src/doctor/src/utils/checkCoreDependencies.ts +138 -0
  34. package/src/doctor/src/utils/checkDeletedPackage.ts +53 -0
  35. package/src/doctor/src/utils/checkDeprecatedPackages.ts +168 -0
  36. package/src/doctor/src/utils/checkDeprecatedVersion.ts +60 -0
  37. package/src/doctor/src/utils/checkShareDependencies.ts +251 -0
  38. package/src/doctor/src/utils/checkWrongVersionCommunityPackage.ts +64 -0
  39. package/src/doctor/src/utils/getErrorMessage.ts +84 -0
  40. package/src/doctor/src/utils/scanComponentUsage.ts +206 -0
  41. package/src/doctor/src/utils/scanFoundationImports.ts +169 -0
  42. package/src/doctor/src/utils/scanMaxApiUsage.ts +86 -0
  43. package/src/doctor/src/utils/scanNativeModulesUsage.ts +78 -0
  44. package/src/doctor/src/utils/sendMessage.ts +28 -0
  45. package/src/doctor/tsconfig.json +14 -0
  46. package/src/doctor/yarn.lock +492 -0
  47. package/src/foundations/Application/BottomSheet.tsx +358 -0
  48. package/src/foundations/Application/BottomTab/BottomTabBar.tsx +320 -0
  49. package/src/foundations/Application/BottomTab/CustomBottomTabItem.tsx +155 -0
  50. package/src/foundations/Application/BottomTab/TabBarIcon.tsx +113 -0
  51. package/src/foundations/Application/BottomTab/index.tsx +449 -0
  52. package/src/foundations/Application/Components/BackgroundImageView.tsx +126 -0
  53. package/src/foundations/Application/Components/HeaderAnimated.tsx +69 -0
  54. package/src/foundations/Application/Components/HeaderBackground.tsx +83 -0
  55. package/src/foundations/Application/Components/HeaderExtendHeader.tsx +225 -0
  56. package/src/foundations/Application/Components/HeaderLeft.tsx +93 -0
  57. package/src/foundations/Application/Components/HeaderRight.tsx +444 -0
  58. package/src/foundations/Application/Components/HeaderTitle.tsx +596 -0
  59. package/src/foundations/Application/Components/NavigationButton.tsx +76 -0
  60. package/src/foundations/Application/Components/SearchHeader.tsx +127 -0
  61. package/src/foundations/Application/Localize.ts +44 -0
  62. package/src/foundations/Application/ModalScreen.tsx +148 -0
  63. package/src/foundations/Application/Navigation.ts +63 -0
  64. package/src/foundations/Application/NavigationContainer.tsx +245 -0
  65. package/src/foundations/Application/Navigator.ts +171 -0
  66. package/src/foundations/Application/ScaleSizeProvider.tsx +16 -0
  67. package/src/foundations/Application/StackScreen.tsx +420 -0
  68. package/src/foundations/Application/TooltipPortal.tsx +127 -0
  69. package/src/foundations/Application/WidgetContainer.tsx +162 -0
  70. package/src/foundations/Application/index.ts +34 -0
  71. package/src/foundations/Application/types.ts +350 -0
  72. package/src/foundations/Application/utils.tsx +239 -0
  73. package/src/foundations/Assets/DotAnimation.json +256 -0
  74. package/src/foundations/Assets/SpinnerAnimation.json +1027 -0
  75. package/src/foundations/Assets/icon.json +4052 -0
  76. package/src/foundations/Assets/icon_bank.json +506 -0
  77. package/src/foundations/Assets/language.json +208 -0
  78. package/src/foundations/Assets/lottie_circle_loader.json +1 -0
  79. package/src/foundations/Assets/pinAnimation.json +1 -0
  80. package/src/foundations/Assets/unpinAnimation.json +1 -0
  81. package/src/foundations/Badge/Badge.tsx +104 -0
  82. package/src/foundations/Badge/BadgeDot.tsx +35 -0
  83. package/src/foundations/Badge/BadgeDotAnimation.tsx +95 -0
  84. package/src/foundations/Badge/BadgeRibbon.tsx +112 -0
  85. package/src/foundations/Badge/Shape.tsx +29 -0
  86. package/src/foundations/Badge/index.tsx +8 -0
  87. package/src/foundations/Badge/styles.ts +125 -0
  88. package/src/foundations/Badge/types.ts +68 -0
  89. package/src/foundations/Button/index.tsx +371 -0
  90. package/src/foundations/Button/styles.ts +65 -0
  91. package/src/foundations/CheckBox/index.tsx +104 -0
  92. package/src/foundations/CheckBox/styles.ts +17 -0
  93. package/src/foundations/CheckBox/types.ts +37 -0
  94. package/src/foundations/Consts/colors+spacing+radius.ts +232 -0
  95. package/src/foundations/Consts/index.ts +4 -0
  96. package/src/foundations/Consts/styles.ts +52 -0
  97. package/src/foundations/Consts/theme.ts +121 -0
  98. package/src/foundations/Context/index.ts +27 -0
  99. package/src/foundations/Divider/DashDivider.tsx +46 -0
  100. package/src/foundations/Divider/index.tsx +45 -0
  101. package/src/foundations/FoundationList/index.tsx +12 -0
  102. package/src/foundations/FoundationList/types.ts +7 -0
  103. package/src/foundations/Icon/index.tsx +57 -0
  104. package/src/foundations/Icon/types.ts +32 -0
  105. package/src/foundations/IconButton/index.tsx +144 -0
  106. package/src/foundations/IconButton/styles.ts +20 -0
  107. package/src/foundations/Image/index.tsx +115 -0
  108. package/src/foundations/Image/styles.ts +7 -0
  109. package/src/foundations/Image/types.ts +7 -0
  110. package/src/foundations/Input/Input.tsx +280 -0
  111. package/src/foundations/Input/InputDropDown.tsx +161 -0
  112. package/src/foundations/Input/InputMoney.tsx +325 -0
  113. package/src/foundations/Input/InputOTP.tsx +299 -0
  114. package/src/foundations/Input/InputPhoneNumber.tsx +287 -0
  115. package/src/foundations/Input/InputSearch.tsx +351 -0
  116. package/src/foundations/Input/InputTextArea.tsx +218 -0
  117. package/src/foundations/Input/SystemTextInput.tsx +44 -0
  118. package/src/foundations/Input/TextTyping.tsx +115 -0
  119. package/src/foundations/Input/common.tsx +243 -0
  120. package/src/foundations/Input/index.tsx +373 -0
  121. package/src/foundations/Input/styles.ts +226 -0
  122. package/src/foundations/Input/utils.ts +97 -0
  123. package/src/foundations/Layout/Card.tsx +108 -0
  124. package/src/foundations/Layout/FloatingButton.tsx +179 -0
  125. package/src/foundations/Layout/GridSystem.tsx +137 -0
  126. package/src/foundations/Layout/Item.tsx +59 -0
  127. package/src/foundations/Layout/ItemList.tsx +66 -0
  128. package/src/foundations/Layout/ItemSectionList.tsx +40 -0
  129. package/src/foundations/Layout/Screen.tsx +644 -0
  130. package/src/foundations/Layout/Section.tsx +103 -0
  131. package/src/foundations/Layout/TrackingScope.tsx +18 -0
  132. package/src/foundations/Layout/index.ts +34 -0
  133. package/src/foundations/Layout/styles.ts +95 -0
  134. package/src/foundations/Layout/types.ts +40 -0
  135. package/src/foundations/Layout/utils.ts +47 -0
  136. package/src/foundations/Loader/DotLoader.tsx +37 -0
  137. package/src/foundations/Loader/Loader.tsx +13 -0
  138. package/src/foundations/Loader/ProgressBar.tsx +45 -0
  139. package/src/foundations/Loader/Spinner.tsx +29 -0
  140. package/src/foundations/Loader/index.tsx +6 -0
  141. package/src/foundations/Loader/styles.ts +10 -0
  142. package/src/foundations/Loader/types.ts +35 -0
  143. package/src/foundations/Loader/utils.ts +25 -0
  144. package/src/foundations/Pagination/Dot.tsx +19 -0
  145. package/src/foundations/Pagination/PaginationDot.tsx +44 -0
  146. package/src/foundations/Pagination/PaginationNumber.tsx +31 -0
  147. package/src/foundations/Pagination/PaginationScroll.tsx +99 -0
  148. package/src/foundations/Pagination/PaginationWhiteDot.tsx +43 -0
  149. package/src/foundations/Pagination/index.tsx +25 -0
  150. package/src/foundations/Pagination/styles.ts +51 -0
  151. package/src/foundations/Pagination/types.ts +40 -0
  152. package/src/foundations/Popup/PopupNotify.tsx +276 -0
  153. package/src/foundations/Popup/PopupPromotion.tsx +118 -0
  154. package/src/foundations/Popup/index.tsx +4 -0
  155. package/src/foundations/Popup/types.ts +96 -0
  156. package/src/foundations/Radio/index.tsx +108 -0
  157. package/src/foundations/Radio/styles.ts +15 -0
  158. package/src/foundations/Radio/types.ts +31 -0
  159. package/src/foundations/Skeleton/index.tsx +118 -0
  160. package/src/foundations/Skeleton/styles.ts +5 -0
  161. package/src/foundations/Skeleton/types.ts +6 -0
  162. package/src/foundations/Switch/index.tsx +68 -0
  163. package/src/foundations/Switch/styles.ts +25 -0
  164. package/src/foundations/Switch/types.ts +19 -0
  165. package/src/foundations/Tag/index.tsx +128 -0
  166. package/src/foundations/Tag/types.ts +41 -0
  167. package/src/foundations/Text/index.tsx +241 -0
  168. package/src/foundations/Text/styles.ts +78 -0
  169. package/src/foundations/Text/types.ts +53 -0
  170. package/src/foundations/Text/utils.ts +63 -0
  171. package/src/foundations/Title/index.tsx +285 -0
  172. package/src/foundations/Title/styles.ts +55 -0
  173. package/src/foundations/Title/types.ts +21 -0
  174. package/src/foundations/index.ts +50 -0
  175. package/src/foundations/package.json +35 -0
  176. package/src/foundations/publish.sh +17 -0
  177. package/src/libs/AutoComplete/index.tsx +88 -0
  178. package/src/libs/AutoComplete/package.json +16 -0
  179. package/src/libs/AutoComplete/publish.sh +16 -0
  180. package/src/libs/AutoComplete/styles.ts +15 -0
  181. package/src/libs/AutoComplete/types.ts +60 -0
  182. package/src/libs/Avatar/index.tsx +146 -0
  183. package/src/libs/Avatar/package.json +16 -0
  184. package/src/libs/Avatar/publish.sh +20 -0
  185. package/src/libs/Avatar/styles.ts +18 -0
  186. package/src/libs/Avatar/types.ts +57 -0
  187. package/src/libs/Badge/Badge.tsx +70 -0
  188. package/src/libs/Badge/BadgeDot.tsx +11 -0
  189. package/src/libs/Badge/BadgeRibbon.tsx +122 -0
  190. package/src/libs/Badge/Shape.tsx +29 -0
  191. package/src/libs/Badge/index.tsx +7 -0
  192. package/src/libs/Badge/package.json +16 -0
  193. package/src/libs/Badge/publish.sh +18 -0
  194. package/src/libs/Badge/styles.ts +55 -0
  195. package/src/libs/Badge/types.ts +63 -0
  196. package/src/libs/Calendar/CalendarPro.tsx +307 -0
  197. package/src/libs/Calendar/Day.tsx +150 -0
  198. package/src/libs/Calendar/HeaderControl.tsx +55 -0
  199. package/src/libs/Calendar/LunarDateConverter.ts +228 -0
  200. package/src/libs/Calendar/LunarService.ts +206 -0
  201. package/src/libs/Calendar/Month.tsx +118 -0
  202. package/src/libs/Calendar/MonthList.tsx +226 -0
  203. package/src/libs/Calendar/TabHeader.tsx +91 -0
  204. package/src/libs/Calendar/Util.ts +288 -0
  205. package/src/libs/Calendar/holidayData.ts +118 -0
  206. package/src/libs/Calendar/index.tsx +383 -0
  207. package/src/libs/Calendar/package.json +18 -0
  208. package/src/libs/Calendar/publish.sh +18 -0
  209. package/src/libs/Calendar/styles.ts +122 -0
  210. package/src/libs/Calendar/types.ts +212 -0
  211. package/src/libs/Carousel/animation.ts +62 -0
  212. package/src/libs/Carousel/index.tsx +517 -0
  213. package/src/libs/Carousel/package.json +18 -0
  214. package/src/libs/Carousel/publish.sh +16 -0
  215. package/src/libs/Carousel/types.ts +71 -0
  216. package/src/libs/Chip/index.tsx +164 -0
  217. package/src/libs/Chip/package.json +16 -0
  218. package/src/libs/Chip/publish.sh +16 -0
  219. package/src/libs/Chip/styles.ts +20 -0
  220. package/src/libs/Chip/types.ts +72 -0
  221. package/src/libs/Collapse/index.tsx +305 -0
  222. package/src/libs/Collapse/package.json +16 -0
  223. package/src/libs/Collapse/publish.sh +18 -0
  224. package/src/libs/Collapse/styles.ts +37 -0
  225. package/src/libs/Collapse/types.ts +84 -0
  226. package/src/libs/DateTimePicker/WheelPicker.tsx +163 -0
  227. package/src/libs/DateTimePicker/WheelPickerItem.tsx +58 -0
  228. package/src/libs/DateTimePicker/index.tsx +188 -0
  229. package/src/libs/DateTimePicker/package.json +16 -0
  230. package/src/libs/DateTimePicker/publish.sh +17 -0
  231. package/src/libs/DateTimePicker/styles.ts +31 -0
  232. package/src/libs/DateTimePicker/types.ts +102 -0
  233. package/src/libs/DateTimePicker/utils.ts +114 -0
  234. package/src/libs/Information/index.tsx +129 -0
  235. package/src/libs/Information/package.json +16 -0
  236. package/src/libs/Information/publish.sh +18 -0
  237. package/src/libs/Information/styles.ts +34 -0
  238. package/src/libs/Information/types.ts +79 -0
  239. package/src/libs/Logo/index.tsx +39 -0
  240. package/src/libs/Logo/package.json +17 -0
  241. package/src/libs/Logo/publish.sh +16 -0
  242. package/src/libs/Logo/styles.ts +25 -0
  243. package/src/libs/Logo/types.ts +13 -0
  244. package/src/libs/ProgressInfo/ProgressInfoHorizontal.tsx +128 -0
  245. package/src/libs/ProgressInfo/ProgressInfoIcon.tsx +88 -0
  246. package/src/libs/ProgressInfo/ProgressInfoVertical.tsx +85 -0
  247. package/src/libs/ProgressInfo/index.tsx +22 -0
  248. package/src/libs/ProgressInfo/package.json +16 -0
  249. package/src/libs/ProgressInfo/publish.sh +16 -0
  250. package/src/libs/ProgressInfo/styles.ts +46 -0
  251. package/src/libs/ProgressInfo/types.ts +60 -0
  252. package/src/libs/ProgressInfo/yarn.lock +8 -0
  253. package/src/libs/Rating/index.tsx +74 -0
  254. package/src/libs/Rating/package.json +16 -0
  255. package/src/libs/Rating/publish.sh +18 -0
  256. package/src/libs/Rating/type.ts +25 -0
  257. package/src/libs/Slider/Label.tsx +33 -0
  258. package/src/libs/Slider/helpers.ts +35 -0
  259. package/src/libs/Slider/hooks.tsx +218 -0
  260. package/src/libs/Slider/index.tsx +453 -0
  261. package/src/libs/Slider/package.json +16 -0
  262. package/src/libs/Slider/publish.sh +18 -0
  263. package/src/libs/Slider/styles.ts +36 -0
  264. package/src/libs/Stepper/NumberView.tsx +64 -0
  265. package/src/libs/Stepper/StepperButton.tsx +37 -0
  266. package/src/libs/Stepper/index.tsx +139 -0
  267. package/src/libs/Stepper/package.json +16 -0
  268. package/src/libs/Stepper/publish.sh +17 -0
  269. package/src/libs/Stepper/styles.ts +44 -0
  270. package/src/libs/Stepper/types.ts +154 -0
  271. package/src/libs/Steps/StepIcon.tsx +86 -0
  272. package/src/libs/Steps/StepsHorizontal.tsx +189 -0
  273. package/src/libs/Steps/StepsVertical.tsx +133 -0
  274. package/src/libs/Steps/index.tsx +20 -0
  275. package/src/libs/Steps/package.json +16 -0
  276. package/src/libs/Steps/publish.sh +16 -0
  277. package/src/libs/Steps/styles.ts +46 -0
  278. package/src/libs/Steps/types.ts +159 -0
  279. package/src/libs/Steps/utils.ts +175 -0
  280. package/src/libs/SuggestAction/SuggestActionView.tsx +124 -0
  281. package/src/libs/SuggestAction/index.tsx +3 -0
  282. package/src/libs/SuggestAction/package.json +16 -0
  283. package/src/libs/SuggestAction/publish.sh +16 -0
  284. package/src/libs/SuggestAction/styles.ts +30 -0
  285. package/src/libs/SuggestAction/types.ts +36 -0
  286. package/src/libs/Swipe/SwipeView.tsx +151 -0
  287. package/src/libs/Swipe/index.tsx +5 -0
  288. package/src/libs/Swipe/package.json +16 -0
  289. package/src/libs/Swipe/publish.sh +16 -0
  290. package/src/libs/Swipe/styles.ts +16 -0
  291. package/src/libs/Swipe/types.ts +109 -0
  292. package/src/libs/TabView/assets/Path.tsx +29 -0
  293. package/src/libs/TabView/index.tsx +184 -0
  294. package/src/libs/TabView/package.json +16 -0
  295. package/src/libs/TabView/publish.sh +16 -0
  296. package/src/libs/TabView/styles.ts +96 -0
  297. package/src/libs/TabView/tabBar/CardTabBar.tsx +137 -0
  298. package/src/libs/TabView/tabBar/SrollableTabBar.tsx +218 -0
  299. package/src/libs/TabView/tabBar/TabBar.tsx +67 -0
  300. package/src/libs/TabView/tabItem/CardTabItem.tsx +118 -0
  301. package/src/libs/TabView/tabItem/TabItem.tsx +180 -0
  302. package/src/libs/TabView/types.ts +166 -0
  303. package/src/libs/Template/HeaderSliderBanner/index.tsx +86 -0
  304. package/src/libs/Template/HeaderSliderBanner/types.ts +16 -0
  305. package/src/libs/Template/TrustBanner/CustomAvatar.tsx +39 -0
  306. package/src/libs/Template/TrustBanner/index.tsx +161 -0
  307. package/src/libs/Template/TrustBanner/styles.ts +48 -0
  308. package/src/libs/Template/TrustBanner/types.ts +50 -0
  309. package/src/libs/Template/index.tsx +4 -0
  310. package/src/libs/Template/package.json +18 -0
  311. package/src/libs/Template/publish.sh +17 -0
  312. package/src/libs/Title/index.tsx +284 -0
  313. package/src/libs/Title/package.json +17 -0
  314. package/src/libs/Title/publish.sh +16 -0
  315. package/src/libs/Title/styles.ts +54 -0
  316. package/src/libs/Title/types.ts +21 -0
  317. package/src/libs/Tooltip/TooltipButtons.tsx +54 -0
  318. package/src/libs/Tooltip/index.tsx +608 -0
  319. package/src/libs/Tooltip/package.json +16 -0
  320. package/src/libs/Tooltip/publish.sh +18 -0
  321. package/src/libs/Tooltip/styles.ts +70 -0
  322. package/src/libs/Tooltip/types.ts +61 -0
  323. package/src/libs/Uploader/index.tsx +87 -0
  324. package/src/libs/Uploader/package.json +17 -0
  325. package/src/libs/Uploader/publish.sh +18 -0
  326. package/src/libs/Uploader/styles.ts +30 -0
  327. package/src/libs/Uploader/types.ts +69 -0
  328. package/src/native/MoMoNative.podspec +18 -0
  329. package/src/native/calculator/android/build.gradle +61 -0
  330. package/src/native/calculator/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  331. package/src/native/calculator/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  332. package/src/native/calculator/android/gradlew +172 -0
  333. package/src/native/calculator/android/gradlew.bat +84 -0
  334. package/src/native/calculator/android/src/main/AndroidManifest.xml +5 -0
  335. package/src/native/calculator/android/src/main/java/com/calculator/KeyboardViewModule.java +22 -0
  336. package/src/native/calculator/android/src/main/java/com/calculator/KeyboardViewPackage.java +35 -0
  337. package/src/native/calculator/android/src/main/java/com/calculator/modules/CalculatorKeyboardModule.java +157 -0
  338. package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/CalculatorEditText.java +36 -0
  339. package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/FixedRelativeLayout.java +45 -0
  340. package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/MomoTextInputCalculatorManager.java +173 -0
  341. package/src/native/calculator/android/src/main/java/com/calculator/views/customkeyboard/RNCustomKeyboardModule.java +417 -0
  342. package/src/native/calculator/ios/Helper/MomoHelper.swift +16 -0
  343. package/src/native/calculator/ios/KeyboardView-Bridging-Header.h +60 -0
  344. package/src/native/calculator/ios/KeyboardView.h +19 -0
  345. package/src/native/calculator/ios/KeyboardView.m +56 -0
  346. package/src/native/calculator/ios/MomoTextInputCalculator.swift +144 -0
  347. package/src/native/calculator/ios/RNCustomKeyboard/RNCustomKeyboard.h +6 -0
  348. package/src/native/calculator/ios/RNCustomKeyboard/RNCustomKeyboard.m +143 -0
  349. package/src/native/package.json +14 -0
  350. package/src/native/publish.sh +29 -0
  351. package/src/native/resource/android/build.gradle +57 -0
  352. package/src/native/resource/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  353. package/src/native/resource/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  354. package/src/native/resource/android/src/main/AndroidManifest.xml +6 -0
  355. package/src/native/resource/android/src/main/java/com/resource/RNResourceModule.java +90 -0
  356. package/src/native/resource/android/src/main/java/com/resource/RNResourcePackage.java +22 -0
  357. package/src/native/resource/ios/RNResouce.m +71 -0
  358. package/src/native/resource/ios/RNResource.h +5 -0
  359. package/example/ios/Example.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  360. package/example/ios/Example.xcworkspace/xcuserdata/sophia.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  361. package/example/ios/Example.xcworkspace/xcuserdata/sophia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
  362. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  363. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  364. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
  365. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
  366. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
  367. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +0 -58
  368. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/lottie-ios.xcscheme +0 -58
  369. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
@@ -0,0 +1,218 @@
1
+ import React, {
2
+ RefObject,
3
+ useCallback,
4
+ useMemo,
5
+ useRef,
6
+ useState,
7
+ } from 'react';
8
+ import {Animated} from 'react-native';
9
+ import {clamp} from './helpers';
10
+ import styles from './styles';
11
+ import FollowerContainer, {LabelRef} from './Label';
12
+ import {Spacing} from '@momo-kits/foundation';
13
+
14
+ /**
15
+ * low and high state variables are fallbacks for props (props are not required).
16
+ * This hook ensures that current low and high are not out of [min, max] range.
17
+ * It returns an object which contains:
18
+ * - ref containing correct low, high, min, max and step to work with.
19
+ * - setLow and setHigh setters
20
+ * @param lowProp
21
+ * @param highProp
22
+ * @param min
23
+ * @param max
24
+ * @param step
25
+ * @returns {{inPropsRef: React.MutableRefObject<{high: (*|number), low: (*|number)}>, setLow: (function(number): undefined), setHigh: (function(number): undefined)}}
26
+ */
27
+ export const useLowHigh = (
28
+ lowProp: number | undefined,
29
+ highProp: number | undefined,
30
+ min: number,
31
+ max: number,
32
+ step: number
33
+ ) => {
34
+ const validLowProp = lowProp === undefined ? min : clamp(lowProp, min, max);
35
+ const validHighProp =
36
+ highProp === undefined ? max : clamp(highProp, min, max);
37
+ const inPropsRef = useRef({
38
+ low: validLowProp,
39
+ high: validHighProp,
40
+ step,
41
+ // These 2 fields will be overwritten below.
42
+ min: validLowProp,
43
+ max: validHighProp,
44
+ });
45
+ const {low: lowState, high: highState} = inPropsRef.current;
46
+ const inPropsRefPrev = {lowPrev: lowState, highPrev: highState};
47
+
48
+ // Props have higher priority.
49
+ // If no props are passed, use internal state variables.
50
+ const low = clamp(lowProp === undefined ? lowState : lowProp, min, max);
51
+ const high = clamp(highProp === undefined ? highState : highProp, min, max);
52
+
53
+ // Always update values of refs so pan responder will have updated values
54
+ Object.assign(inPropsRef.current, {low, high, min, max});
55
+
56
+ const setLow = (value: number) => (inPropsRef.current.low = value);
57
+ const setHigh = (value: number) => (inPropsRef.current.high = value);
58
+ return {inPropsRef, inPropsRefPrev, setLow, setHigh};
59
+ };
60
+
61
+ /**
62
+ * Sets the current value of widthRef and calls the callback with new width parameter.
63
+ * @param widthRef
64
+ * @param callback
65
+ * @returns {function({nativeEvent: *}): void}
66
+ */
67
+ export const useWidthLayout = (
68
+ widthRef: RefObject<number>,
69
+ callback?: (width: number) => void
70
+ ) => {
71
+ return useCallback(
72
+ ({nativeEvent}: {nativeEvent: {layout: {width: number}}}) => {
73
+ const {
74
+ layout: {width},
75
+ } = nativeEvent;
76
+ const {current: w} = widthRef;
77
+ if (w !== width) {
78
+ widthRef.current = width;
79
+ if (callback) {
80
+ callback(width);
81
+ }
82
+ }
83
+ },
84
+ [callback, widthRef]
85
+ );
86
+ };
87
+
88
+ /**
89
+ * This hook creates a component which follows the thumb.
90
+ * Content renderer is passed to FollowerContainer which re-renders only it's content with setValue method.
91
+ * This allows to re-render only follower, instead of the whole slider with all children (thumb, rail, etc.).
92
+ * Returned update function should be called every time follower should be updated.
93
+ * @param containerWidthRef
94
+ * @param gestureStateRef
95
+ * @param isPressed
96
+ * @param allowOverflow
97
+ * @param disabledLow
98
+ * @param disabledHigh
99
+ * @returns {[JSX.Element, function(*, *=): void]|*[]}
100
+ */
101
+ export const useThumbFollower = (
102
+ containerWidthRef: RefObject<number>,
103
+ gestureStateRef: RefObject<{
104
+ isLow: boolean;
105
+ lastValue: number;
106
+ lastPosition: number;
107
+ }>,
108
+ isPressed: boolean,
109
+ allowOverflow: boolean,
110
+ disabledLow: boolean,
111
+ disabledHigh: boolean
112
+ ): [React.ReactElement, (thumbPositionInView: number, value: number) => void] => {
113
+ const xRef = useRef(new Animated.Value(0));
114
+ const widthRef = useRef(0);
115
+ const contentContainerRef = useRef<LabelRef>(null);
116
+
117
+ const {current: x} = xRef;
118
+
119
+ const update = useCallback(
120
+ (thumbPositionInView: number, value: number) => {
121
+ if (
122
+ (gestureStateRef.current.isLow && disabledLow) ||
123
+ (!gestureStateRef.current.isLow && disabledHigh)
124
+ ) {
125
+ return;
126
+ }
127
+
128
+ const {current: width} = widthRef;
129
+ const {current: containerWidth} = containerWidthRef;
130
+ const position = thumbPositionInView - width / 2;
131
+ xRef.current.setValue(
132
+ allowOverflow ? position : clamp(position, 0, containerWidth - width)
133
+ );
134
+ contentContainerRef.current?.setValue(value);
135
+ },
136
+ [widthRef, containerWidthRef, allowOverflow, disabledLow, disabledHigh, gestureStateRef] // Include dependencies here.
137
+ );
138
+
139
+ const handleLayout = useWidthLayout(widthRef, () => {
140
+ update(
141
+ gestureStateRef.current.lastPosition,
142
+ gestureStateRef.current.lastValue
143
+ );
144
+ });
145
+
146
+ const transform = {transform: [{translateX: x}]};
147
+
148
+ const shouldDisplayLabel =
149
+ isPressed &&
150
+ ((gestureStateRef.current.isLow && !disabledLow) ||
151
+ (!gestureStateRef.current.isLow && !disabledHigh));
152
+
153
+ const follower = (
154
+ <Animated.View style={[transform, {opacity: shouldDisplayLabel ? 1 : 0}]}>
155
+ <FollowerContainer onLayout={handleLayout} ref={contentContainerRef} />
156
+ </Animated.View>
157
+ );
158
+ return [follower, update];
159
+ };
160
+
161
+ interface InProps {
162
+ low: number;
163
+ high: number;
164
+ min: number;
165
+ max: number;
166
+ step: number;
167
+ }
168
+
169
+ export const useSelectedRail = (
170
+ inPropsRef: RefObject<InProps>,
171
+ containerWidthRef: RefObject<number>,
172
+ thumbWidth: number,
173
+ disableRange: boolean
174
+ ) => {
175
+ const {current: left} = useRef(new Animated.Value(0));
176
+ const {current: right} = useRef(new Animated.Value(0));
177
+ const update = useCallback(() => {
178
+ const {low, high, min, max} = inPropsRef.current;
179
+ const {current: containerWidth} = containerWidthRef;
180
+ const fullScale = (max - min) / (containerWidth - thumbWidth);
181
+ const leftValue = (low - min) / fullScale;
182
+ const rightValue = (max - high) / fullScale;
183
+ left.setValue(disableRange ? 0 : leftValue);
184
+ right.setValue(
185
+ disableRange ? containerWidth - thumbWidth - leftValue : rightValue
186
+ );
187
+ }, [inPropsRef, containerWidthRef, disableRange, thumbWidth, left, right]);
188
+ const styles = useMemo(
189
+ () => ({
190
+ position: 'absolute',
191
+ left: left,
192
+ right: right,
193
+ }),
194
+ [left, right]
195
+ );
196
+ return [styles, update];
197
+ };
198
+
199
+ /**
200
+ * @param floating
201
+ * @returns {{onLayout: ((function({nativeEvent: *}): void)|undefined), style: [*, {top}]}}
202
+ */
203
+ export const useLabelContainerProps = (floating: boolean) => {
204
+ const [labelContainerHeight, setLabelContainerHeight] = useState(0);
205
+ const onLayout = useCallback(({nativeEvent}: {nativeEvent: {layout: {height: number}}}) => {
206
+ const {
207
+ layout: {height},
208
+ } = nativeEvent;
209
+ setLabelContainerHeight(height);
210
+ }, []);
211
+
212
+ const top = floating ? -(labelContainerHeight + Spacing.XS) : Spacing.XS;
213
+ const style = [
214
+ floating ? styles.labelFloatingContainer : styles.labelFixedContainer,
215
+ {top},
216
+ ];
217
+ return {style, onLayout: onLayout};
218
+ };
@@ -0,0 +1,453 @@
1
+ import React, {
2
+ memo,
3
+ useCallback,
4
+ useContext,
5
+ useEffect,
6
+ useMemo,
7
+ useRef,
8
+ useState,
9
+ } from 'react';
10
+ import {
11
+ Animated,
12
+ GestureResponderEvent,
13
+ LayoutChangeEvent,
14
+ PanResponder,
15
+ PanResponderGestureState,
16
+ View,
17
+ ViewProps,
18
+ ViewStyle,
19
+ } from 'react-native';
20
+
21
+ import styles from './styles';
22
+ import {
23
+ useLabelContainerProps,
24
+ useLowHigh,
25
+ useSelectedRail,
26
+ useThumbFollower,
27
+ useWidthLayout,
28
+ } from './hooks';
29
+ import {clamp, getValueForPosition, isLowCloser} from './helpers';
30
+ import {ApplicationContext, Radius, Shadow} from '@momo-kits/foundation';
31
+
32
+ const trueFunc = () => true;
33
+ const falseFunc = () => false;
34
+
35
+ export interface SliderProps extends ViewProps {
36
+ /**
37
+ * Specifies the minimum value permitted for selection in the slider. This value sets the lower
38
+ * bound for the component.
39
+ */
40
+ min: number;
41
+
42
+ /**
43
+ * Specifies the maximum value allowed for selection. This value sets the upper bound for the component.
44
+ */
45
+ max: number;
46
+
47
+ /**
48
+ * Optional. Defines the minimum permitted range between the low and high values of the slider.
49
+ * Particularly useful when 'low' and 'high' values both exist, ensuring a certain spread between them.
50
+ */
51
+ minRange?: number;
52
+
53
+ /**
54
+ * Specifies the interval between individual step values. The slider's handle will move only in these increments.
55
+ */
56
+ step: number;
57
+
58
+ /**
59
+ * Optional. Represents the initial lower value of the range when the component is used as a range slider.
60
+ * This value is part of the selected range, between 'min' and 'high'.
61
+ */
62
+ low?: number;
63
+
64
+ /**
65
+ * Optional. Represents the initial upper value of the range when used as a range slider.
66
+ * This value is part of the selected range, between 'low' and 'max'.
67
+ */
68
+ high?: number;
69
+
70
+ /**
71
+ * Optional. If `true`, allows the label to extend beyond the width of the Slider component itself,
72
+ * rather than being clipped at the component boundaries. Defaults to `false` if not provided.
73
+ */
74
+ allowLabelOverflow?: boolean;
75
+
76
+ /**
77
+ * Optional. If `true`, disables the range functionality of the slider, turning it into a regular
78
+ * single-value slider. Defaults to `false` if not provided.
79
+ */
80
+ disableRange?: boolean;
81
+
82
+ /**
83
+ * Optional. If `true`, the 'high' handle of the slider will be disabled and cannot be moved.
84
+ * Useful for setting a maximum limit that users cannot increase. Defaults to `false` if not provided.
85
+ */
86
+ disabledHigh?: boolean;
87
+
88
+ /**
89
+ * Optional. If `true`, the 'low' handle of the slider will be disabled and cannot be moved.
90
+ * Useful for setting a minimum limit that users cannot decrease. Defaults to `false` if not provided.
91
+ */
92
+ disabledLow?: boolean;
93
+
94
+ /**
95
+ * Optional. If `true`, labels will be displayed in a floating manner above the slider handles,
96
+ * typically used to display the current value. Defaults to `false` if not provided.
97
+ */
98
+ floatingLabel?: boolean;
99
+
100
+ /**
101
+ * Optional. A callback function triggered when the slider value changes, either by the user or programmatically.
102
+ * It receives the new low and high values of the slider, as well as a boolean indicating if the change was made by the user.
103
+ */
104
+ onValueChanged?: (low: number, high: number, byUser: boolean) => void;
105
+
106
+ /**
107
+ * Optional. A callback function triggered when the user starts touching the slider's draggable area.
108
+ * It receives the current low and high values of the slider.
109
+ */
110
+ onSliderTouchStart?: (low: number, high: number) => void;
111
+
112
+ /**
113
+ * Optional. A callback function triggered when the user releases the slider's draggable area.
114
+ * It receives the current low and high values of the slider.
115
+ */
116
+ onSliderTouchEnd?: (low: number, high: number) => void;
117
+ }
118
+
119
+ const Slider: React.FC<SliderProps> = memo(
120
+ ({
121
+ min,
122
+ max,
123
+ minRange = 0,
124
+ step,
125
+ low: lowProp,
126
+ high: highProp,
127
+ floatingLabel = false,
128
+ allowLabelOverflow = false,
129
+ disableRange = false,
130
+ disabledHigh = false,
131
+ disabledLow = false,
132
+ onValueChanged,
133
+ onSliderTouchStart,
134
+ onSliderTouchEnd,
135
+ ...restProps
136
+ }) => {
137
+ const {theme} = useContext(ApplicationContext);
138
+
139
+ const {inPropsRef, inPropsRefPrev, setLow, setHigh} = useLowHigh(
140
+ lowProp,
141
+ disableRange ? max : highProp,
142
+ min,
143
+ max,
144
+ step
145
+ );
146
+ const lowThumbXRef = useRef(new Animated.Value(0));
147
+ const highThumbXRef = useRef(new Animated.Value(0));
148
+ const pointerX = useRef(new Animated.Value(0)).current;
149
+ const {current: lowThumbX} = lowThumbXRef;
150
+ const {current: highThumbX} = highThumbXRef;
151
+
152
+ const gestureStateRef = useRef({
153
+ isLow: true,
154
+ lastValue: 0,
155
+ lastPosition: 0,
156
+ });
157
+ const [isPressed, setPressed] = useState(false);
158
+
159
+ const containerWidthRef = useRef(0);
160
+ const [thumbWidth, setThumbWidth] = useState(0);
161
+
162
+ const [selectedRailStyle, updateSelectedRail] = useSelectedRail(
163
+ inPropsRef,
164
+ containerWidthRef,
165
+ thumbWidth,
166
+ disableRange
167
+ );
168
+
169
+ const updateThumbs = useCallback(() => {
170
+ const {current: containerWidth} = containerWidthRef;
171
+ if (!thumbWidth || !containerWidth) {
172
+ return;
173
+ }
174
+ const {low, high} = inPropsRef.current;
175
+ if (!disableRange) {
176
+ const {current: highThumbX} = highThumbXRef;
177
+ const highPosition =
178
+ ((high - min) / (max - min)) * (containerWidth - thumbWidth);
179
+ highThumbX.setValue(highPosition);
180
+ }
181
+ const {current: lowThumbX} = lowThumbXRef;
182
+ const lowPosition =
183
+ ((low - min) / (max - min)) * (containerWidth - thumbWidth);
184
+ lowThumbX.setValue(lowPosition);
185
+ typeof updateSelectedRail === 'function' && updateSelectedRail();
186
+ onValueChanged?.(low, high, false);
187
+ }, [
188
+ disableRange,
189
+ inPropsRef,
190
+ max,
191
+ min,
192
+ onValueChanged,
193
+ thumbWidth,
194
+ updateSelectedRail,
195
+ ]);
196
+
197
+ useEffect(() => {
198
+ const {lowPrev, highPrev} = inPropsRefPrev;
199
+ if (
200
+ (lowProp !== undefined && lowProp !== lowPrev) ||
201
+ (highProp !== undefined && highProp !== highPrev)
202
+ ) {
203
+ updateThumbs();
204
+ }
205
+ }, [highProp, inPropsRefPrev, lowProp, updateThumbs]);
206
+
207
+ useEffect(() => {
208
+ updateThumbs();
209
+ }, [updateThumbs]);
210
+
211
+ const handleContainerLayout = useWidthLayout(
212
+ containerWidthRef,
213
+ updateThumbs
214
+ );
215
+ const handleThumbLayout = useCallback(
216
+ ({
217
+ nativeEvent,
218
+ }: LayoutChangeEvent) => {
219
+ const {
220
+ layout: {width},
221
+ } = nativeEvent;
222
+ if (thumbWidth !== width) {
223
+ setThumbWidth(width);
224
+ }
225
+ },
226
+ [thumbWidth]
227
+ );
228
+
229
+ const lowStyles = useMemo(() => {
230
+ return {transform: [{translateX: lowThumbX}]};
231
+ }, [lowThumbX]);
232
+
233
+ const highStyles = useMemo(() => {
234
+ return disableRange
235
+ ? null
236
+ : [styles.highThumbContainer, {transform: [{translateX: highThumbX}]}];
237
+ }, [disableRange, highThumbX]);
238
+
239
+ const railContainerStyles = useMemo(() => {
240
+ return [styles.railsContainer, {marginHorizontal: thumbWidth / 2}];
241
+ }, [thumbWidth]);
242
+
243
+ const [labelView, labelUpdate] = useThumbFollower(
244
+ containerWidthRef,
245
+ gestureStateRef,
246
+ isPressed,
247
+ allowLabelOverflow,
248
+ disabledLow,
249
+ disabledHigh
250
+ );
251
+
252
+ const renderThumb = (name: string) => {
253
+ const isDisabled =
254
+ (name === 'low' && disabledLow) || (name === 'high' && disabledHigh);
255
+
256
+ const thumbColor = isDisabled
257
+ ? theme.colors.text.disable
258
+ : theme.colors.primary;
259
+
260
+ return (
261
+ <View
262
+ style={[
263
+ Shadow.Light,
264
+ {
265
+ width: 20,
266
+ height: 20,
267
+ borderRadius: Radius.M,
268
+ borderWidth: 4,
269
+ borderColor: theme.colors.background.surface,
270
+ backgroundColor: thumbColor,
271
+ },
272
+ ]}
273
+ />
274
+ );
275
+ };
276
+
277
+ const lowThumb = renderThumb('low');
278
+ const highThumb = renderThumb('high');
279
+
280
+ const labelContainerProps = useLabelContainerProps(floatingLabel);
281
+
282
+ const {panHandlers} = useMemo(
283
+ () =>
284
+ PanResponder.create({
285
+ onStartShouldSetPanResponderCapture: falseFunc,
286
+ onMoveShouldSetPanResponderCapture: falseFunc,
287
+ onPanResponderTerminationRequest: falseFunc,
288
+ onPanResponderTerminate: trueFunc,
289
+ onShouldBlockNativeResponder: trueFunc,
290
+
291
+ onMoveShouldSetPanResponder: (
292
+ evt: GestureResponderEvent,
293
+ gestureState: PanResponderGestureState
294
+ ) => Math.abs(gestureState.dx) > 2 * Math.abs(gestureState.dy),
295
+
296
+ onPanResponderGrant: ({nativeEvent}, gestureState) => {
297
+ const {numberActiveTouches} = gestureState;
298
+ if (numberActiveTouches > 1) {
299
+ return;
300
+ }
301
+ setPressed(true);
302
+ const {current: lowThumbX} = lowThumbXRef;
303
+ const {current: highThumbX} = highThumbXRef;
304
+ const {locationX: downX, pageX} = nativeEvent;
305
+ const containerX = pageX - downX;
306
+
307
+ const {low, high, min, max} = inPropsRef.current;
308
+ onSliderTouchStart?.(low, high);
309
+ const containerWidth = containerWidthRef.current;
310
+
311
+ const lowPosition =
312
+ thumbWidth / 2 +
313
+ ((low - min) / (max - min)) * (containerWidth - thumbWidth);
314
+ const highPosition =
315
+ thumbWidth / 2 +
316
+ ((high - min) / (max - min)) * (containerWidth - thumbWidth);
317
+
318
+ const isLow =
319
+ disableRange || isLowCloser(downX, lowPosition, highPosition);
320
+ gestureStateRef.current.isLow = isLow;
321
+
322
+ if ((isLow && disabledLow) || (!isLow && disabledHigh)) {
323
+ return;
324
+ }
325
+
326
+ const handlePositionChange = (positionInView: number) => {
327
+ const {low, high, min, max, step} = inPropsRef.current;
328
+ const minValue = isLow ? min : low + minRange;
329
+ const maxValue = isLow ? high - minRange : max;
330
+ const value = clamp(
331
+ getValueForPosition(
332
+ positionInView,
333
+ containerWidth,
334
+ thumbWidth,
335
+ min,
336
+ max,
337
+ step
338
+ ),
339
+ minValue,
340
+ maxValue
341
+ );
342
+ if (gestureStateRef.current.lastValue === value) {
343
+ return;
344
+ }
345
+ const availableSpace = containerWidth - thumbWidth;
346
+ const absolutePosition =
347
+ ((value - min) / (max - min)) * availableSpace;
348
+ gestureStateRef.current.lastValue = value;
349
+ gestureStateRef.current.lastPosition =
350
+ absolutePosition + thumbWidth / 2;
351
+ (isLow ? lowThumbX : highThumbX).setValue(absolutePosition);
352
+ onValueChanged?.(isLow ? value : low, isLow ? high : value, true);
353
+ (isLow ? setLow : setHigh)(value);
354
+ labelUpdate &&
355
+ typeof labelUpdate === 'function' &&
356
+ labelUpdate(gestureStateRef.current.lastPosition, value);
357
+
358
+ typeof updateSelectedRail === 'function' && updateSelectedRail();
359
+ };
360
+ handlePositionChange(downX);
361
+ pointerX.removeAllListeners();
362
+ pointerX.addListener(({value: pointerPosition}) => {
363
+ const positionInView = pointerPosition - containerX;
364
+ handlePositionChange(positionInView);
365
+ });
366
+ },
367
+
368
+ onPanResponderMove: (evt, gestureState) => {
369
+ if (gestureStateRef.current.isLow ? disabledLow : disabledHigh) {
370
+ return;
371
+ }
372
+
373
+ Animated.event([null, {moveX: pointerX}], {
374
+ useNativeDriver: false,
375
+ })(evt, gestureState);
376
+ },
377
+
378
+ onPanResponderRelease: () => {
379
+ setPressed(false);
380
+ const {low, high} = inPropsRef.current;
381
+ if (
382
+ (gestureStateRef.current.isLow && disabledLow) ||
383
+ (!gestureStateRef.current.isLow && disabledHigh)
384
+ ) {
385
+ return;
386
+ }
387
+ onSliderTouchEnd?.(low, high);
388
+ },
389
+ }),
390
+ [
391
+ pointerX,
392
+ inPropsRef,
393
+ thumbWidth,
394
+ disableRange,
395
+ onValueChanged,
396
+ disabledHigh,
397
+ disabledLow,
398
+ setLow,
399
+ setHigh,
400
+ labelUpdate,
401
+ updateSelectedRail,
402
+ minRange,
403
+ onSliderTouchEnd,
404
+ onSliderTouchStart,
405
+ ]
406
+ );
407
+
408
+ const renderTrack = (color: string) => {
409
+ return (
410
+ <View
411
+ style={{
412
+ width: '100%',
413
+ height: 4,
414
+ borderRadius: Radius.L,
415
+ backgroundColor: color,
416
+ }}
417
+ />
418
+ );
419
+ };
420
+
421
+ const trackColor =
422
+ disabledHigh && disabledLow
423
+ ? theme.colors.text.disable
424
+ : theme.colors.primary;
425
+
426
+ return (
427
+ <View {...restProps}>
428
+ <View {...labelContainerProps}>{labelView}</View>
429
+ <View onLayout={handleContainerLayout} style={styles.controlsContainer}>
430
+ <View style={railContainerStyles}>
431
+ {renderTrack(theme.colors.background.default)}
432
+ <Animated.View style={selectedRailStyle as ViewStyle}>
433
+ {renderTrack(trackColor)}
434
+ </Animated.View>
435
+ </View>
436
+ <Animated.View style={lowStyles} onLayout={handleThumbLayout}>
437
+ {lowThumb}
438
+ </Animated.View>
439
+ {!disableRange && (
440
+ <Animated.View style={highStyles}>{highThumb}</Animated.View>
441
+ )}
442
+ <View
443
+ {...panHandlers}
444
+ style={styles.touchableArea}
445
+ collapsable={false}
446
+ />
447
+ </View>
448
+ </View>
449
+ );
450
+ }
451
+ );
452
+
453
+ export {Slider};
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@momo-kits/slider",
3
+ "version": "0.157.1-beta.4",
4
+ "private": false,
5
+ "main": "index.tsx",
6
+ "peerDependencies": {
7
+ "@momo-kits/foundation": "latest",
8
+ "react": "*",
9
+ "react-native": "*"
10
+ },
11
+ "license": "MoMo",
12
+ "publishConfig": {
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
15
+ "dependencies": {}
16
+ }
@@ -0,0 +1,18 @@
1
+ #!/bin/bash
2
+
3
+
4
+ if [ "$1" == "stable" ]; then
5
+ npm version $(npm view @momo-kits/foundation@stable version)
6
+ npm version patch
7
+ npm publish --tag stable --access=public
8
+ elif [ "$1" == "latest" ]; then
9
+ npm publish --tag latest --access=public
10
+ elif [ "$1" == "beta" ]; then
11
+ npm publish --tag beta --access=public
12
+ else
13
+ npm publish --tag alpha --access=public
14
+ fi
15
+
16
+ PACKAGE_NAME=$(npm pkg get name)
17
+ NEW_PACKAGE_VERSION=$(npm pkg get version)
18
+