React Native:执行UI块时引发异常 [英] React Native: Exception thrown while executing UI block
问题描述
我正在构建一个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.value
是undefined
.
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屋!