FormidableLabs/victory-native-xl

dual y axis issue

Closed this issue · 1 comments

  • I have searched the open issues to make sure I'm not opening a duplicate issue
  • I have read through the docs before asking a question
  • I am using the latest version of victory-native-xl

Describe Your Environment

What version of victory-native-xl are you using? (can be found by running npm list --depth 0 victory-native)
41.4.0

What version of React and React Native are you using?
18.2.0, 0.74.5

What version of Reanimated and React Native Skia are you using?

Are you using Expo or React Native CLI?
Expo

What platform are you on? (e.g., iOS, Android)
iOS

Describe the Problem

I get the following error when dynamically adding a second axis.

in my code I have a switch statement depending on graph type.

switch (type) {
    case 'day':
      yKeys = ['a', 'b', 'c', 'd'];
      yAxis=[
        {
          yKeys: ['a', 'b', 'c'],
          font,
        },
        {
          yKeys: ['d'],
          font,
          axisSide: 'right'
        }
      ];
      break;
    case 'month':
      yKeys = ['a', 'b', 'c'];
      yAxis=[{
        yKeys: ['a', 'b', 'c'],
        font,
      }];
      break;

Expected behavior: [What you expect to happen]
the graph should load with no errors

Actual behavior: [What actually happens]
the graphs loads but this error occurs

Warning: Encountered two children with the same key, y-tick-NaN. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

zibs commented

Interesting -- it looks like your data may be incorrectly configured, or something else is going on as it gets transformed.

Without more data, I'm not sure I can take too much more of a deeper look here. Can you update your example with more code/example data/a minimal way for me to reproduce this? Then I'd be happy to take a look.