question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The default clipChildren (clipToBounds) behaviour is different on android and iOS

See original GitHub issue

hi, 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',
  },
});

wechatimg2

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:closed
  • Created 7 years ago
  • Reactions:16
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
hramoscommented, Jul 21, 2017

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

12reactions
hramoscommented, Oct 27, 2017

Please open a new issue and make sure it follows the template.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found