[TIMOB-27237] Android: Animating a Label or Button with borderRadius bugs the backgroundColor animation.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-04T10:35:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.3.0 |
Components | Android |
Labels | animation, borderRadius, button, engSchedule, label, titanium |
Reporter | remo.loaiza |
Assignee | Yordan Banev |
Created | 2019-07-04T01:42:12.000+0000 |
Updated | 2019-10-04T10:35:46.000+0000 |
Description
Adding the property borderRadius to a label or a button and animating the backgroundColor makes it always go from white to the animated color instead of animating from the view background color to the new color.
Test case:
var win = Ti.UI.createWindow({
layout : 'vertical',
width : Ti.UI.FILL,
height : Ti.UI.FILL
});
var label = Ti.UI.createLabel({
width :Ti.UI.SIZE,
font : {
fontSize : 14
},
text : 'Should go from blue to black',
textAlign : 'center',
color : 'white',
backgroundColor : 'blue',
borderRadius : 20
});
label.addEventListener('click',function() {
label.animate({
backgroundColor : '#000',
duration : 10000
});
});
win.add(label);
win.open();
The expected behavior is for the background to go from {color:blue}blue{color} to {color:black}black{color} but instead it goes from white to black. If you remove the borderRadius then it works as expected.
A workaround is to wrap the label/button in a view.
Attachments
File | Date | Size |
---|---|---|
1562230320886.JPEG | 2019-07-04T08:56:36.000+0000 | 12036 |
1562230320932.JPEG | 2019-07-04T08:55:58.000+0000 | 12490 |
1562408449852.JPEG | 2019-07-06T10:22:39.000+0000 | 17968 |
1562408449904.JPEG | 2019-07-06T10:22:39.000+0000 | 17502 |
ui_bug_brorderradius.gif | 2019-07-04T17:45:12.000+0000 | 874772 |
Hello [~remo.loaiza], Thanks for reporting this. Are you using SDK 7.5.1 for testing? It would be great if you can test on SDK 8.0.2.GA and let us know the result. To install SDK 8.0.2.GA please open terminal and type: *appc ti sdk install 8.0.2.GA*
Hi Rakhi, I just tested in 8.0.2 GA and it's still there.
[~remo.loaiza], We tested this on 8.0.2 GA(Android device Huawei y9 2018) and unable to reproduce this as a bug. This is working as expected. Check the outputs: *Before click:* !1562230320932.JPEG|thumbnail! *After click:* !1562230320886.JPEG|thumbnail! The expected behaviour is for the background to go from blue to black.
Im sorry, I think I may not have explained the problem as I should. If you add a border radius the animation goes to white first then it goes to black. This is not expected, it should go from blue to black. Here's a GIF of the bug and new test code: !ui_bug_brorderradius.gif!
Hello [~remo.loaiza], Thanks for your update. I just tested the issue using ti sdk 8.0.2 GA on physical android device Huawei y9 2018. The issue does not reproduce on our end. The animation goes directly from blue to black, it doesn't go to white first. Please find the screenshots. !1562408449852.JPEG|thumbnail! !1562408449904.JPEG|thumbnail! Can you share your device / emulator details please?
Ive tried and reproduced this on a HUAWEI P30 Android 9 device, Android 6 emulator, and on a Sony D6603 running Android 6. On all Ive tried both SDKs 7.5.1 and 8.0.2. I started a new project with 8.0.2 to test if it was not another setting i've put in and I can reproduce this still. However, by default a new project uses the dark theme so instead of starting from white it starts from black. Which leads me to think this is somehow related to Android themes.
Hello [~remo.loaiza], The issue occurs with the white window background. I was able to reproduce the issue using a white background. The issue is when using a border radius to the label. Clicking on it will first remove the background color(blue) and then the black background color starts to animate(from white to black). This is more visible in a white background. The expected behavior is shown in the second label. Where the animation turns the background color to black in 10s. Tested with SDK 8.0.2.GA in Android 9.0.1 device (Nokia 6). The issue is with both label and button. Working as expected in iOS. Moving to engineering. Thanks.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11053
FR Passed. Waiting for 8.1.0 GA release to merge PR.
PR (8_3_X): https://github.com/appcelerator/titanium_mobile/pull/11158
FR passed.Unit tests are failing .not able to merge PR
PR merged on master.
*Verified fix* Test environment: Studio Ver: 5.1.4.201909061933 SDK Ver: 8.3.0.v20191003144543 Mac OS Ver: 10.14.6 Ti CLI Ver: 5.2.1 Node Ver: 10.16.3 NPM Ver: 6.11.3 Emulator: ⇨ Android 10 (Pixel 3 XL) Closing ticket.