2

My app suddenly started crashing and gave me that error:

Exception thrown while executing UI block: -[__NSCFNumber firstObject]: unrecognized selector 
sent to instance 0xb553069cd18775de`

After sometime I was able isolate the part that generates the error and found out that it has to do with the Svg component imported from react-native-svg.
I tried removing and reinstalling node_modules and I tried reseting the cache, and I even tried creating a new expo app from scratch that does nothing but render an Svg component, but the problem still persists.

And on android I get a different error message:

Error while updating property 'fill' of a View managed by: RNSVGGroup
null
java.Lang.Double cannot be cast to
java.Lang.String

Here's what my code looks like:

import React from 'react';
import { View, StyleSheet } from 'react-native';
import { Svg } from 'react-native-svg';

const App = () =>  (
  <View style={styles.container}>
    <Svg width={100} height={100}>

    </Svg>
  </View>
);

const styles = StyleSheet.create({
  container:{
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  }
});

export default App;

Error Screenshot

6
  • 5
    The same situation. Reinstalling the package react-native-svg with "expo install" helped me. Commented Mar 5, 2020 at 16:55
  • That did solve it for me.. thanks @JavlonTulkinov Commented Mar 7, 2020 at 18:26
  • If you installed it using npm, remove the package first using npm uninstall. Then use expo install as @JavlonTulkinov mentioned. Commented Apr 3, 2020 at 11:45
  • 2
    For anyone encountering this problem with react-native-svg-charts and expo make sure to uninstall both react-native-svg-charts and react-native-svg, then first do expo install react-native-svg, then npm install --save react-native-svg-charts. Lost my entire day to this. Commented Jun 21, 2020 at 13:20
  • 2
    @Jesse u may have lost a day but u most certainly saved me one :) Commented Nov 8, 2022 at 3:11

2 Answers 2

11

Based on Javlon's comment the solution is to remove the package using npm uninstall react-native-svg or yarn remove react-native-svg
And then installing it again with expo install react-native-svg

Sign up to request clarification or add additional context in comments.

Comments

1

I was having same issue when using react-native-heroicons version 3.2.0. https://github.com/ecklf/react-native-heroicons

I downgraded react-native-svg which also gets installed with react-native-heroicons from 13.0.0 to 12.3.0 which then started to work.

To uninstall and install 12.3.0 version of react-native-svg follow below:
npm uninstall react-native-svg
npm install [email protected]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.