Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix overflow hidden with transform rotate on a View with borderRadius #28881

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions RNTester/js/examples/Transform/TransformExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,41 @@ const styles = StyleSheet.create({
height: 500,
},
box1: {
left: 0,
backgroundColor: 'green',
height: 50,
position: 'absolute',
top: 0,
justifyContent: 'center',
alignItems: 'center',
marginBottom: 60,
width: 200,
height: 200,
backgroundColor: 'grey',
transform: [
{translateX: 100},
{translateY: 50},
{rotate: '30deg'},
{scaleX: 2},
{scaleY: 2},
{scaleX: 1.2},
{scaleY: 1.2},
],
width: 50,
borderRadius: 10,
borderWidth: 5,
},
box1container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
margin: 10,
padding: 10,
borderWidth: 2,
borderColor: 'red',
backgroundColor: 'white',
height: 100,
borderRadius: 10,
overflow: 'hidden',
},
box1child: {
width: 40,
height: 440,
borderWidth: 4,
borderColor: 'green',
backgroundColor: 'yellow',
},
box2: {
left: 0,
Expand Down Expand Up @@ -247,13 +269,18 @@ exports.examples = [
},
},
{
title: 'Translate, Rotate, Scale',
title: 'Translate, Rotate, Scale. Children is set to overflow hidden.',
description:
"translateX: 100, translateY: 50, rotate: '30deg', scaleX: 2, scaleY: 2",
"overflow: hidden, translateX: 100, translateY: 50, rotate: '30deg', scaleX: 1.2, scaleY: 1.2",
render(): Node {
return (
<View style={styles.container}>
<View style={styles.box1} />
<View style={styles.box1}>
<View style={styles.box1container}>
<Text>ROUD</Text>
<View style={styles.box1child} />
</View>
</View>
</View>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,12 @@ private void dispatchOverflowDraw(Canvas canvas) {
Math.max(bottomLeftBorderRadius - borderWidth.bottom, 0),
},
Path.Direction.CW);
// for sdk 24-28 fix issue with clipPath and LAYER_TYPE_NONE
fabOnReact marked this conversation as resolved.
Show resolved Hide resolved
// https://github.com/facebook/react-native/issues/18266
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
fabOnReact marked this conversation as resolved.
Show resolved Hide resolved
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
canvas.clipPath(mPath);
hasClipPath = true;
}
Expand Down