question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebView didn't get canGoBack correctly

See original GitHub issue

Have you read the Bugs section of the Contributing to React Native Guide?

(Write your answer here.)

Environment

  1. react-native -v: react-native-cli: 2.0.1 react-native: 0.45.1
  2. node -v: v8.1.2
  3. npm -v: 5.0.3
  4. yarn --version (if you use Yarn): 0.24.6

Then, specify:

  1. Target Platform (e.g. iOS, Android): iOS
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): iOS >8.0 Xcode 8.3.3

Steps to Reproduce

1.add an webView and a button call webView’s goBack 2.view some page and go back 3.check whether the canGoBack is right

Expected Behavior

the canGoBack is false when back to the first page the canGoBack is true when viewing deeper page

Actual Behavior

the canGoBack sometime is false at the page which is not the first loaded page.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
ashconnellcommented, Dec 22, 2017

Just confirming this is a bug.

To Reproduce:

  1. Instantiate a WebView like so
    <WebView
        source={{ uri: 'https://www.google.com' }}
        onNavigationStateChange={ ({ canGoback }) => console.log(canGoBack) }
    />
  1. Click anything (eg the banner image) to navigate to a new page

What Happens: The console logs false as the next page begins to load, and then true after the page has loaded

What should happen: The console logs true as the next page begins to load and true after the page has loaded

4reactions
RLessercommented, Dec 9, 2017

Still happening, this especially hurts because there’s no other way (that I know of) to correctly tell if the current webview can go back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webview goBack() does not work properly - Stack Overflow
canGoBack () returns false, then the app exits. But if it returns true, it calls the webView.goBack() , but that doesn't trigger any...
Read more >
794020 - webview.canGoBack() always returning false even ...
b.com is loaded. Then webview.canGoBack() returns false instead of true. If it is the case, that's a bug. ``` Is it correct?
Read more >
How to use WebView in React Native - Educative.io
To get started, we need to begin a new project with the React Native CLI. You can do this with Expo if you...
Read more >
WebView history not working consistently when Chrome is ...
WebView's history and assoiciated canGoBack() and goBack() methods do not work properly when Google Chrome version 63.0.3239.111 is ...
Read more >
Diving Deep into WebViews | Kodeco, the new raywenderlich ...
How to send and receive data with a webpage opened in WebView . When to use GestureRecognizer . Note: This tutorial assumes that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found