React Native:执行UI块时引发异常 [英] React Native: Exception thrown while executing UI block

查看:103
本文介绍了React Native:执行UI块时引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个iOS react-native应用程序,当前正在使用react-native-swipe-card程序包为我的应用程序构建像刷卡一样的"tinder".该应用程序运行正常,但是,当我去向左或向右滑动卡片时,当它离屏幕一半时放开时,出现以下错误:

ExceptionsManager.js:71执行UI块时引发异常:-[NSNull floatValue]:无法识别的选择器已发送到实例0x1075b5130

解决方案

正如@Peuchele所说,我遇到了同样的错误,发生这种错误的原因是因为我将一个值传递给了一个未定义的Animated View. /p>

因此,为澄清起见,请确保使用Animated.Value传递到组件的任何值都未定义.

我发现错误的特定代码是:

const { value } = props;

this.state = {
  translateYValue: new Animated.Value(value),
};

props.valueundefined.

I'm building an iOS react-native app, and I'm currently using the react-native-swipe-card package to build "tinder" like swipe cards for my app. The app works fine however when I go to swipe a card left or right, and let it go while it's halfway off the screen I'm getting the following error:

ExceptionsManager.js:71 Exception thrown while executing UI block: -[NSNull floatValue]: unrecognized selector sent to instance 0x1075b5130

解决方案

As @Peuchele commented, I was getting this same error, and the reason it was happening was because I passed a value into an Animated View that was undefined.

So, to clarify, make sure any values you pass into a component using an Animated.Value is not undefined.

The specific code I found at fault was:

const { value } = props;

this.state = {
  translateYValue: new Animated.Value(value),
};

And props.value was undefined.

这篇关于React Native:执行UI块时引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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