-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Add the following example to RNTester's TransformExample:
{
title: 'Translate with corner radius',
description: 'Translate with corner radius',
render(): Node {
return (
<View style={styles.container}>
<View
style={{
backgroundColor: 'blue',
borderRadius: 4,
width: 100,
height: 100,
alignItems: 'center',
justifyContent: 'center',
transform: [{translateX: 50}],
}}>
<View
style={{
backgroundColor: 'cyan',
width: 50,
height: 50,
alignItems: 'center',
justifyContent: 'center',
}}>
<Text style={{color: 'white'}}>X</Text>
</View>
</View>
</View>
);
},
},Expected Results
I expect the transform behavior to match what occurs when I do not set the borderRadius, which does not apply the transform to children twice.
Snack, code example, screenshot, or link to a repository:
See example code above, which can be easily injected into any playground app or RNTester.
Here is what a transform with child views looks like without a borderRadius:

Here is what the transform looks like when a borderRadius is applied to the same view that also has a transform:

Another interesting issue, possibly unrelated, is that setting borderRadius seems to also implement overflow: hidden behavior. I suspect the borderRadius implementation just creates a custom clipping geometry.
Please note, this applies to any type of transform, so if I set scaleX to 2, I expect the outer and inner views to maintain the same width ratio, however the inner view doubles the scale and ends up matching the width of the outer view:
