Nativescript: Android Transparent button CSS broken with 5.4

Created on 20 May 2019  路  3Comments  路  Source: NativeScript/NativeScript

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.4
  • Cross-platform modules: 5.4
  • Android Runtime: 5.4
  • iOS Runtime:
  • Plugin(s):

Describe the bug
Previous NS the following CSS created a transparent button for Android (removing material ripple and shadow)

.btn-transparent {
  background-color: transparent;
  border-color: transparent;
  border-width: 1;
}

To Reproduce
Run that CSS on 5.3 or older project and button is great on Android21+. With NS 5.4 it doesn't work.

Expected behavior
Remove shadow, ripple, material effects.

* Work around *

z-index: 0; /* need this in NS 5.4 */ adding z-index in 5.4 will produce the desired outcome.

question

Most helpful comment

The buttons on Android since 5.4 have default elevation (shadow) of 2, due to the new elevation support. You can remove it with:

.btn-transparent {
    android-elevation: 0;
}

All 3 comments

The buttons on Android since 5.4 have default elevation (shadow) of 2, due to the new elevation support. You can remove it with:

.btn-transparent {
    android-elevation: 0;
}

Good to know thanks @bundyo - probably just need to document this under breaking change some how, I've been given the old CSS styles as the go to solution for years now as have most others I've worked with. Just imagining more users eventually updating and they'll be stumped why their buttons aren't styled same 馃憤 - thanks for the info.

Documentation note added via https://github.com/NativeScript/docs/pull/1676

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guillaume-roy picture guillaume-roy  路  3Comments

minjunlan picture minjunlan  路  3Comments

tsonevn picture tsonevn  路  3Comments

fmmsilva picture fmmsilva  路  3Comments

Pourya8366 picture Pourya8366  路  3Comments