feat(android): elevation shadow support - #7136
Conversation
|
As requested by @manoldonev (#7055 (comment)) This is a simple way to support elevation + statelistanimator on android For some reason, TODO
|
…into edusperoni-elevation
|
@manoldonev I've switched the properties to the view. Unfortunately, when we unset the properties, they are never unset from the view (they never return to undefined). Is there any way to force them to return to undefined when unset? |
in case it's null, we want to set it anyway
…into edusperoni-elevation
…into edusperoni-elevation
|
About unsetting local values -- seems like this is not implemented at the moment: Will have to think about it a bit. |
|
My naive implementation worked: if (!(key in newPropertyValues)) {
if (key in this.view.style) {
this.view.style[`css:${key}`] = unsetValue;
} else {
// TRICKY: How do we unset local value?
const camelCasedProperty = key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
this.view[camelCasedProperty] = unsetValue;
}
}if the property has been defined as a Edit:I've been experimenting with this and there doesn't seem to be a reliable way to check if the property is actually a |
|
Hey @edusperoni I've been brainstorming a bit on the proposed elevation support implementation and after discussions with the team here I've made a commit with the following propositions:
|
|
test |
|
@manoldonev Sounds good! But won't removing the null/undefined checks actually cause an issue with plugins like |
|
test ios#rc |
|
@edusperoni do you have a specific scenario in mind? If one is not using the new androidElevation / androidDynamicElevationOffset APIs explicitly we are not tampering with the original animators so those plugins should be working as expected. |
|
@manoldonev Would you consider an iOS implementation if I would provide a basic PoC based on the current state of this repo? I could use the |
|
@EddyVerbruggen sure, Eddy -- you can open a separate PR as we are trying to merge this for NativeScript 5.4 release candidate now. As I see it, this whole effort should ultimately provide the solution you described here #550 (comment). We needed the android implementation earlier as it turned out #7055 (comment) introduced a regression for outline buttons. With NativeScript 5.4 we will be releasing a patch for nativescript-theme-core that will explicitly set androidElevation to zero for such buttons thus keeping their old and expected behavior. |
|
test ios#rc |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
What is the current behavior?
No elevation support
What is the new behavior?
Any view can have a shadow
Fixes/Implements/Closes #550.