@gm-mobile/c-react 3.9.3-beta.28 → 3.9.3-beta.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-mobile/c-react",
3
- "version": "3.9.3-beta.28",
3
+ "version": "3.9.3-beta.29",
4
4
  "description": "> TODO: description",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-mobile#readme",
@@ -21,9 +21,9 @@
21
21
  "url": "https://github.com/gmfe/gm-mobile/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@gm-mobile/c-font": "^3.9.3-beta.28",
25
- "@gm-mobile/c-tool": "^3.9.3-beta.28",
26
- "@gm-mobile/locales": "^3.9.3-beta.28"
24
+ "@gm-mobile/c-font": "^3.9.3-beta.29",
25
+ "@gm-mobile/c-tool": "^3.9.3-beta.29",
26
+ "@gm-mobile/locales": "^3.9.3-beta.29"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@tarojs/components": "3.0.18",
@@ -33,5 +33,5 @@
33
33
  "prop-types": "^15.7.2",
34
34
  "react": "^16.13.1"
35
35
  },
36
- "gitHead": "61ce731ea8dcab46f05d3435b7a21bf7b969c005"
36
+ "gitHead": "216ad1a8f7127b895838785f208455768b382ba2"
37
37
  }
@@ -24,7 +24,12 @@ const CustomTabbar = () => {
24
24
  return null
25
25
  }
26
26
 
27
- return <View style={{ height: `${height}px` }} />
27
+ return (
28
+ <View
29
+ className='custom-tabbar-placeholder'
30
+ style={{ height: `${height}px` }}
31
+ />
32
+ )
28
33
  }
29
34
 
30
35
  CustomTabbar.getCustomTabbarHeight = getCustomTabbarHeight
@@ -17,6 +17,8 @@ const ios = mp && wx.getSystemInfoSync().platform === 'ios'
17
17
  interface TextFieldState {
18
18
  /** 是否输入状态 */
19
19
  active: boolean
20
+ /** 是否需要清空 */
21
+ needClear: boolean
20
22
  }
21
23
 
22
24
  const store = observable({ active: '' })
@@ -43,6 +45,7 @@ export class TextField extends Component<TextFieldProps, TextFieldState> {
43
45
 
44
46
  state = {
45
47
  active: false,
48
+ needClear: false,
46
49
  }
47
50
 
48
51
  id = uniqueId('textField-')
@@ -82,12 +85,17 @@ export class TextField extends Component<TextFieldProps, TextFieldState> {
82
85
  })
83
86
  }
84
87
  this.props.onClick && this.props.onClick(e)
88
+ this.setState({ ...this.state, needClear: !!this.props.rewriteMode })
85
89
  }
86
90
 
87
91
  onInput(e: any) {
88
92
  if (this.props.disabled) return
89
93
  if (!mp) e.persist()
90
94
  let value = mp ? e.detail.value : e.target.value
95
+ if (this.state.needClear) {
96
+ value = value.slice(-1)
97
+ this.setState({ ...this.state, needClear: false })
98
+ }
91
99
  const { min, max } = this.props
92
100
  if (
93
101
  value &&
@@ -63,6 +63,8 @@ interface TextFieldProps
63
63
  errClassName?: string
64
64
  /** 键盘和输入框距离,小程序特有 */
65
65
  cursorSpacing?: number
66
+ /** 重新获得焦点后,输入前清空现有内容 */
67
+ rewriteMode?: boolean
66
68
  onBlur?: () => void
67
69
  onFocus?: () => void
68
70
  /** e在web中和小程序中不一样 */