mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
FIX: WebView not showing in gallery app
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<Page>
|
<Page>
|
||||||
<WebView margin="10" url="http://www.telerik.com/nativescript"/>
|
<WebView margin="10" src="http://www.telerik.com/nativescript"/>
|
||||||
</Page>
|
</Page>
|
@ -21,15 +21,9 @@ export abstract class WebViewBase extends View implements WebViewDefinition {
|
|||||||
"other"
|
"other"
|
||||||
];
|
];
|
||||||
|
|
||||||
public _suspendLoading: boolean;
|
|
||||||
|
|
||||||
public src: string;
|
public src: string;
|
||||||
|
|
||||||
public _onLoadFinished(url: string, error?: string) {
|
public _onLoadFinished(url: string, error?: string) {
|
||||||
|
|
||||||
this._suspendLoading = true;
|
|
||||||
this._suspendLoading = false;
|
|
||||||
|
|
||||||
let args = <LoadEventData>{
|
let args = <LoadEventData>{
|
||||||
eventName: WebViewBase.loadFinishedEvent,
|
eventName: WebViewBase.loadFinishedEvent,
|
||||||
object: this,
|
object: this,
|
||||||
@ -53,8 +47,6 @@ export abstract class WebViewBase extends View implements WebViewDefinition {
|
|||||||
this.notify(args);
|
this.notify(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract _loadUrl(url: string): void;
|
|
||||||
|
|
||||||
abstract _loadFileOrResource(path: string, content: string): void;
|
abstract _loadFileOrResource(path: string, content: string): void;
|
||||||
|
|
||||||
abstract _loadHttp(src: string): void;
|
abstract _loadHttp(src: string): void;
|
||||||
@ -81,10 +73,6 @@ export abstract class WebViewBase extends View implements WebViewDefinition {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
set [srcProperty.native](src: string) {
|
set [srcProperty.native](src: string) {
|
||||||
if (this._suspendLoading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.stopLoading();
|
this.stopLoading();
|
||||||
|
|
||||||
if (isFileOrResourcePath(src)) {
|
if (isFileOrResourcePath(src)) {
|
||||||
@ -103,6 +91,13 @@ export abstract class WebViewBase extends View implements WebViewDefinition {
|
|||||||
this._loadData(src);
|
this._loadData(src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get url() : string {
|
||||||
|
throw new Error("Property url of WebView is deprecated. Use src istead");
|
||||||
|
}
|
||||||
|
set url(value:string){
|
||||||
|
throw new Error("Property url of WebView is deprecated. Use src istead")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srcProperty.register(WebViewBase);
|
srcProperty.register(WebViewBase);
|
||||||
|
@ -112,18 +112,6 @@ export class WebView extends WebViewBase {
|
|||||||
super._resetNativeView();
|
super._resetNativeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public _loadUrl(url: string) {
|
|
||||||
if (!this._android) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (traceEnabled()) {
|
|
||||||
traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug);
|
|
||||||
}
|
|
||||||
this._android.stopLoading();
|
|
||||||
this._android.loadUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public _loadFileOrResource(path: string, content: string) {
|
public _loadFileOrResource(path: string, content: string) {
|
||||||
if (!this._android) {
|
if (!this._android) {
|
||||||
return;
|
return;
|
||||||
|
@ -109,17 +109,6 @@ export class WebView extends WebViewBase {
|
|||||||
this._ios.stopLoading();
|
this._ios.stopLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
public _loadUrl(url: string) {
|
|
||||||
if (traceEnabled()) {
|
|
||||||
traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._ios.loading) {
|
|
||||||
this._ios.stopLoading();
|
|
||||||
}
|
|
||||||
this._ios.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(url)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public _loadFileOrResource(path: string, content: string) {
|
public _loadFileOrResource(path: string, content: string) {
|
||||||
var baseURL = NSURL.fileURLWithPath(NSString.stringWithString(path).stringByDeletingLastPathComponent);
|
var baseURL = NSURL.fileURLWithPath(NSString.stringWithString(path).stringByDeletingLastPathComponent);
|
||||||
this._ios.loadHTMLStringBaseURL(content, baseURL);
|
this._ios.loadHTMLStringBaseURL(content, baseURL);
|
||||||
|
Reference in New Issue
Block a user