navigator add openUrl

This commit is contained in:
pengfei.zhou
2020-04-01 15:19:37 +08:00
committed by osborn
parent 9c520e1dc5
commit 78d4f51314
12 changed files with 78 additions and 13 deletions

View File

@@ -16,6 +16,7 @@
import { BridgeContext } from "../runtime/global"
export function navigator(context: BridgeContext) {
const moduleName = "navigator"
return {
push: (source: string, config?: {
alias?: string,
@@ -25,12 +26,15 @@ export function navigator(context: BridgeContext) {
if (config && config.extra) {
(config as any).extra = JSON.stringify(config.extra)
}
return context.callNative('navigator', 'push', {
return context.callNative(moduleName, 'push', {
source, config
})
},
pop: (animated = true) => {
return context.callNative('navigator', 'pop', { animated })
return context.callNative(moduleName, 'pop', { animated })
},
openUrl: (url: string) => {
return context.callNative(moduleName, "openUrl", url)
},
}
}