Onaracs
Onaracs

Reputation: 935

React Native: Exception thrown while executing UI block

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

Upvotes: 26

Views: 30524

Answers (6)

foloinfo
foloinfo

Reputation: 693

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

Upvotes: 0

pzupan
pzupan

Reputation: 327

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
/>

Upvotes: 1

mrmicrowaveoven
mrmicrowaveoven

Reputation: 185

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.

Upvotes: 1

Marcus
Marcus

Reputation: 19

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

Upvotes: -1

ispirett
ispirett

Reputation: 666

Or make sure the value being passed is not NAN

Upvotes: 0

Doug Watkins
Doug Watkins

Reputation: 1448

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.

Upvotes: 7

Related Questions