React Native: Exception thrown while executing UI block
Asked Answered
A

6

26

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

enter image description here

Annabel answered 6/5, 2017 at 16:47 Comment(4)
I had the same problem while calling setValue(param) on an instance of Animated.Value, because param was undefined by mistakeCanner
See this solution it worked for me: github.com/meteor-factory/react-native-tinder-swipe-cards/…Acadian
Do not post an image when text would suffice.Subaqueous
I have solved a simillar problem here for Victory Native: https://mcmap.net/q/537539/-exception-thrown-while-executing-ui-block-39-parentnode-39-is-a-required-a-required-parameterDafna
B
7

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.

Baxie answered 3/10, 2018 at 17:38 Comment(0)
I
1

I got the same error when passing an undefined to the defaultSource prop of an Image.

<Image
    style={styles.imageStyle}
    source={someImageSource}
    defaultSource={imageFallback}
/>

When imageFallback is undefined, I got this error.

Previous answers mention passing an undefined into Animated.Value. Given that my experience is via a different component, this error probably means you're passing an undefined somewhere.

I found the culprit by commenting out varying lines of code to see what caused the error to appear. Tedious but effective.

Incongruous answered 9/2, 2022 at 20:59 Comment(0)
H
1

This exception was thrown for me on passing a null value as the html value to WebView. The source cannot be a null.

<WebView
  originWhitelist={['*']}
  source={{ html: summary }}
  style={[styles.webView, { height: webViewHeight }]}
  scalesPageToFit={false}
  useWebKit
/>
Hollinger answered 15/3, 2022 at 18:25 Comment(0)
A
0

Or make sure the value being passed is not NAN

Aeneus answered 27/2, 2019 at 23:23 Comment(0)
G
0

You may have to add @objc above the block in native code where you define the property.

Garate answered 11/11, 2019 at 20:37 Comment(0)
D
0

In my case the problem was the nesting of TouchableWithoutFeedback within TouchableOpacity.

Removing the nested TouchableWithoutFeedback solved the problem.
It used to work fine, but now fails with react-native: 0.73.6

Desmarais answered 8/5 at 2:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.