Victory-native: VictoryLine with single value breaks on android

Created on 2 Nov 2017  路  15Comments  路  Source: FormidableLabs/victory-native

Hi

I'm using the following dependencies and if my VictoryLine graph has only one value it will break with the stacktrace below on android. (But works as expected on ios)
"react": "16.0.0-alpha.12",
"react-native": "0.48.4",
"react-native-svg": "5.4.1",
"victory-native": "^0.15.0"

Error while updating property 'd' in shadow node of type: RNSVGPath

null

Attempt to invoke interface method 'int java.lang.CharSequence.length()' on a null object reference
updateShadowNodeProp
ViewManagersPropertyCache.java:116
setProperty
ViewManagerPropertyUpdater.java:154
updateProps
ViewManagerPropertyUpdater.java:58
updateProperties
ReactShadowNode.java:272
createView
UIImplementation.java:197
createView
UIManagerModule.java:249
invoke
Method.java
invoke
JavaMethodWrapper.java:363
invoke
JavaModuleWrapper.java:162
run
NativeRunnable.java
handleCallback
Handler.java:789
dispatchMessage
Handler.java:98
dispatchMessage
MessageQueueThreadHandler.java:31
loop
Looper.java:164
run
MessageQueueThreadImpl.java:194
run
Thread.java:764

Most helpful comment

it still crashes when you have only one data object

All 15 comments

are you setting the domain on the top level victorychart? I had the same issue and everything works fine if i remove the domain

No, even this simplest form below will reproduce the error...

    return (
        <VictoryChart>
            <VictoryLine
                //data={[{ x: 'oct', y: 123 }]} <- with this it breaks, but with the line below it works
                data={[{ x: 'oct', y: 123 }, { x: 'oct', y: 123 }]}
            />

        </VictoryChart>
    );

It also is broken when no data is given. (Empty array)

Actually it's a bug in Victory Native library. So do one thing, instead of passing single object, pass 2 object with same data as mentioned above by @frenberg .

it still crashes when you have only one data object

Any update on this?

The <VictoryLine/> component just doesn't work on Android at all. It crashes no matter what data I do or don't give it. The error I'm getting is a Java null object reference on java.lang.String.trim()

The <VictoryLine/> component just doesn't work on Android at all. It crashes no matter what data I do or don't give it. The error I'm getting is a Java null object reference on java.lang.String.trim()

I had the same problem, it was because "react-native-svg": "^7.0.2", is not compatible.
If your are using Expo remove it because it already includes the correct version, otherwise use a older version.

Thanks, that fixed it for me! Docs should be updated to reflect that you don't need to install react-native-svg if you're using expo.

Using a single element array passed into the data prop for VictoryLine crashes on iOS as well.

I'm using victory-native version 31.0.0

Here is example below:

//Breaking example below
        <VictoryLine
          interpolation="natural"
          data={[{x: 0, y: 0}]}
        />
//Working example below
        <VictoryLine
          interpolation="natural"
          data={[{x: 0, y: 0}, {x: 0, y: 0}]}
        />

this issue has some fix?

Same error with victorychart VictoryLine. maybe there's is no fix solution ...

Any thoughts on this? Also running into this scenario on Android when the data array contains only one object of x/y.

Any update on this?.
I am currently facing the same issue

We still use the same work around from my post above https://github.com/FormidableLabs/victory-native/issues/173#issuecomment-341643593

basically we do this:
if (data.length === 1) { data.unshift(data[0]); }
I don't think we can get an empty array in our case. At least the above has been working for a few years now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WhyX picture WhyX  路  6Comments

jlo1 picture jlo1  路  3Comments

ChrisGatzo picture ChrisGatzo  路  3Comments

jzhw0130 picture jzhw0130  路  3Comments

aszheng picture aszheng  路  5Comments