Skip to content

Conversation

@j-piasecki
Copy link
Member

@j-piasecki j-piasecki commented Feb 15, 2022

Description

In cases where TouchableOpacity and TouchableNativeFeedback were used together, but TouchableOpacity was placed first, the color of ripple animation would also be set to transparent for TouchableNativeFeedback. This PR changes the behavior of GestureHandlerButton so that it will set the color of ripple animation to android.R.attr.colorControlHighlight when no color is set by the user.

Test plan

Tested on this code:

import {
    GestureHandlerRootView,
    TouchableNativeFeedback,
    TouchableOpacity,
  } from 'react-native-gesture-handler';
  import {LogBox, StyleSheet, Text, View} from 'react-native';
  
  import React from 'react';
  
  
  LogBox.ignoreLogs([
    "Seems like you're using an old API with gesture components",
  ]);
  
  export default function App() {
    return (
      <GestureHandlerRootView style={styles.container}>
        <Text>TouchableOpacity</Text>
        <TouchableOpacity>
          <View style={styles.box1} />
        </TouchableOpacity>
        
        <Text>TouchableNativeFeedback</Text>
        <TouchableNativeFeedback>
          <View style={styles.box2} />
        </TouchableNativeFeedback>
      </GestureHandlerRootView>
    );
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      alignItems: 'center',
      justifyContent: 'center',
    },
    box1: {
      width: 50,
      height: 50,
      backgroundColor: 'cyan',
    },
    box2: {
      width: 50,
      height: 50,
      backgroundColor: 'magenta',
    },
  });

@j-piasecki j-piasecki merged commit 807260a into main Mar 2, 2022
@j-piasecki j-piasecki deleted the @jpiasecki/fix-ripple branch March 2, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants