Victory-native: onPress is not working in VictoryPie in android

Created on 23 Mar 2018  路  10Comments  路  Source: FormidableLabs/victory-native

height={310}
width={310}
animate={{
duration: 2000,
onLoad: { duration: 1000 }
}}
//colorScale={["tomato", "orange", "green" ]}
colorScale={["green", "red", "blue" ]}
animate={{ duration: 2000 }}
labelRadius={90}
events={ [{
target: 'data',
eventHandlers: {
onPress: (evt, context, index) => {
return [
{
target: "labels",
mutation: (props) => {
let st = "";
if(index == 0 ){
st = "30%";
this.setState({
pietext:'Imran khan Rahat = 30%'
});

                }
                else if ( index == 1){
                  st = "30%";
                  this.setState({
                    pietext:'Saha= 30%'
                  });
                }
                else{
                  st = "40%";
                  this.setState({
                    pietext:'Mohit = 30%'
                  });
                }

                return props.text === "clicked" ? null : { text: st };
              }
            }
          ];

        // alert(index);
        },
      },
    }] }
    data={[
      { x: 1, y: 60, label: "imran" },
      { x: 2, y: 30, label: "saha" },
      { x: 3, y: 10, label: "mohit" }
    ]}

/>

Most helpful comment

The same issue for me

"react": "16.3.1",
"react-native": "0.55.3",
"react-native-svg": "^6.3.1",
"victory-native": "^0.18.0"

All 10 comments

I'm seeing the same thing.

RN 0.50.3 + VN 0.17.4.

Edit: Actually no it works fine for me. I had wrapped my <Svg> component in a <TouchableWithoutFeedback> to allow dismissing what was triggered by touching a slice of the pie but it only worked correctly on the iOS simulator and older iPhones.

Perhaps try wrapping your pie in an <Svg> and then add the prop standalone={false} to your <VictoryPie> component

I'm also facing this issue but in iOS. Did you managed to solve it?

The same issue for me

"react": "16.3.1",
"react-native": "0.55.3",
"react-native-svg": "^6.3.1",
"victory-native": "^0.18.0"

I got this issue too

"react": "16.4.0",
"react-native": "0.55.4",
"react-native-svg": "^8.0.8",
"victory-native": "^31.0.0"

I'm facing the same issue, help me please.
It's working on iOS, but not Android
<VictoryPie data={[ { x: "Cats", y: 35 }, { x: "Dogs", y: 40 }, { x: "Birds", y: 55 } ]} events={[{ target: 'data', eventHandlers: { onPress: (evt, context) => { alert('onPress') } } }]} />

Have the same issue as well - working on iOS, not on Android

"react": "^16.4.1",
"react-native": "^0.57.0",
"react-native-svg": "^8.0.8",
"victory-native": "^30.3.0",

@crazyhunter0892 Latest react-native-svg release fixed it for me (8.0.10)!

Any update of this?

@crazyhunter0892 Latest react-native-svg release fixed it for me (8.0.10)!

Hey bro, i still have the same problem with react-native-svg 8.0.10 :/

@andresmtz98 if it's Android, you'll need to wrap it in a with a defined height, width (and the VictoryPie should be standalone false)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kkemple picture kkemple  路  6Comments

JeremyBradshaw7 picture JeremyBradshaw7  路  4Comments

aszheng picture aszheng  路  5Comments

jzhw0130 picture jzhw0130  路  3Comments

isabel-thx picture isabel-thx  路  5Comments