Skip to content

Commit dd6ad58

Browse files
committed
fix(android): elevation on pre lollipop was in dp
1 parent 08f96c4 commit dd6ad58

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/core/core.android.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,25 +169,27 @@ class ViewWithElevationAndRipple extends View {
169169
return result;
170170
}
171171

172-
[elevationProperty.getDefault](): number {
173-
return this.getDefaultElevation();
174-
}
172+
// [elevationProperty.getDefault](): number {
173+
// return this.getDefaultElevation();
174+
// }
175175
[elevationProperty.setNative](value: number) {
176176
if (isPostLollipop()) {
177177
createStateListAnimator(this, this.nativeViewProtected);
178178
} else {
179-
this.nativeViewProtected.setElevation(value);
179+
const newValue = Length.toDevicePixels(typeof value === 'string' ? Length.parse(value) : value, 0);
180+
this.nativeViewProtected.setElevation(newValue);
180181
}
181182
}
182-
[dynamicElevationOffsetProperty.getDefault](): number {
183-
return this.getDefaultDynamicElevationOffset();
184-
}
183+
// [dynamicElevationOffsetProperty.getDefault](): number {
184+
// return this.getDefaultDynamicElevationOffset();
185+
// }
185186
[dynamicElevationOffsetProperty.setNative](value: number) {
186187
this.nativeViewProtected.setClickable(this.isUserInteractionEnabled);
187188
if (isPostLollipop()) {
188189
createStateListAnimator(this, this.nativeViewProtected);
189190
} else {
190-
this.nativeViewProtected.setTranslationZ(value);
191+
const newValue = Length.toDevicePixels(typeof value === 'string' ? Length.parse(value) : value, 0);
192+
this.nativeViewProtected.setTranslationZ(newValue);
191193
}
192194
}
193195
[androidElevationProperty.setNative](value: number) {

0 commit comments

Comments
 (0)