@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.
@@ -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 14:27:25
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> = (props) => {
19
- return (
20
-
21
- <View style={
22
- [
23
- {
24
- flexGrow: 0, flexShrink: 1, zIndex: 1,
25
- // paddingHorizontal: px2dp(0),
26
- height: px2dp(16), minWidth: px2dp(16), borderRadius: px2dp(8),
27
- justifyContent: 'center', alignItems: 'center',
28
- backgroundColor: 'red'
29
- },
30
- props.style
31
- ]
32
- } >
33
-
34
-
35
- <Text style={{ fontSize: px2sp(12), color: 'white', textAlign: 'center' }}> {props.count > 99 ? '+99' : props.count} </Text>
36
-
37
- </View>
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
 
@@ -2,8 +2,8 @@
2
2
  * @Author: shiguo
3
3
  * @Date: 2022-04-21 14:43:14
4
4
  * @LastEditors: shiguo
5
- * @LastEditTime: 2022-04-26 10:49:39
6
- * @FilePath: /@aks/easy/lib/Badge/index.ts
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 : React.FC<BadgeProps>
20
+ export declare const Badge: React.FC<BadgeProps>
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "description": "移动端App开发工具包",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",