1

We are experiencing a weird issue. The thing is that when you press the button, for some reason the Highlight to the underlayColor is occurring but the Touchable is not firing the onPress handler.

The onPress handler is ran if you continue pressing the button (like in a long press event)

Any ideas? We are still using an old version of RN which is 0.59.9. I would like to add that on iOS the behavior is the expected.

Update (code):

<TouchableHighlight
    activeOpacity={0.5}
    disabled={disabled}
    delayPressIn={0}
    delayLongPress={0}
    onPress={onPress}
    underlayColor={hexWithOpacity(Palette.Primary, 0.05)}
    style={[
      styles.container,
      buttonStyles(disabled)[variant],
      buttonContainerDimmensions()[size],
      style,
    ]}
    {...props}
  >
    <Text
      style={[
        buttonTextStyles(disabled)[variant],
        buttonFontDimmensions()[size],
      ]}
    >
      {title}
    </Text>
  </TouchableHighlight>
halbano
  • 1,135
  • 14
  • 34

1 Answers1

0

onPress={onPress} should be a function like

onPress={() => {console.log('onPress')}}

or

onPress={this.onPress}

where onPress is defined as a function somewhere

zinne
  • 180
  • 8