react-native-mantine 0.4.0 → 0.6.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.
- package/README.md +0 -357
- package/lib/commonjs/components/Button/Button.styles.js +5 -46
- package/lib/commonjs/components/Button/Button.styles.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +18 -39
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/CloseButton/index.js +5 -30
- package/lib/commonjs/components/CloseButton/index.js.map +1 -1
- package/lib/commonjs/components/Collapse/index.js +10 -2
- package/lib/commonjs/components/Collapse/index.js.map +1 -1
- package/lib/commonjs/components/Dialog/index.js +51 -8
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Drawer/index.js +4 -13
- package/lib/commonjs/components/Drawer/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js +53 -0
- package/lib/commonjs/components/Icon/index.js.map +1 -0
- package/lib/commonjs/components/Input/Input.styles.js +2 -204
- package/lib/commonjs/components/Input/Input.styles.js.map +1 -1
- package/lib/commonjs/components/Input/index.js +1 -1
- package/lib/commonjs/components/List/index.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +11 -10
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/Modal/index.js +10 -16
- package/lib/commonjs/components/Modal/index.js.map +1 -1
- package/lib/commonjs/components/Notification/index.js +12 -5
- package/lib/commonjs/components/Notification/index.js.map +1 -1
- package/lib/commonjs/components/NumberInput/index.js +2 -1
- package/lib/commonjs/components/NumberInput/index.js.map +1 -1
- package/lib/commonjs/components/PasswordInput/index.js +5 -6
- package/lib/commonjs/components/PasswordInput/index.js.map +1 -1
- package/lib/commonjs/components/PinInput/index.js +7 -2
- package/lib/commonjs/components/PinInput/index.js.map +1 -1
- package/lib/commonjs/components/Popover/index.js +8 -7
- package/lib/commonjs/components/Popover/index.js.map +1 -1
- package/lib/commonjs/components/RingProgress/index.js +49 -7
- package/lib/commonjs/components/RingProgress/index.js.map +1 -1
- package/lib/commonjs/components/SegmentedControl/index.js +7 -4
- package/lib/commonjs/components/SegmentedControl/index.js.map +1 -1
- package/lib/commonjs/components/Slider/index.js +28 -3
- package/lib/commonjs/components/Slider/index.js.map +1 -1
- package/lib/commonjs/components/Stepper/index.js.map +1 -1
- package/lib/commonjs/components/Table/index.js +22 -20
- package/lib/commonjs/components/Table/index.js.map +1 -1
- package/lib/commonjs/components/TextInput/index.js +2 -2
- package/lib/commonjs/components/TextInput/index.js.map +1 -1
- package/lib/commonjs/components/Timeline/index.js +12 -5
- package/lib/commonjs/components/Timeline/index.js.map +1 -1
- package/lib/commonjs/components/Tooltip/index.js +12 -11
- package/lib/commonjs/components/Tooltip/index.js.map +1 -1
- package/lib/commonjs/components/TransferList/index.js +3 -8
- package/lib/commonjs/components/TransferList/index.js.map +1 -1
- package/lib/commonjs/components/Transition/index.js +4 -0
- package/lib/commonjs/components/Transition/index.js.map +1 -1
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.js +4 -0
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/commonjs/components/index.js +22 -22
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/hooks/useCachedResources.js +1 -4
- package/lib/commonjs/hooks/useCachedResources.js.map +1 -1
- package/lib/commonjs/theme/functions/attach-functions.js +3 -0
- package/lib/commonjs/theme/functions/attach-functions.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/helpers.js +12 -1
- package/lib/commonjs/theme/functions/fns/helpers.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/index.js +4 -0
- package/lib/commonjs/theme/functions/fns/index.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/rgba.js +50 -0
- package/lib/commonjs/theme/functions/fns/rgba.js.map +1 -0
- package/lib/commonjs/theme/functions/fns/size.js +19 -0
- package/lib/commonjs/theme/functions/fns/size.js.map +1 -0
- package/lib/commonjs/theme/theme-provider.js +6 -8
- package/lib/commonjs/theme/theme-provider.js.map +1 -1
- package/lib/module/components/Button/Button.styles.js +5 -46
- package/lib/module/components/Button/Button.styles.js.map +1 -1
- package/lib/module/components/Button/index.js +18 -39
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/CloseButton/index.js +6 -31
- package/lib/module/components/CloseButton/index.js.map +1 -1
- package/lib/module/components/Collapse/index.js +10 -2
- package/lib/module/components/Collapse/index.js.map +1 -1
- package/lib/module/components/Dialog/index.js +52 -9
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Drawer/index.js +4 -13
- package/lib/module/components/Drawer/index.js.map +1 -1
- package/lib/module/components/Icon/index.js +48 -0
- package/lib/module/components/Icon/index.js.map +1 -0
- package/lib/module/components/Input/Input.styles.js +1 -203
- package/lib/module/components/Input/Input.styles.js.map +1 -1
- package/lib/module/components/Input/index.js +1 -1
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/List/index.js.map +1 -1
- package/lib/module/components/Menu/index.js +9 -8
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/Modal/index.js +10 -16
- package/lib/module/components/Modal/index.js.map +1 -1
- package/lib/module/components/Notification/index.js +12 -5
- package/lib/module/components/Notification/index.js.map +1 -1
- package/lib/module/components/NumberInput/index.js +2 -1
- package/lib/module/components/NumberInput/index.js.map +1 -1
- package/lib/module/components/PasswordInput/index.js +5 -6
- package/lib/module/components/PasswordInput/index.js.map +1 -1
- package/lib/module/components/PinInput/index.js +7 -2
- package/lib/module/components/PinInput/index.js.map +1 -1
- package/lib/module/components/Popover/index.js +9 -8
- package/lib/module/components/Popover/index.js.map +1 -1
- package/lib/module/components/RingProgress/index.js +51 -9
- package/lib/module/components/RingProgress/index.js.map +1 -1
- package/lib/module/components/SegmentedControl/index.js +7 -4
- package/lib/module/components/SegmentedControl/index.js.map +1 -1
- package/lib/module/components/Slider/index.js +28 -3
- package/lib/module/components/Slider/index.js.map +1 -1
- package/lib/module/components/Stepper/index.js.map +1 -1
- package/lib/module/components/Table/index.js +22 -19
- package/lib/module/components/Table/index.js.map +1 -1
- package/lib/module/components/TextInput/index.js +2 -2
- package/lib/module/components/TextInput/index.js.map +1 -1
- package/lib/module/components/Timeline/index.js +12 -5
- package/lib/module/components/Timeline/index.js.map +1 -1
- package/lib/module/components/Tooltip/index.js +11 -10
- package/lib/module/components/Tooltip/index.js.map +1 -1
- package/lib/module/components/TransferList/index.js +4 -9
- package/lib/module/components/TransferList/index.js.map +1 -1
- package/lib/module/components/Transition/index.js +5 -1
- package/lib/module/components/Transition/index.js.map +1 -1
- package/lib/module/components/UnstyledButton/UnstyledButton.js +4 -0
- package/lib/module/components/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/hooks/useCachedResources.js +1 -4
- package/lib/module/hooks/useCachedResources.js.map +1 -1
- package/lib/module/theme/functions/attach-functions.js +3 -0
- package/lib/module/theme/functions/attach-functions.js.map +1 -1
- package/lib/module/theme/functions/fns/helpers.js +10 -0
- package/lib/module/theme/functions/fns/helpers.js.map +1 -1
- package/lib/module/theme/functions/fns/index.js +4 -0
- package/lib/module/theme/functions/fns/index.js.map +1 -1
- package/lib/module/theme/functions/fns/rgba.js +46 -0
- package/lib/module/theme/functions/fns/rgba.js.map +1 -0
- package/lib/module/theme/functions/fns/size.js +15 -0
- package/lib/module/theme/functions/fns/size.js.map +1 -0
- package/lib/module/theme/theme-provider.js +6 -8
- package/lib/module/theme/theme-provider.js.map +1 -1
- package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Button/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/CloseButton/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Collapse/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Dialog/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Icon/index.d.ts +26 -0
- package/lib/typescript/commonjs/src/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts +7 -0
- package/lib/typescript/commonjs/src/components/Input/Input.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Input/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Modal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NumberInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Popover/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SegmentedControl/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Slider/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Stepper/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Table/index.d.ts +16 -7
- package/lib/typescript/commonjs/src/components/Table/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/TextInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Transition/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hooks/useCachedResources.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts +7 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/rgba.d.ts +8 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/rgba.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts +6 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Button/Button.styles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Button/index.d.ts +1 -0
- package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CloseButton/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Collapse/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Dialog/index.d.ts +2 -0
- package/lib/typescript/module/src/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Icon/index.d.ts +26 -0
- package/lib/typescript/module/src/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Input/Input.styles.d.ts +7 -0
- package/lib/typescript/module/src/components/Input/Input.styles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Input/index.d.ts +1 -1
- package/lib/typescript/module/src/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Modal/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NumberInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Popover/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SegmentedControl/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Slider/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Stepper/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Table/index.d.ts +16 -7
- package/lib/typescript/module/src/components/Table/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/TextInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Transition/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.d.ts +2 -0
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/module/src/components/index.d.ts +1 -1
- package/lib/typescript/module/src/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/hooks/useCachedResources.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts +7 -0
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts +7 -0
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/rgba.d.ts +8 -0
- package/lib/typescript/module/src/theme/functions/fns/rgba.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts +6 -0
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts.map +1 -0
- package/package.json +12 -9
- package/src/components/Button/Button.styles.ts +5 -48
- package/src/components/Button/index.tsx +56 -81
- package/src/components/Chip/index.tsx +3 -3
- package/src/components/CloseButton/index.tsx +2 -23
- package/src/components/Collapse/index.tsx +11 -2
- package/src/components/Dialog/index.tsx +54 -9
- package/src/components/Drawer/index.tsx +7 -13
- package/src/components/Icon/index.tsx +74 -0
- package/src/components/Input/Input.styles.ts +1 -202
- package/src/components/Input/index.ts +1 -1
- package/src/components/List/index.tsx +1 -1
- package/src/components/Menu/index.tsx +13 -10
- package/src/components/Modal/index.tsx +11 -16
- package/src/components/Notification/index.tsx +10 -2
- package/src/components/NumberInput/index.tsx +57 -15
- package/src/components/PasswordInput/index.tsx +2 -2
- package/src/components/PinInput/index.tsx +24 -9
- package/src/components/Popover/index.tsx +13 -10
- package/src/components/RingProgress/index.tsx +51 -8
- package/src/components/SegmentedControl/index.tsx +6 -4
- package/src/components/Slider/index.tsx +14 -3
- package/src/components/Stepper/index.tsx +5 -4
- package/src/components/Table/index.tsx +73 -36
- package/src/components/TextInput/index.tsx +93 -66
- package/src/components/Timeline/index.tsx +19 -12
- package/src/components/Tooltip/index.tsx +13 -10
- package/src/components/TransferList/index.tsx +1 -5
- package/src/components/Transition/index.tsx +14 -2
- package/src/components/UnstyledButton/UnstyledButton.tsx +5 -1
- package/src/components/index.tsx +1 -1
- package/src/hooks/useCachedResources.ts +1 -4
- package/src/theme/functions/attach-functions.ts +3 -0
- package/src/theme/functions/fns/helpers.ts +19 -7
- package/src/theme/functions/fns/index.ts +4 -0
- package/src/theme/functions/fns/rgba.ts +45 -0
- package/src/theme/functions/fns/size.ts +14 -0
- package/src/theme/theme-provider.tsx +6 -6
- package/src/theme/types/MantineStyleSystem.ts +0 -53
- package/lib/commonjs/components/Portal/index.js +0 -69
- package/lib/commonjs/components/Portal/index.js.map +0 -1
- package/lib/module/components/Portal/index.js +0 -62
- package/lib/module/components/Portal/index.js.map +0 -1
- package/lib/typescript/commonjs/src/components/Portal/index.d.ts +0 -10
- package/lib/typescript/commonjs/src/components/Portal/index.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Portal/index.d.ts +0 -10
- package/lib/typescript/module/src/components/Portal/index.d.ts.map +0 -1
- package/src/components/Portal/index.tsx +0 -75
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../../../../../../src/theme/functions/fns/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,wBAAgB,IAAI,CAAC,MAAM,EAAE,GAAG,IACtB,KAAK,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,kBAGrC;IACD,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;CACd,KAAG,MAAM,CAGX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mantine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Make Mantine Accessable on React Native",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
75
75
|
"@types/jest": "^29.5.5",
|
|
76
76
|
"@types/lodash-es": "^4.17.12",
|
|
77
|
-
"@types/react": "^
|
|
77
|
+
"@types/react": "^19.0.0",
|
|
78
|
+
"@types/react-native-vector-icons": "^6.4.18",
|
|
78
79
|
"commitlint": "^17.0.2",
|
|
79
80
|
"del-cli": "^5.1.0",
|
|
80
81
|
"eslint": "^8.51.0",
|
|
@@ -83,18 +84,20 @@
|
|
|
83
84
|
"jest": "^29.7.0",
|
|
84
85
|
"prettier": "^3.0.3",
|
|
85
86
|
"prettier-eslint": "^16.3.0",
|
|
86
|
-
"react": "
|
|
87
|
-
"react-native": "0.
|
|
87
|
+
"react": "19.1.0",
|
|
88
|
+
"react-native": "0.81.5",
|
|
88
89
|
"react-native-builder-bob": "latest",
|
|
90
|
+
"react-native-vector-icons": "^10.0.0",
|
|
89
91
|
"release-it": "^15.0.0",
|
|
90
92
|
"typescript": "^5.2.2"
|
|
91
93
|
},
|
|
92
94
|
"resolutions": {
|
|
93
|
-
"@types/react": "^
|
|
95
|
+
"@types/react": "^19.0.0"
|
|
94
96
|
},
|
|
95
97
|
"peerDependencies": {
|
|
96
98
|
"react": "*",
|
|
97
|
-
"react-native": "*"
|
|
99
|
+
"react-native": "*",
|
|
100
|
+
"react-native-vector-icons": "^10.0.0"
|
|
98
101
|
},
|
|
99
102
|
"workspaces": [
|
|
100
103
|
"example"
|
|
@@ -189,9 +192,9 @@
|
|
|
189
192
|
"version": "0.41.2"
|
|
190
193
|
},
|
|
191
194
|
"dependencies": {
|
|
192
|
-
"expo-clipboard": "~
|
|
193
|
-
"expo-font": "~
|
|
194
|
-
"expo-linear-gradient": "~
|
|
195
|
+
"expo-clipboard": "~8.0.8",
|
|
196
|
+
"expo-font": "~14.0.10",
|
|
197
|
+
"expo-linear-gradient": "~15.0.8",
|
|
195
198
|
"lodash-es": "^4.17.21"
|
|
196
199
|
}
|
|
197
200
|
}
|
|
@@ -56,15 +56,10 @@ interface GetSizeStyles {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function getSizeStyles({
|
|
59
|
-
// compact,
|
|
60
59
|
size,
|
|
61
60
|
withLeftIcon,
|
|
62
61
|
withRightIcon,
|
|
63
62
|
}: GetSizeStyles): any {
|
|
64
|
-
// if (compact) {
|
|
65
|
-
// return sizes[`compact-${size}`];
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
63
|
const _sizes: (typeof sizes)[keyof typeof sizes] = sizes[size];
|
|
69
64
|
|
|
70
65
|
if (!_sizes) {
|
|
@@ -87,42 +82,6 @@ const getWidthStyles = (fullWidth: boolean) => ({
|
|
|
87
82
|
width: fullWidth ? '100%' : 'auto',
|
|
88
83
|
});
|
|
89
84
|
|
|
90
|
-
// interface GetVariantStyles {
|
|
91
|
-
// theme: MantineTheme;
|
|
92
|
-
// color: MantineColor;
|
|
93
|
-
// variant: string;
|
|
94
|
-
// gradient: MantineGradient;
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
|
-
// function getVariantStyles({
|
|
98
|
-
// variant,
|
|
99
|
-
// theme,
|
|
100
|
-
// color,
|
|
101
|
-
// gradient,
|
|
102
|
-
// }: GetVariantStyles) {
|
|
103
|
-
// if (!BUTTON_VARIANTS.includes(variant)) {
|
|
104
|
-
// return null;
|
|
105
|
-
// }
|
|
106
|
-
|
|
107
|
-
// const colors = theme.fn.variant({ color, variant, gradient });
|
|
108
|
-
|
|
109
|
-
// if (variant === 'gradient') {
|
|
110
|
-
// return {
|
|
111
|
-
// border: 0,
|
|
112
|
-
// backgroundImage: colors.background,
|
|
113
|
-
// color: colors.color,
|
|
114
|
-
// ...theme.fn.hover({ backgroundSize: '200%' }),
|
|
115
|
-
// };
|
|
116
|
-
// }
|
|
117
|
-
|
|
118
|
-
// return {
|
|
119
|
-
// border: `${rem(1)} solid ${colors.border}`,
|
|
120
|
-
// backgroundColor: colors.background,
|
|
121
|
-
// color: colors.color,
|
|
122
|
-
// ...theme.fn.hover({ backgroundColor: colors.hover }),
|
|
123
|
-
// };
|
|
124
|
-
// }
|
|
125
|
-
|
|
126
85
|
interface GetVariantStylesInput {
|
|
127
86
|
variant: string;
|
|
128
87
|
color: MantineColor;
|
|
@@ -163,10 +122,7 @@ const useStyles = createStyles(
|
|
|
163
122
|
color,
|
|
164
123
|
gradient,
|
|
165
124
|
}: ButtonStylesParams,
|
|
166
|
-
{
|
|
167
|
-
variant,
|
|
168
|
-
size,
|
|
169
|
-
}
|
|
125
|
+
{ variant, size }
|
|
170
126
|
) => {
|
|
171
127
|
return {
|
|
172
128
|
root: {
|
|
@@ -233,10 +189,8 @@ const useStyles = createStyles(
|
|
|
233
189
|
|
|
234
190
|
inner: {
|
|
235
191
|
display: 'flex',
|
|
236
|
-
alignItems: 'center',
|
|
237
|
-
justifyContent: 'center',
|
|
238
192
|
height: '100%',
|
|
239
|
-
|
|
193
|
+
flex: 1,
|
|
240
194
|
},
|
|
241
195
|
|
|
242
196
|
label: {
|
|
@@ -245,6 +199,9 @@ const useStyles = createStyles(
|
|
|
245
199
|
overflow: 'hidden',
|
|
246
200
|
display: 'flex',
|
|
247
201
|
alignItems: 'center',
|
|
202
|
+
justifyContent: 'center',
|
|
203
|
+
flexDirection: 'row',
|
|
204
|
+
flex: 1,
|
|
248
205
|
},
|
|
249
206
|
};
|
|
250
207
|
}
|
|
@@ -69,6 +69,8 @@ export interface ButtonProps extends DefaultProps {
|
|
|
69
69
|
disabled?: boolean;
|
|
70
70
|
|
|
71
71
|
style?: any;
|
|
72
|
+
|
|
73
|
+
withTextWrapper?: boolean;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
const defaultProps: Partial<ButtonProps> = {
|
|
@@ -78,75 +80,59 @@ const defaultProps: Partial<ButtonProps> = {
|
|
|
78
80
|
loaderPosition: 'left',
|
|
79
81
|
};
|
|
80
82
|
|
|
81
|
-
export const _Button = forwardRef<View, ButtonProps>(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
export const _Button = forwardRef<View, ButtonProps>((props, ref) => {
|
|
84
|
+
const {
|
|
85
|
+
size,
|
|
86
|
+
color,
|
|
87
|
+
type,
|
|
88
|
+
disabled,
|
|
89
|
+
children,
|
|
90
|
+
leftIcon,
|
|
91
|
+
rightIcon,
|
|
92
|
+
fullWidth,
|
|
93
|
+
variant,
|
|
94
|
+
radius,
|
|
95
|
+
uppercase,
|
|
96
|
+
compact,
|
|
97
|
+
loading,
|
|
98
|
+
loaderPosition,
|
|
99
|
+
loaderProps,
|
|
100
|
+
gradient,
|
|
101
|
+
style,
|
|
102
|
+
withTextWrapper = true,
|
|
103
|
+
...others
|
|
104
|
+
} = useComponentDefaultProps('Button', defaultProps, props);
|
|
105
|
+
|
|
106
|
+
const { styles, sx } = useStyles(
|
|
107
|
+
{
|
|
108
|
+
radius,
|
|
86
109
|
color,
|
|
87
|
-
type,
|
|
88
|
-
disabled,
|
|
89
|
-
children,
|
|
90
|
-
leftIcon,
|
|
91
|
-
rightIcon,
|
|
92
110
|
fullWidth,
|
|
93
|
-
variant,
|
|
94
|
-
radius,
|
|
95
|
-
uppercase,
|
|
96
111
|
compact,
|
|
97
|
-
loading,
|
|
98
|
-
loaderPosition,
|
|
99
|
-
loaderProps,
|
|
100
112
|
gradient,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
// const colors = theme.fn.variant({ color, variant });
|
|
127
|
-
|
|
128
|
-
// const loader = (
|
|
129
|
-
// <Loader
|
|
130
|
-
// color={colors.color}
|
|
131
|
-
// size={`calc(${(getSize({ size, sizes }) as any).height} / 2)`}
|
|
132
|
-
// {...loaderProps}
|
|
133
|
-
// />
|
|
134
|
-
// );
|
|
135
|
-
const loader = <ActivityIndicator />;
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<UnstyledButton
|
|
139
|
-
style={sx(styles.root, style)}
|
|
140
|
-
// type={type}
|
|
141
|
-
// disabled={disabled}
|
|
142
|
-
data-button
|
|
143
|
-
data-disabled={disabled || undefined}
|
|
144
|
-
data-loading={loading || undefined}
|
|
145
|
-
ref={ref}
|
|
146
|
-
// unstyled={unstyled}
|
|
147
|
-
{...others}
|
|
148
|
-
>
|
|
149
|
-
<BoxView style={styles.inner}>
|
|
113
|
+
withLeftIcon: !!leftIcon,
|
|
114
|
+
withRightIcon: !!rightIcon,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Button',
|
|
118
|
+
variant,
|
|
119
|
+
size,
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const loader = <ActivityIndicator />;
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<UnstyledButton
|
|
127
|
+
style={sx(styles.root, style)}
|
|
128
|
+
data-button
|
|
129
|
+
data-disabled={disabled || undefined}
|
|
130
|
+
data-loading={loading || undefined}
|
|
131
|
+
ref={ref}
|
|
132
|
+
{...others}
|
|
133
|
+
>
|
|
134
|
+
<BoxView style={styles.inner}>
|
|
135
|
+
<BoxView style={styles.label}>
|
|
150
136
|
{(leftIcon || (loading && loaderPosition === 'left')) && (
|
|
151
137
|
<BoxView style={sx(styles.icon, styles.leftIcon)}>
|
|
152
138
|
{loading && loaderPosition === 'left' ? loader : leftIcon}
|
|
@@ -156,27 +142,16 @@ export const _Button = forwardRef<View, ButtonProps>(
|
|
|
156
142
|
{loading && loaderPosition === 'center' && (
|
|
157
143
|
<BoxView style={styles.centerLoader}>{loader}</BoxView>
|
|
158
144
|
)}
|
|
159
|
-
|
|
160
|
-
<BoxView
|
|
161
|
-
style={styles.label}
|
|
162
|
-
// style={{ textTransform: uppercase ? 'uppercase' : undefined }}
|
|
163
|
-
>
|
|
164
|
-
{typeof children === 'string' || typeof children === 'number' ? (
|
|
165
|
-
<Text>{children}</Text>
|
|
166
|
-
) : (
|
|
167
|
-
children
|
|
168
|
-
)}
|
|
169
|
-
</BoxView>
|
|
170
|
-
|
|
145
|
+
{withTextWrapper ? <Text>{children}</Text> : children}
|
|
171
146
|
{(rightIcon || (loading && loaderPosition === 'right')) && (
|
|
172
147
|
<BoxView style={sx(styles.icon, styles.rightIcon)}>
|
|
173
148
|
{loading && loaderPosition === 'right' ? loader : rightIcon}
|
|
174
149
|
</BoxView>
|
|
175
150
|
)}
|
|
176
151
|
</BoxView>
|
|
177
|
-
</
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
) as any;
|
|
152
|
+
</BoxView>
|
|
153
|
+
</UnstyledButton>
|
|
154
|
+
);
|
|
155
|
+
}) as any;
|
|
181
156
|
|
|
182
157
|
export const Button = _Button;
|
|
@@ -325,10 +325,10 @@ export const ChipGroup = forwardRef<any, ChipGroupProps>((props, ref) => {
|
|
|
325
325
|
};
|
|
326
326
|
|
|
327
327
|
const enhancedChildren = React.Children.map(children, (child) => {
|
|
328
|
-
if (React.isValidElement(child) && child.type === Chip) {
|
|
329
|
-
const chipValue = child.props.value;
|
|
328
|
+
if (React.isValidElement(child) && (child.type as any) === Chip) {
|
|
329
|
+
const chipValue = (child.props as ChipProps).value;
|
|
330
330
|
if (chipValue !== undefined) {
|
|
331
|
-
return React.cloneElement(child as React.ReactElement<ChipProps>, {
|
|
331
|
+
return React.cloneElement<ChipProps>(child as React.ReactElement<ChipProps>, {
|
|
332
332
|
checked: isChecked(chipValue),
|
|
333
333
|
onChange: (checked: boolean) => handleChipChange(chipValue, checked),
|
|
334
334
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { Icon } from '../Icon';
|
|
4
4
|
import type { DefaultProps, MantineSize } from '../../theme/types';
|
|
5
5
|
import { useComponentDefaultProps } from '../../theme/theme-provider';
|
|
6
6
|
import { createStyles } from '../../theme';
|
|
@@ -81,28 +81,7 @@ const useStyles = createStyles(
|
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
const CloseIcon = ({ size, color }: { size: number; color: string }) => (
|
|
84
|
-
<
|
|
85
|
-
<BoxView
|
|
86
|
-
style={{
|
|
87
|
-
position: 'absolute',
|
|
88
|
-
width: size,
|
|
89
|
-
height: 2,
|
|
90
|
-
backgroundColor: color,
|
|
91
|
-
top: (size - 2) / 2,
|
|
92
|
-
transform: [{ rotate: '45deg' }],
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
<BoxView
|
|
96
|
-
style={{
|
|
97
|
-
position: 'absolute',
|
|
98
|
-
width: size,
|
|
99
|
-
height: 2,
|
|
100
|
-
backgroundColor: color,
|
|
101
|
-
top: (size - 2) / 2,
|
|
102
|
-
transform: [{ rotate: '-45deg' }],
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
</BoxView>
|
|
84
|
+
<Icon name="times" size={size} color={color} />
|
|
106
85
|
);
|
|
107
86
|
|
|
108
87
|
const defaultProps: Partial<CloseButtonProps> = {
|
|
@@ -46,6 +46,7 @@ export const Collapse = forwardRef<any, CollapseProps>((props, ref) => {
|
|
|
46
46
|
} = useComponentDefaultProps('Collapse', defaultProps, props);
|
|
47
47
|
|
|
48
48
|
const [contentHeight, setContentHeight] = useState<number>(0);
|
|
49
|
+
const [isFirstLayout, setIsFirstLayout] = useState(true);
|
|
49
50
|
const heightAnim = useRef(new Animated.Value(opened ? 1 : 0)).current;
|
|
50
51
|
const opacityAnim = useRef(new Animated.Value(opened ? 1 : 0)).current;
|
|
51
52
|
|
|
@@ -53,10 +54,18 @@ export const Collapse = forwardRef<any, CollapseProps>((props, ref) => {
|
|
|
53
54
|
const { height } = event.nativeEvent.layout;
|
|
54
55
|
if (height > 0 && height !== contentHeight) {
|
|
55
56
|
setContentHeight(height);
|
|
57
|
+
if (isFirstLayout) {
|
|
58
|
+
setIsFirstLayout(false);
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
useEffect(() => {
|
|
64
|
+
// Don't animate on first render or if content height hasn't been measured yet
|
|
65
|
+
if (isFirstLayout || contentHeight === 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
60
69
|
const animations = [
|
|
61
70
|
Animated.timing(heightAnim, {
|
|
62
71
|
toValue: opened ? 1 : 0,
|
|
@@ -80,11 +89,11 @@ export const Collapse = forwardRef<any, CollapseProps>((props, ref) => {
|
|
|
80
89
|
onTransitionEnd();
|
|
81
90
|
}
|
|
82
91
|
});
|
|
83
|
-
}, [opened, heightAnim, opacityAnim, transitionDuration, animateOpacity, onTransitionEnd]);
|
|
92
|
+
}, [opened, heightAnim, opacityAnim, transitionDuration, animateOpacity, onTransitionEnd, contentHeight, isFirstLayout]);
|
|
84
93
|
|
|
85
94
|
const animatedHeight = heightAnim.interpolate({
|
|
86
95
|
inputRange: [0, 1],
|
|
87
|
-
outputRange: [0, contentHeight
|
|
96
|
+
outputRange: [0, contentHeight],
|
|
88
97
|
});
|
|
89
98
|
|
|
90
99
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
2
|
-
import { Animated } from 'react-native';
|
|
2
|
+
import { Animated, Dimensions, ScrollView } from 'react-native';
|
|
3
3
|
import { Paper } from '../Paper';
|
|
4
4
|
import type { DefaultProps, MantineNumberSize, SpacingValue } from '../../theme/types';
|
|
5
5
|
import { useComponentDefaultProps } from '../../theme/theme-provider';
|
|
@@ -30,6 +30,9 @@ export interface DialogProps extends DefaultProps {
|
|
|
30
30
|
bottom?: number;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
/** If true, dialog will be centered on screen */
|
|
34
|
+
centered?: boolean;
|
|
35
|
+
|
|
33
36
|
/** If true, dialog will show shadow */
|
|
34
37
|
withShadow?: boolean;
|
|
35
38
|
|
|
@@ -57,6 +60,7 @@ const useStyles = createStyles(
|
|
|
57
60
|
{
|
|
58
61
|
size,
|
|
59
62
|
position,
|
|
63
|
+
centered,
|
|
60
64
|
}: {
|
|
61
65
|
size: MantineNumberSize | number;
|
|
62
66
|
position?: {
|
|
@@ -65,6 +69,7 @@ const useStyles = createStyles(
|
|
|
65
69
|
right?: number;
|
|
66
70
|
bottom?: number;
|
|
67
71
|
};
|
|
72
|
+
centered?: boolean;
|
|
68
73
|
}
|
|
69
74
|
) => {
|
|
70
75
|
const getSize = () => {
|
|
@@ -73,6 +78,28 @@ const useStyles = createStyles(
|
|
|
73
78
|
return rem(sizes[sizeKey] || sizes.md);
|
|
74
79
|
};
|
|
75
80
|
|
|
81
|
+
const screenHeight = Dimensions.get('window').height;
|
|
82
|
+
const verticalMargin = 40; // Safety margin from screen edges
|
|
83
|
+
|
|
84
|
+
// If centered, calculate center position
|
|
85
|
+
if (centered) {
|
|
86
|
+
return {
|
|
87
|
+
root: {
|
|
88
|
+
position: 'absolute' as const,
|
|
89
|
+
width: getSize() as any,
|
|
90
|
+
maxWidth: '90%' as any,
|
|
91
|
+
maxHeight: (screenHeight - verticalMargin) as any,
|
|
92
|
+
zIndex: 1000,
|
|
93
|
+
// Center horizontally and vertically
|
|
94
|
+
left: '5%' as any,
|
|
95
|
+
right: '5%' as any,
|
|
96
|
+
top: '50%' as any,
|
|
97
|
+
transform: [{ translateY: -(screenHeight * 0.25) }] as any,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Default positioning logic
|
|
76
103
|
const defaultPosition = {
|
|
77
104
|
bottom: 20,
|
|
78
105
|
right: 20,
|
|
@@ -84,11 +111,23 @@ const useStyles = createStyles(
|
|
|
84
111
|
const posLeft = finalPosition && typeof finalPosition === 'object' && 'left' in finalPosition ? finalPosition.left : undefined;
|
|
85
112
|
const posRight = finalPosition && typeof finalPosition === 'object' && 'right' in finalPosition ? finalPosition.right : undefined;
|
|
86
113
|
|
|
114
|
+
// Calculate max height based on viewport and position
|
|
115
|
+
let maxHeight = screenHeight - verticalMargin;
|
|
116
|
+
|
|
117
|
+
// Adjust max height based on position
|
|
118
|
+
if (posTop !== undefined) {
|
|
119
|
+
maxHeight = screenHeight - posTop - verticalMargin;
|
|
120
|
+
}
|
|
121
|
+
if (posBottom !== undefined) {
|
|
122
|
+
maxHeight = screenHeight - posBottom - verticalMargin;
|
|
123
|
+
}
|
|
124
|
+
|
|
87
125
|
return {
|
|
88
126
|
root: {
|
|
89
127
|
position: 'absolute' as const,
|
|
90
128
|
width: getSize() as any,
|
|
91
129
|
maxWidth: '90%' as any as any,
|
|
130
|
+
maxHeight: maxHeight as any,
|
|
92
131
|
zIndex: 1000,
|
|
93
132
|
...(posTop !== undefined && { top: rem(posTop) as any }),
|
|
94
133
|
...(posBottom !== undefined && { bottom: rem(posBottom) as any }),
|
|
@@ -116,6 +155,7 @@ export const Dialog = forwardRef<any, DialogProps>((props, ref) => {
|
|
|
116
155
|
padding,
|
|
117
156
|
radius,
|
|
118
157
|
position,
|
|
158
|
+
centered,
|
|
119
159
|
withShadow,
|
|
120
160
|
withBorder,
|
|
121
161
|
style,
|
|
@@ -123,7 +163,7 @@ export const Dialog = forwardRef<any, DialogProps>((props, ref) => {
|
|
|
123
163
|
...otherProps
|
|
124
164
|
} = useComponentDefaultProps('Dialog', defaultProps, props);
|
|
125
165
|
|
|
126
|
-
const { styles, sx } = useStyles({ size, position}, { name: 'Dialog' }) as any;
|
|
166
|
+
const { styles, sx } = useStyles({ size, position, centered }, { name: 'Dialog' }) as any;
|
|
127
167
|
|
|
128
168
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
129
169
|
const slideAnim = useRef(new Animated.Value(50)).current;
|
|
@@ -174,14 +214,19 @@ export const Dialog = forwardRef<any, DialogProps>((props, ref) => {
|
|
|
174
214
|
]}
|
|
175
215
|
{...otherProps}
|
|
176
216
|
>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
p={padding}
|
|
181
|
-
withBorder={withBorder}
|
|
217
|
+
<ScrollView
|
|
218
|
+
showsVerticalScrollIndicator={false}
|
|
219
|
+
bounces={false}
|
|
182
220
|
>
|
|
183
|
-
|
|
184
|
-
|
|
221
|
+
<Paper
|
|
222
|
+
shadow={withShadow ? 'lg' : undefined}
|
|
223
|
+
radius={radius}
|
|
224
|
+
p={padding}
|
|
225
|
+
withBorder={withBorder}
|
|
226
|
+
>
|
|
227
|
+
{children}
|
|
228
|
+
</Paper>
|
|
229
|
+
</ScrollView>
|
|
185
230
|
</Animated.View>
|
|
186
231
|
);
|
|
187
232
|
});
|
|
@@ -264,22 +264,16 @@ export const Drawer = forwardRef<any, DrawerProps>((props, ref) => {
|
|
|
264
264
|
onRequestClose={onClose}
|
|
265
265
|
statusBarTranslucent
|
|
266
266
|
>
|
|
267
|
+
{/* Full screen overlay backdrop */}
|
|
267
268
|
{withOverlay && (
|
|
268
|
-
<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
>
|
|
274
|
-
<Overlay
|
|
275
|
-
opacity={overlayOpacity}
|
|
276
|
-
color={overlayColor}
|
|
277
|
-
onPress={handleOverlayPress}
|
|
278
|
-
style={{ position: 'absolute' }}
|
|
279
|
-
/>
|
|
280
|
-
</Animated.View>
|
|
269
|
+
<Overlay
|
|
270
|
+
opacity={overlayOpacity}
|
|
271
|
+
color={overlayColor}
|
|
272
|
+
onPress={handleOverlayPress}
|
|
273
|
+
/>
|
|
281
274
|
)}
|
|
282
275
|
|
|
276
|
+
{/* Drawer container positioned over overlay */}
|
|
283
277
|
<BoxView style={styles.overlay} pointerEvents="box-none">
|
|
284
278
|
<Animated.View
|
|
285
279
|
ref={ref}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { TextStyle } from 'react-native';
|
|
3
|
+
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
|
4
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
5
|
+
|
|
6
|
+
export interface IconProps {
|
|
7
|
+
/** Icon name from FontAwesome */
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
/** Icon size in pixels */
|
|
11
|
+
size?: number;
|
|
12
|
+
|
|
13
|
+
/** Icon color */
|
|
14
|
+
color?: string;
|
|
15
|
+
|
|
16
|
+
/** Additional styles */
|
|
17
|
+
style?: TextStyle;
|
|
18
|
+
|
|
19
|
+
/** Whether to use theme color */
|
|
20
|
+
useThemeColor?: boolean;
|
|
21
|
+
|
|
22
|
+
/** Allow font scaling */
|
|
23
|
+
allowFontScaling?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const defaultProps: Partial<IconProps> = {
|
|
27
|
+
size: 16,
|
|
28
|
+
allowFontScaling: false,
|
|
29
|
+
useThemeColor: false,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Icon component using react-native-vector-icons with FontAwesome
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Icon name="heart" size={24} color="red" />
|
|
38
|
+
* <Icon name="star" size={20} useThemeColor />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const Icon = forwardRef<any, IconProps>((props, ref) => {
|
|
42
|
+
const {
|
|
43
|
+
name,
|
|
44
|
+
size,
|
|
45
|
+
color,
|
|
46
|
+
style,
|
|
47
|
+
useThemeColor,
|
|
48
|
+
allowFontScaling,
|
|
49
|
+
...others
|
|
50
|
+
} = {
|
|
51
|
+
...defaultProps,
|
|
52
|
+
...props,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const theme = useTheme();
|
|
56
|
+
|
|
57
|
+
const iconColor = color || (useThemeColor
|
|
58
|
+
? (theme.colorScheme === 'dark' ? theme.colors.dark?.[0] : theme.black)
|
|
59
|
+
: undefined);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<FontAwesomeIcon
|
|
63
|
+
ref={ref}
|
|
64
|
+
name={name}
|
|
65
|
+
size={size}
|
|
66
|
+
color={iconColor}
|
|
67
|
+
style={style}
|
|
68
|
+
allowFontScaling={allowFontScaling}
|
|
69
|
+
{...others}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
Icon.displayName = 'Icon';
|