@aks-dev/easyui 1.0.72 → 1.0.73
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/lib/Badge/Badge.tsx +25 -25
- package/lib/Badge/index.ts +4 -4
- package/package.json +1 -1
package/lib/Badge/Badge.tsx
CHANGED
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-21 14:40:29
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-07-08
|
|
5
|
+
* @LastEditTime: 2022-07-08 15:40:21
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/Badge/Badge.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react'
|
|
9
9
|
import { View, Text, } from 'react-native'
|
|
10
|
-
import {px2dp} from '../../screen/px2dp'
|
|
11
|
-
import {px2sp} from '../../screen/px2sp'
|
|
10
|
+
import { px2dp } from '../../screen/px2dp'
|
|
11
|
+
import { px2sp } from '../../screen/px2sp'
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
import type { BadgeProps } from '.'
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
export const Badge: React.FC<BadgeProps>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
18
|
+
export const Badge: React.FC<BadgeProps>
|
|
19
|
+
= (props) => {
|
|
20
|
+
if (isNaN(+props.count) || Number(props.count) == 0) return <View />
|
|
21
|
+
return (
|
|
22
|
+
|
|
23
|
+
<View style={
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
flexGrow: 0, flexShrink: 1, zIndex: 1,
|
|
27
|
+
// paddingHorizontal: px2dp(0),
|
|
28
|
+
height: px2dp(16), minWidth: px2dp(16), borderRadius: px2dp(8),
|
|
29
|
+
justifyContent: 'center', alignItems: 'center',
|
|
30
|
+
backgroundColor: 'red'
|
|
31
|
+
},
|
|
32
|
+
props.style
|
|
33
|
+
]
|
|
34
|
+
} >
|
|
35
|
+
<Text style={{ fontSize: px2sp(12), color: 'white', textAlign: 'center' }}> {props.count > 99 ? '+99' : props.count} </Text>
|
|
36
|
+
|
|
37
|
+
</View>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
40
|
|
package/lib/Badge/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-21 14:43:14
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks/
|
|
5
|
+
* @LastEditTime: 2022-07-08 15:40:30
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Badge/index.ts
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
9
9
|
import { StyleProp, ViewStyle } from 'react-native'
|
|
@@ -13,9 +13,9 @@ import { StyleProp, ViewStyle } from 'react-native'
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
export declare type BadgeProps = {
|
|
16
|
-
count: number;
|
|
16
|
+
count: number | string;
|
|
17
17
|
style?: StyleProp<ViewStyle>
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export declare const Badge
|
|
20
|
+
export declare const Badge: React.FC<BadgeProps>
|
|
21
21
|
|