File tree 2 files changed +10
-10
lines changed
taro-components-rn/src/components/Input
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ const _Input = (props: InputProps) => {
121
121
if ( typeof result === 'string' ) {
122
122
tmpValue . current = result
123
123
setReturnValue ( result )
124
- } else if ( returnValue ) {
124
+ } else if ( returnValue !== undefined ) {
125
125
// 为了处理输入不合法,setState 相同值时,状态不更新,UI 也得不到更新,重置状态进而更新
126
126
setReturnValue ( undefined )
127
127
}
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ const hideKeyboard = (opts: Taro.hideKeyboard.Option = {}): Promise<TaroGeneral.
17
17
const _cbManager = createCallbackManager ( )
18
18
let _hasListener = false
19
19
20
- const keyboardHeightListener = ( e ) => {
21
- _cbManager . trigger ( { height : e . endCoordinates . height } )
20
+ const keyboardHeightListener = ( height : number ) => {
21
+ _cbManager . trigger ( { height } )
22
22
}
23
23
24
24
/**
@@ -28,8 +28,12 @@ const keyboardHeightListener = (e) => {
28
28
const onKeyboardHeightChange = ( callback : Taro . onKeyboardHeightChange . Callback ) : void => {
29
29
_cbManager . add ( callback )
30
30
if ( ! _hasListener ) {
31
- Keyboard . addListener ( 'keyboardDidShow' , keyboardHeightListener )
32
- Keyboard . addListener ( 'keyboardDidHide' , keyboardHeightListener )
31
+ Keyboard . addListener ( 'keyboardDidShow' , ( e ) => {
32
+ keyboardHeightListener ( e . endCoordinates . height )
33
+ } )
34
+ Keyboard . addListener ( 'keyboardDidHide' , ( ) => {
35
+ keyboardHeightListener ( 0 )
36
+ } )
33
37
_hasListener = true
34
38
}
35
39
}
@@ -53,8 +57,4 @@ const offKeyboardHeightChange = (callback?: Taro.onKeyboardHeightChange.Callback
53
57
}
54
58
}
55
59
56
- export {
57
- hideKeyboard ,
58
- offKeyboardHeightChange ,
59
- onKeyboardHeightChange
60
- }
60
+ export { hideKeyboard , offKeyboardHeightChange , onKeyboardHeightChange }
You can’t perform that action at this time.
0 commit comments