Skip to content

NS8 CSS box-shadow does not support "none" #9414

@jcassidyav

Description

@jcassidyav

√ Component nativescript has 8.0.2 version and is up to date.
√ Component @nativescript/core has 8.0.6 version and is up to date.
√ Component @nativescript/android has 8.0.0 version and is up to date.

Describe the bug

The CSS property box-shadow should support the value none which acts to remove the shadow.

e.g.

.add-shadow {

  box-shadow: 5 5 20px rgba(0, 0, 0, 0.8);
}

Button:highlighted {
  color: red;
  box-shadow: none;
}

currently clicking the button with the above CSS will result in the error:

JS: Error: Failed to apply property [box-shadow] with value [none] to Button(6)@main-page.xml:27:9;. Error: Invalid color: none
JS:     at new Color (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\color\color-common.js:31:0)
JS:     at new Color (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\color\index.android.js:2:7)
JS:     at parseCSSShadow (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\styling\css-shadow.js:53:0)
JS:     at valueConverter (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\styling\style-properties.js:1123:29)
JS:     at Style.setCssValue [as css:box-shadow] (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\core\properties\index.js:574:0)
JS:     at CssState.setPropertyValues (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\styling\style-scope.js:531:47)
JS:     at file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\styling\style-scope.js:419:0
JS:     at Button._batchUpdate (file: app\webpack:\@nativescript\template-hello-world-ts\node_modules\@nativescript\core\ui\core\view-base\index.js:286:0)
JS:     at CssState.updateDynamicState (file:///data/data/org.nativescript.shadownone/files/app/vendor...

To Reproduce
Add the above css to a button and when you press it you will see the error.

Expected behavior
The shadow should be removed when box-shadow: none is applied.

Sample project
shadow-none.zip

Additional context
Adding

	if(first==='none'){
		return null;
	}

to parseCSSShadow in packages\core\ui\styling\css-shadow.ts

appears to resolve the issue ( only tested in android ).

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions