react-native-svg
react-native-svg copied to clipboard
Fatal Exception: java.lang.Error Invalid number formating character 'N'
APP crashes on some Android devices with following stack track when session starts. The crash cannot be reproduced on Emulator or other devices.
The SVG component was used in previous version with react-native-svg: "12.5.0", and no crash issue
Although the SVG component has been removed from in current version on the loading screen, the app gets the crash issue.
Current APP info:
- react-native: 0.71.7
- react: 18.2.0
- react-native-svg: 13.14.0
Fatal Exception: java.lang.Error: Invalid number formating character 'N' (i=1, s=MNaN NaN
A45 45 0 0 1 48 3)
at com.horcrux.svg.PathParser.parse_number(PathParser.java:627)
at com.horcrux.svg.PathParser.parse_list_number(PathParser.java:594)
at com.horcrux.svg.PathParser.parse(PathParser.java:108)
at com.horcrux.svg.PathView.setD(PathView.java:28)
at com.horcrux.svg.RenderableViewManager$PathViewManager.setD(RenderableViewManager.java:751)
at com.horcrux.svg.RenderableViewManager$PathViewManager.setD(RenderableViewManager.java:740)
at com.facebook.react.viewmanagers.RNSVGPathManagerDelegate.setProperty(RNSVGPathManagerDelegate.java:112)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:46)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:84)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:188)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:909)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1397)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1408)
at android.view.Choreographer.doCallbacks(Choreographer.java:1008)
at android.view.Choreographer.doFrame(Choreographer.java:934)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1382)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8501)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Hey, did you figure out this issue? I am getting the same error and am stuck on it as well. Thanks!
the error seems from the lib react-native-progress
Hello @Bob-MYMC, As I see, the issue is not related to the library. Shall we close the issue?
@Bob-MYMC, I'm getting the same error in my app on firebase, and users reporting crashes which I think are related. But I cannot replicate on any emulators or physical devices I have. How did you figure out it was coming from the lib react-native-progress? I don't have this package, but I have other packages that are dependant on rnsvg.
My error message reads like so:
java.lang.Error - Invalid number formating character 'N'
Fatal Exception: java.lang.Error Unexpected end (s=M ) com.horcrux.svg.PathParser.parse_number (PathParser.java:606) com.horcrux.svg.PathParser.parse_list_number (PathParser.java:594) com.horcrux.svg.PathParser.parse (PathParser.java:108) com.horcrux.svg.PathView.setD (PathView.java:28) com.horcrux.svg.RenderableViewManager$PathViewManager.setD (RenderableViewManager.java:751) com.horcrux.svg.RenderableViewManager$PathViewManager.setD (RenderableViewManager.java:740) com.facebook.react.viewmanagers.RNSVGPathManagerDelegate.setProperty (RNSVGPathManagerDelegate.java:112) com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:46) com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:84) com.facebook.react.uimanager.ViewManager.createViewInstance (ViewManager.java:188) com.facebook.react.uimanager.ViewManager.createView (ViewManager.java:115) com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:281) com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:194) com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations (UIViewOperationQueue.java:1110) com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1081) com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29) com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175) com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85) android.view.Choreographer$CallbackRecord.run (Choreographer.java:1142)
@ryelibra37, Can you provide an example of how we can reproduce that problem? Thank you
@bohdanprog unfortunately not, because I have no way of replicating the error on a device or simulator, so I could make a bare copy of my repo but I would not know whether it was causing this error. It mainly seems to be affecting google pixel 7 pro devices.
@Bob-MYMC, I'm getting the same error in my app on firebase, and users reporting crashes which I think are related. But I cannot replicate on any emulators or physical devices I have. How did you figure out it was coming from the lib react-native-progress? I don't have this package, but I have other packages that are dependant on rnsvg.
My error message reads like so:
java.lang.Error - Invalid number formating character 'N'
Fatal Exception: java.lang.Error
Unexpected end (s=M )
com.horcrux.svg.PathParser.parse_number (PathParser.java:606)
com.horcrux.svg.PathParser.parse_list_number (PathParser.java:594)
com.horcrux.svg.PathParser.parse (PathParser.java:108)
com.horcrux.svg.PathView.setD (PathView.java:28)
com.horcrux.svg.RenderableViewManager$PathViewManager.setD (RenderableViewManager.java:751)
com.horcrux.svg.RenderableViewManager$PathViewManager.setD (RenderableViewManager.java:740)
com.facebook.react.viewmanagers.RNSVGPathManagerDelegate.setProperty (RNSVGPathManagerDelegate.java:112)
com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:46)
com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:84)
com.facebook.react.uimanager.ViewManager.createViewInstance (ViewManager.java:188)
com.facebook.react.uimanager.ViewManager.createView (ViewManager.java:115)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:281)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:194)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations (UIViewOperationQueue.java:1110)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1081)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1142)
the crash has not been reported again since the lib was replaced
@bohdanprog unfortunately not, because I have no way of replicating the error on a device or simulator, so I could make a bare copy of my repo but I would not know whether it was causing this error. It mainly seems to be affecting google pixel 7 pro devices.
Okay, if you find a way to reproduce that issue, you can open a new issue, with a simple repro of that problem. Thank you
Im having this issue too. Does anyone know how to fix it. Im on "react-native-svg": "13.4.0",
@fullychargedup Can you share an example of how to reproduce that issue, please?
same issue
Fatal Exception: java.lang.IllegalArgumentException: Invalid number formating character 'N' (i=46, s=M 0 -129.758242 A 129.758242 129.758242 0 0 1 NaN NaN L NaN NaN A 0 0 0 0 0 0 0 Z )
at com.horcrux.svg.PathParser.parse_number(PathParser.java:631)
at com.horcrux.svg.PathParser.parse_list_number(PathParser.java:598)
at com.horcrux.svg.PathParser.parse(PathParser.java:220)
at com.horcrux.svg.PathView.setD(PathView.java:28)
at com.horcrux.svg.RenderableViewManager$PathViewManager.setD(RenderableViewManager.java:756)
at com.horcrux.svg.RenderableViewManager$PathViewManager.setD(RenderableViewManager.java:745)
at com.facebook.react.viewmanagers.RNSVGPathManagerDelegate.setProperty(RNSVGPathManagerDelegate.java:106)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:46)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:77)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:181)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:108)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1121)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1092)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:2185)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:2196)
at android.view.Choreographer.doCallbacks(Choreographer.java:1365)
at android.view.Choreographer.doFrame(Choreographer.java:1207)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:2114)
at android.os.Handler.handleCallback(Handler.java:996)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:302)
at android.app.ActivityThread.main(ActivityThread.java:9652)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:601)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1062)
@Nader-CS any example related to that issue?
Hi i dont have an example i can share as our code is private, but I can say we use Instabug and this only happens on the galaxy S22, S23 and S24 phones. I dont have one of these physical devices so can't reproduce but the logs show those are the issue phones.
import React, {useMemo} from 'react';
import {
Dimensions,
Image,
Platform,
StyleSheet,
Text,
View,
} from 'react-native';
import {useTranslation} from 'react-i18next';
import {PieChart} from 'react-native-chart-kit';
import {useGetPointsAnalyticsQuery} from '@services';
import {colors, typo} from '@common';
import {convertEnglishNumbersToArabic} from '@utils/helpers';
import {moderateVerticalScale, moderateScale} from 'react-native-size-matters';
import {second_logo} from '@assets';
import {commonStyles} from '@utils/constants';
import {useSelector} from 'react-redux';
import {getUserCountry} from '@selectors';
const width = Dimensions.get('screen').width;
const chartConfig = {
color: (opacity = 1) => colors.colorWithAlpha(colors.black, opacity),
};
const PointsChart = ({type}) => {
const {t} = useTranslation();
const userCountry = useSelector(getUserCountry);
const {data} = useGetPointsAnalyticsQuery();
const currentPointPercentage = useMemo(
() =>
data?.points_analytics?.points && data?.points_analytics?.total_earned > 0
? (data?.points_analytics?.points * 100) /
data?.points_analytics?.total_earned
: 0,
[data],
);
const totalRedeemedPercentage = useMemo(
() =>
data?.points_analytics?.total_redeemed &&
data?.points_analytics?.total_earned > 0
? (data?.points_analytics?.total_redeemed * 100) /
data?.points_analytics?.total_earned
: 0,
[data],
);
const totalExpiredPercentage = useMemo(
() =>
data?.points_analytics?.expired &&
data?.points_analytics?.total_earned > 0
? (data?.points_analytics?.expired * 100) /
data?.points_analytics?.total_earned
: 0,
[data],
);
const chartData = useMemo(
() => [
{
points: currentPointPercentage,
color: colors.brown,
},
{
points: totalRedeemedPercentage,
color: colors.sand_dune,
},
{
points: totalExpiredPercentage,
color: colors.main_red,
},
],
[currentPointPercentage, totalRedeemedPercentage, totalExpiredPercentage],
);
const totalPoints = data?.points_analytics?.points || 0;
return (
<View style={styles.chartContainer}>
<PieChart
data={chartData}
width={width}
height={moderateScale(320, 0.25)}
paddingLeft={width / 4}
chartConfig={chartConfig}
accessor="points"
backgroundColor="transparent"
hasLegend={false}
/>
<View style={styles.insideChart}>
<Image style={styles.logo} source={second_logo} />
<Text style={styles.points} allowFontScaling={false}>
{convertEnglishNumbersToArabic(totalPoints)}
</Text>
<Text style={styles.pointsBalance} allowFontScaling={false}>
{t('points_balance')}
</Text>
<Text style={styles.equalsTo} allowFontScaling={false}>
{t('equals_to')}{' '}
<Text style={styles.equalsToPrice} allowFontScaling={false}>
{convertEnglishNumbersToArabic(
Number(totalPoints / userCountry?.redeeming_rate || 0).toFixed(2),
)}
</Text>{' '}
{userCountry?.country?.currency}
</Text>
</View>
</View>
);
};
export default PointsChart;
const styles = StyleSheet.create({
chartContainer: {
alignItems: 'center',
justifyContent: 'center',
},
insideChart: {
height: moderateVerticalScale(200, 0.25),
width: moderateScale(200, 0.25),
backgroundColor: colors.white,
zIndex: 10,
borderRadius: moderateScale(200),
position: 'absolute',
alignSelf: 'center',
alignItems: 'center',
justifyContent: 'center',
gap: Platform.OS == 'ios' ? commonStyles.gap / 1.5 : 0,
},
logo: {
width: moderateScale(125),
height: moderateVerticalScale(27),
resizeMode: 'contain',
},
points: {
fontSize: commonStyles.biggerFontSize,
fontFamily: typo.sofiaBroBlack,
color: colors.brown,
},
pointsBalance: {
fontSize: commonStyles.thirdFontSize,
fontFamily: typo.sofiaBroRegular,
color: colors.black,
},
equalsTo: {
fontSize: commonStyles.secondaryFontSize,
color: colors.black,
paddingBottom: moderateVerticalScale(15),
fontFamily: typo.sofiaBroRegular,
},
equalsToPrice: {
fontFamily: typo.sofiaBroBlack,
color: colors.brown,
},
});
this issue most occur in samsung