You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS UIButton backgroundColor does not respond to color changes #9523
I have found that after a Button is created on iOS, it is not possible to change the backgroundColor of it. It doesn't change if you change the CSS class nor does accessing the background color like btn.backgroundColor = new Color('blue') The below only works on Android, where as on iOS the button background color does not change after it is first set:
constbtn1=newButton();constbtn2=newButton();lettoggle=true;// Background color doesn't change after it's createdbtn1.on("tap",(_args)=>{if(toggle){btn1.color=newColor("red");btn1.backgroundColor=newColor("blue");toggle=false;}else{btn2.color=newColor("yellow");btn2.backgroundColor=newColor("black");toggle=true;}});stackLayout.addChild(btn1);stackLayout.addChild(btn1);}
I have had tons of issues on iOS when changing between dark and light themes while the app is running especially with buttons not responding to color changes and I think this might be the culprit. It appears that the backgroundColor property is not implemented on the iOS Button view.
I have made a PR to fix this in @nativescript/core.
@rob4226 thank you, possible to post a PR of the change? Looks like just a reference to a fork at moment. If post as a PR we can merge out to the next tag and it will be included in the 8.1 release soon.
@NathanWalker Yes, I was just running some more tests on it, but it looks good. It's PR #9524.
Also, I created a new branch using @nativescript/core@7.3.0 and made the necessary changes to fix v7 (new branch in fork based on 7.3.0). I have a couple projects still stuck on 7 so would it be possible to also release a v7.3.1 with this fix? If you already have a branch for v7 fixes please let me know and I will base the commit on that instead of a new branch. I couldn't find a tag for v7.3.0 but I went through the changelog and commits and found it to be 7847c2f Thanks.
Activity
NathanWalker commentedon Aug 24, 2021
@rob4226 thank you, possible to post a PR of the change? Looks like just a reference to a fork at moment. If post as a PR we can merge out to the next tag and it will be included in the 8.1 release soon.
rob4226 commentedon Aug 24, 2021
@NathanWalker Yes, I was just running some more tests on it, but it looks good. It's PR #9524.
Also, I created a new branch using @nativescript/core@7.3.0 and made the necessary changes to fix v7 (new branch in fork based on 7.3.0). I have a couple projects still stuck on 7 so would it be possible to also release a v7.3.1 with this fix? If you already have a branch for v7 fixes please let me know and I will base the commit on that instead of a new branch. I couldn't find a tag for v7.3.0 but I went through the changelog and commits and found it to be 7847c2f Thanks.
NathanWalker commentedon Aug 24, 2021
Sure thing we could do that, much appreciated 🤗
fix(ios): backgroundColor property on Button (#9524)