Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Preload only when html in WebView completes rendering #244

Open
NicksonYap opened this issue Sep 11, 2018 · 0 comments
Open

Close Preload only when html in WebView completes rendering #244

NicksonYap opened this issue Sep 11, 2018 · 0 comments

Comments

@NicksonYap
Copy link

Hi,
I'm trying to make the WebView transition feel more native compared to a webbrowser

What I was thinking is to show a loading page while the WebView is still rendering

I've tried Preload and it seems to close once the .json has been loaded
this causes the Preload page to only show in a split second (flashes real quick)

But what about a loading page when the html in the WebView is still loading?

Code that I've tried:

{
  "$jason": {
    "head": {
      "title": "Web Container Native Transition",
      "actions": {
        "$load": {
          "type": "$set",
          "options": {
            "url": [{
              "{{#if $params && 'url' in $params}}": "{{$params.url}}"
            }, {
              "{{#else}}": "https://www.google.com"
            }]
          },
          "success": {
            "type": "$render"
          }
        },
        "navigate": {
          "type": "$href",
          "options": {
            "url": "file://native_transition.json",
            "options": {
              "url": "{{$jason.url}}"
            },
            "preload": {
              "style": {
                "background": "{{'#' + Math.round((0x1000000 + 0xffffff * Math.random())).toString(16).slice(1)}}"
              },
              "layers": [
                {
                  "type": "label",
                  "text": "Loading...",
                  "style": {
                    "top": "300",
                    "left": "0",
                    "width": "100%",
                    "height": "100",
                    "align": "center",
                    "color": "#ffffff",
                    "size": "12"
                  }
                }
              ]
            }
          }
        }
      },
      "templates": {
        "body": {
          "background": {
            "type": "html",
            "url": "{{$get.url}}",
            "action": {
              "trigger": "navigate"
            }
          }
        }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant