简体   繁体   中英

React native android TouchableNativeFeedback flashes black on press

When I press and hold TouchableNativeFeedback its background flashes black. I have background prop set to TouchableNativeFeedback.SelectableBackgroundBorderless() on it. Changing it to TouchableNativeFeedback.SelectableBackground() or TouchableNativeFeedback.Ripple('red', false) doesn't change anything. Maybe I miss some configureation? What could cause such an effect? How can I fix it?

I just tried the example on React Native's documentation and it seems to be working normally on my Android emulator (Genymotion). Here's the code:

renderButton: function() {
  return (
    <TouchableNativeFeedback
        onPress={this._onPressButton}
        background={TouchableNativeFeedback.SelectableBackground()}>
      <View style={{width: 150, height: 100, backgroundColor: 'red'}}>
        <Text style={{margin: 30}}>Button</Text>
      </View>
    </TouchableNativeFeedback>
  );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM