indiespirit / react-native-chart-kit

📊React Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)
https://expo.io/@indiespirit/react-native-chart-kit
MIT License
2.85k stars 659 forks source link

Add onPress on the decorator element #610

Open laerciokonzen opened 2 years ago

laerciokonzen commented 2 years ago

I need to navigate when the user select the tooltip content, I`m using the decorator and on Android it works fine.

But on iOS the onPress never gets triggered.

I have the following GraphTooltip component (simplified version):

<View style={{ width: widthLimit }}>
    <Svg>
     .......
      <Rect
        onPress={onPress}
        x={rectX}
        y={toolTipInfo.y + 30}
        width={rectWidth}
        height={rectY}
      />
      ......
      <TextSVG
        ...
        onPress={onPress}
      >
        {actionText}
      </TextSVG>
    </Svg>
  </View>

And on the decorator i have this:

...
decorator={() => {
    return (
      <GraphToolTip 
        averageTitle={averageTitle} 
        toolTipInfo={userToolTips} 
        onPress={navigateToList} 
        actionText={t('TestResult.ViewDetails')} />
    )
  }}
...

The result is this: image

NoamKu95 commented 5 months ago

Same, can't make it work :\

kingka commented 3 months ago

+1

kingka commented 3 months ago

I need to navigate when the user select the tooltip content, I`m using the decorator and on Android it works fine.

But on iOS the onPress never gets triggered.

I have the following GraphTooltip component (simplified version):

<View style={{ width: widthLimit }}>
    <Svg>
     .......
      <Rect
        onPress={onPress}
        x={rectX}
        y={toolTipInfo.y + 30}
        width={rectWidth}
        height={rectY}
      />
      ......
      <TextSVG
        ...
        onPress={onPress}
      >
        {actionText}
      </TextSVG>
    </Svg>
  </View>

And on the decorator i have this:

...
decorator={() => {
    return (
      <GraphToolTip 
        averageTitle={averageTitle} 
        toolTipInfo={userToolTips} 
        onPress={navigateToList} 
        actionText={t('TestResult.ViewDetails')} />
    )
  }}
...

The result is this: image

have some resolution ?