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.

overflow: 'hidden' has wrong affect on scaleX and scaleY on Android 7.0 (API 24)

See original GitHub issue

React Native version: 0.61.5

Steps To Reproduce

I have created a simple expo to reproduce the problem but please note that the problem does not show up on Expo’s emulator.

I have tested it on a few Android emulators with different API levels and some real devices and still no bug and currently, I’m not to test it on the IOS platform.

  1. android emulator: API 19
  2. android emulator: API 22
  3. android emulator: API 23
  4. android emulator: API 28
  5. android device: LG K4, android version 5.1.1
  6. android device: Samsung Galaxy J2, android version 5.1.1
  7. android device: Huawei CUN-L21, android version 5.1

I just could reproduce the bug on My LG Stylus 2 with android 7.0 so it’s too hard to reproduce it, but it’s a bug I think, a rare one. you can reproduce it on an Android emulator API 24 (android 7.0)

here are some results of playing with overflow, scaleX, and scaleY styles

overflow scaleX scaleY result
visible 1 1 Screenshot_2019-12-11-15-12-04
visible 1.5 1.5 Screenshot_2019-12-11-15-13-51
hidden 1 1 Screenshot_2019-12-11-15-15-13
hidden 1.5 1 Screenshot_2019-12-11-15-16-16
hidden 1 1.5 Screenshot_2019-12-11-15-17-08
hidden 1.5 1.5 Screenshot_2019-12-11-15-17-53
GIF-191211_174634

Describe what you expected to happen: I expect that the View renders correctly in given scaleX or scaleY no matter what value of overflow is.

Snack, code example, screenshot, or link to a repository:

Snack example but please try to run the example on a real device especially if you have LG Stylus 2 or an Android emulator running API 24.

The only workaround I found is to remove overflow: 'hidden' style and modify my inner views styles to respect their parent’s current style which is not good for maintenance.

update

in the case of the above snack example accidentally removed. I just copied the snack code here without any change.

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <View style={styles.indicatorContainer}>
          <View style={styles.indicator} />
        </View>
        <View style={styles.textContainer}>
          <Text>some text</Text>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    width: 120,
    height: 70,
    borderRadius: 5,
    borderWidth: 1.5,
    overflow: 'hidden',
    position: 'absolute',
    top: 200,
    left: 120,
    backgroundColor: '#FFFFFF',
    borderColor: '#ff7171',
    // play with scaleX and scaleY to see the bug
    scaleY: 1.5,
    scaleX: 1.5,
  },
  indicatorContainer: {
    flex: 0.65,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FDFFDB',
  },
  indicator: {
    width: 20,
    height: 20,
    borderRadius: 5,
    borderColor: '#000',
    borderWidth: 2,
  },
  textContainer: {
    flexDirection: 'row',
    flex: 0.35,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chrisbobbecommented, Sep 5, 2020

(I think the Flow label was misapplied by the bot; this has nothing to do with Flow type-checking; I have no other comment on the issue, unfortunately.)

1reaction
safaiyehcommented, Sep 6, 2020

Hi @SaeedZhiany apologies you are having issues. Thank you for the detailed issue and Snack! Adding the correct tags

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug with transform: scale and overflow: hidden in Chrome
Working with CSS3 property transform: scale , I found interesting issue. I wanted to make a little zoom effect for pictures. But when...
Read more >
SurfaceView | Android Developers
This can be used to place overlays such as buttons on top of the Surface, though note however that it can have an...
Read more >
First Class Android with React Native | by Luke Brandon Farrell
The iOS simulator is so smooth and responsive… at times, having a favourite platform can impact the quality of your work as a...
Read more >
Diff - bf234fd^! - platform/build - Git at Google
</a> + href="http://dl.google.com/android/ndk/<?cs var:ndk.win32_download ?> ... page line-height is bumped to 24px */ + } #api-nav-title { padding:0 5px; ...
Read more >
Getting Started with GSAP - Learning Center - GreenSock
This tween is saying "hey GSAP, animate the element with a class of '.box' to an x of 200px (like transform: translateX(200px) )"....
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