反应原生 TextInput onBlur 在 android 上未定义 [英] react native TextInput onBlur get unedfined at android

查看:58
本文介绍了反应原生 TextInput onBlur 在 android 上未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 react-native 版本是 0.38.0

My react-native version is 0.38.0

<TextInput onBlur={ (event) =>
   this.handleBlurCheck(event.nativeEvent.text,params) } />

在函数 handleBlurCheck 中,我在 iOS 上得到了值,但在 Android 上得到了 undefined.

In function handleBlurCheck, I get the value at iOS, but I get undefined at Android.

TextInput在android平台上模糊时如何获取价值?

How to get value when TextInput is blurred on android platform?

iOS 上的 nativeEvent 对象:

The nativeEvent object on iOS:

nativeEvent:{
    eventCount: 5,
    target: 1046,
    text: '56'
}

Android 上的 nativeEvent:

The nativeEvent on Android:

nativeEvent:{
    target: 1046,
}

推荐答案

尝试使用 onEndEditing,如

<TextInput onEndEditing={ (event) => this.handleBlurCheck(event.nativeEvent.text,params) } />

您可以在此处

这篇关于反应原生 TextInput onBlur 在 android 上未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆