The default clipChildren (clipToBounds) behaviour is different on android and iOS
See original GitHub issuehi, this code shows different result on android and iOS:
export default class TestClip extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.child}/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
width: 100,
height: 100,
backgroundColor: 'red',
},
child: {
position: 'absolute',
width: 100,
height: 100,
top: 50,
left: 50,
backgroundColor: 'green',
},
});
I think this is caused by: on android ViewGroup’s clipChildren is true by default, on iOS UIView’s clipToBounds is NO by default.
Tested adding setClipChildren(true) to the base class ReactViewGroup on android can solve this, but not sure if this can cause performance issue. maybe exporting clipChildren as a property on both platform is better?
- React Native version: 0.37.0
- Platform: iOS & Android
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:17 (4 by maintainers)
Top Results From Across the Web
Do not clip bounds of AndroidView in Compose - Stack Overflow
It's a known feature request, here's a workaround until it's implemented: @Composable fun <T : View> AndroidView( clipToBounds: Boolean, ...
Read more >Clip Behavior - Flutter documentation
The default clipBehavior is Clip.none for most widgets to save performance, except the following: ClipPath defaults to Clip.antiAlias; ClipRRect defaults ...
Read more >Solving View Overflow in Android (ReactNative) - Medium
The link only happens on Android, as iOS has no clip of children behaviour as default. So you enable ViewOverflow just wrapping your...
Read more >https://forums.graalonline.com/forums/attachment.p...
... only) disableactionprojectile - boolean - by default the player ... alpha - float areaclickpriority - integer - for iPhone/Android: 2 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
Please open a new issue and make sure it follows the template.