mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fix: background properties not respected with remote background image
This commit is contained in:
@ -128,7 +128,7 @@ import actionBarModule = require("ui/action-bar");
|
|||||||
// ...
|
// ...
|
||||||
// </Page>
|
// </Page>
|
||||||
//```
|
//```
|
||||||
//Setting `text` for the navigation button is not supproted in Android. You can use `icon` or `android.systemIcon` to set the image in Android.
|
//Setting `text` for the navigation button is not supported in Android. You can use `icon` or `android.systemIcon` to set the image in Android.
|
||||||
//Setting `ios.systemIcon` for the navigation button is not supported in iOS.
|
//Setting `ios.systemIcon` for the navigation button is not supported in iOS.
|
||||||
//
|
//
|
||||||
// </snippet>
|
// </snippet>
|
||||||
|
@ -512,7 +512,7 @@ var NativeActivity = {
|
|||||||
// We take care of associating them with a Page from our backstack in the onAttachFragment callback.
|
// We take care of associating them with a Page from our backstack in the onAttachFragment callback.
|
||||||
// If there is savedInstanceState and activityInitialized is false we are restarted but process was killed.
|
// If there is savedInstanceState and activityInitialized is false we are restarted but process was killed.
|
||||||
// For now we treat it like first run (e.g. we are not passing savedInstanceState so no fragments are being restored).
|
// For now we treat it like first run (e.g. we are not passing savedInstanceState so no fragments are being restored).
|
||||||
// When we add support for applicatioin save/load state - revise this logic.
|
// When we add support for application save/load state - revise this logic.
|
||||||
var isRestart = !!savedInstanceState && activityInitialized;
|
var isRestart = !!savedInstanceState && activityInitialized;
|
||||||
this.super.onCreate(isRestart ? savedInstanceState : null);
|
this.super.onCreate(isRestart ? savedInstanceState : null);
|
||||||
|
|
||||||
|
@ -304,6 +304,8 @@ function onBackgroundImagePropertyChanged(data: PropertyChangeData) {
|
|||||||
style._setValue(backgroundInternalProperty, currentBackground.withImage(undefined));
|
style._setValue(backgroundInternalProperty, currentBackground.withImage(undefined));
|
||||||
imageSource.fromUrl(url).then((r) => {
|
imageSource.fromUrl(url).then((r) => {
|
||||||
if (style && style["_url"] === url) {
|
if (style && style["_url"] === url) {
|
||||||
|
// Get the current background again, as it might have changed while doing the request.
|
||||||
|
currentBackground = <background.Background>style._getValue(backgroundInternalProperty);
|
||||||
style._setValue(backgroundInternalProperty, currentBackground.withImage(r));
|
style._setValue(backgroundInternalProperty, currentBackground.withImage(r));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user