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

<Rect>, <Ellipse> are not rendered if opacity set to 0 on Android #1200

Closed
oleksandr-dziuban opened this issue Nov 21, 2019 · 5 comments
Closed

Comments

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Nov 21, 2019

Bug

Rect, Ellipse and possibly other SVG elements are not rendered if opacity set to 0 on Android.
iOS works fine.
We can detect if element was rendered with onPress handler.
What is interesting, with opacity=0.01 element still doesn't render on Android.
With 0.02 and higher - it is visible and clickable.

Environment info

React native info output:

 System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 424.34 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.4.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.12.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 27.0.3, 28.0.3
      System Images: android-24 | Google Play Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: 2.9.0 => 2.9.0 
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.4 => 0.61.4 

Library version: 9.13.3

Steps To Reproduce

  1. Render Rect or Ellipse with or opacity=0, opacity=0.01
  2. Android app doesn't render element and it's not clickable.

Describe what you expected to happen:

  1. Android app should render SVG element with opacity=0 and it should be clickable like on iOS.

Reproducible sample code

<Svg width={100} height={100} viewBox="0 0 100 100">
  <G>
      <Rect
        x={0}
        y={0}
        width={50}
        height={50}
        opacity={0}
        fill={"red"}
        stroke={"green"}
        onPress={() => { console.log('Press event'); }}
      />
  </G>
<Svg>
@balovbohdan
Copy link

Faced the same problem!

@oleksandr-dziuban
Copy link
Author

@msand Could you please check this issue for Android, I think it will be quick fix. Thanks a lot

@msand msand closed this as completed in ebc7220 Jan 4, 2020
msand pushed a commit that referenced this issue Jan 4, 2020
# [9.14.0](v9.13.6...v9.14.0) (2020-01-04)

### Bug Fixes

* **android:** correct values for measureInWindow, fixes [#1231](#1231) ([3bf07f8](3bf07f8))
* **android:** elements not touchable if below opacity limit ([ebc7220](ebc7220)), closes [#1200](#1200)
* **android:** fix radial gradient vertical center offset scaling ([d5bddd5](d5bddd5))
* **ios:** crash when offset is outside range [#1201](#1201) ([a2ef51f](a2ef51f))
* **web:** fix gesture responder dimensions measurement ([36c20b3](36c20b3))
* extraction of clip rule, fixes [#1233](#1233) ([f93bdde](f93bdde))
* Text color doesn't work with inlineSize [#1225](#1225) ([027b8c1](027b8c1))

### Features

* **android:** support using other native views in e.g. masks ([15b4ac6](15b4ac6))
* **ios:** support using other native views in e.g. masks ([518a3b1](518a3b1))
* **web:** Implement support for event, touch & responder handlers ([60561ec](60561ec))
* **web:** Optimize: only set responders if press handler exists ([23250ad](23250ad))
* Implement display="none" ([3e3ad13](3e3ad13)), closes [#1220](#1220)
@msand
Copy link
Collaborator

msand commented Jan 4, 2020

🎉 This issue has been resolved in version 9.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@msand msand added the released label Jan 4, 2020
@oleksandr-dziuban
Copy link
Author

Thanks a lot

@msand
Copy link
Collaborator

msand commented Jan 4, 2020

Released in v10 (breaking change wasn't registered correctly by semantic-release and forgot to do dry-run first)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants