Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TouchableWithoutFeedback with custom component inside doesn't fires onPress callback

I made a DEMO

so the problem is that third button isn't working. The only difference between buttons is the way I passed them in Header component.

<Header secondButton={<View style={styles.button}><Text>Second Button</Text></View>}
        thirdButton={<ThirdButton />}
        onPress={this._handlePress} />
like image 814
Liubomyr Mykhalchenko Avatar asked May 20 '15 12:05

Liubomyr Mykhalchenko


1 Answers

My solution was to turn this ...

<TouchableWithoutFeedback onPress={props.onPress}>
  <Contents {...props} />
</TouchableWithoutFeedback>

into this...

<TouchableWithoutFeedback onPress={props.onPress}>
  <View>
    <Contents {...props} />
  </View>
</TouchableWithoutFeedback>
like image 57
Kirk Strobeck Avatar answered Sep 23 '22 20:09

Kirk Strobeck