Skip to content

[Android] Fix buttons cutting of borders of their child views#4189

Open
j-piasecki wants to merge 3 commits into
mainfrom
@jpiasecki/fix-buttons-cutting-off-border
Open

[Android] Fix buttons cutting of borders of their child views#4189
j-piasecki wants to merge 3 commits into
mainfrom
@jpiasecki/fix-buttons-cutting-off-border

Conversation

@j-piasecki
Copy link
Copy Markdown
Member

Description

Sets hasOverlappingRendering to false on the button component to prevent it from rendering on an off-screen canvas when opacity is less than 1.

React Native views also set it to false by default.

Test plan

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Touchable } from 'react-native-gesture-handler';

export default function EmptyExample() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Touchable activeOpacity={0.99} animationDuration={{ in: 0, out: 200 }}>
        <Text style={styles.box}>Button</Text>
      </Touchable>
    </View>
  );
}

const styles = StyleSheet.create({
  box: {
    fontSize: 16,
    fontWeight: 600,
    letterSpacing: -0.5,
    textAlign: 'center',
    textAlignVertical: 'center',
    color: 'black',
    borderWidth: 1,
    borderColor: 'black',
  },
});
Before After
Screen.Recording.2026-05-22.at.10.11.48.mov
Screen.Recording.2026-05-22.at.10.13.05.mov

Copilot AI review requested due to automatic review settings May 22, 2026 08:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Android implementation of RNGestureHandlerButton to avoid offscreen buffering when the button’s opacity is animated below 1, addressing a visual issue where child view borders get clipped at the edges.

Changes:

  • Override hasOverlappingRendering() in the Android button ViewGroup to return false.
  • Add an explanatory comment describing why offscreen buffering is being skipped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@j-piasecki j-piasecki marked this pull request as ready for review May 22, 2026 09:21
Copy link
Copy Markdown
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue

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