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 all 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
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ public void setBorderColor(int position, float rgb, float alpha) {
public void setBorderRadius(float borderRadius) {
ReactViewBackgroundDrawable backgroundDrawable = getOrCreateReactViewBackground();
backgroundDrawable.setRadius(borderRadius);
// for sdk 24-28 fix issue with clipPath and LAYER_TYPE_NONE
// https://github.com/facebook/react-native/issues/18266
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
}

public void setBorderRadius(float borderRadius, int position) {
Expand Down
49 changes: 38 additions & 11 deletions packages/rn-tester/js/examples/Transform/TransformExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,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