Skip to content

[Android] Fix Touchable children clipping - #4190

Merged
j-piasecki merged 1 commit into
mainfrom
@jpiasecki/fix-buttons-children-clipping
May 22, 2026
Merged

[Android] Fix Touchable children clipping#4190
j-piasecki merged 1 commit into
mainfrom
@jpiasecki/fix-buttons-children-clipping

Conversation

@j-piasecki

Copy link
Copy Markdown
Member

Description

Native Android button implementation wasn't clipping its children to its actual shape but to the rectangular bounding box. This PR fixes that, aligning behavior with iOS.

Test plan

import React from 'react';
import { 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={1}
        animationDuration={{ in: 200, out: 200 }}
        underlayColor={'black'}
        style={{
          width: 100,
          height: 100,
          borderRadius: 50,
          backgroundColor: 'red',
          overflow: 'hidden',
        }}>
        <View style={{ flex: 1, backgroundColor: 'green', opacity: 0.5 }} />
      </Touchable>
    </View>
  );
}
Android before Android after iOS
Screenshot 2026-05-22 at 13 53 47 Screenshot 2026-05-22 at 13 53 15 Simulator Screenshot - iPhone 17 Pro - 2026-05-22 at 13 52 57

Copilot AI review requested due to automatic review settings May 22, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes Android Touchable rendering so overflow: hidden clips children to the actual resolved border-radius shape (instead of the view’s rectangular bounds), aligning behavior with iOS.

Changes:

  • Replace clipChildren/clipToPadding toggling with a dedicated clipChildrenToShape flag driven by overflow.
  • Apply shape-based clipping in dispatchDraw via BackgroundStyleApplicator.clipToPaddingBox(...) when overflow: hidden.

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

@j-piasecki
j-piasecki merged commit 3a1bfc6 into main May 22, 2026
4 checks passed
@j-piasecki
j-piasecki deleted the @jpiasecki/fix-buttons-children-clipping branch May 22, 2026 12:06
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