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

Can't navigate in React Native Webview if using local html file #27381

Closed
ZeeshanAhmadKhalil opened this issue Dec 2, 2019 · 1 comment
Closed
Labels
Bug Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.

Comments

@ZeeshanAhmadKhalil
Copy link

ZeeshanAhmadKhalil commented Dec 2, 2019

I followed this answer to open my index.html file inside webview. It successfully opens and js is working as well.

But now the problem for me is that whenever I click on a link inside this index.html file to go to another html file for example <a href="./html/create_login.html">Go to main app</a> then it is trying to open that html file in PDF instead of opening it in webview.

My file structure inside the assets folder is;

image

React Native version:

  • "react": "16.9.0",
  • "react-native": "0.61.5",
  • "react-native-webview": "^7.5.2"
  • Android 6.0 (physical device)

System:
OS: Windows 10 10.0.18362
CPU: (4) x64 Intel(R) Core(TM) M-5Y10c CPU @ 0.80GHz
Memory: 733.90 MB / 3.92 GB
Binaries:
Node: 12.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5977832
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. Put html, CSS and js files in the assets folder inside android\app\src\main
  2. Install and import {WebView} inside App.js
  3. Use <WebView source={{uri: 'file:///android_asset/index.html'}} />
  4. Whenever you click on a link like inside index.html file it will try to open Html file referred inside the link in PDF instead of webview

Reference:
#16133 (comment)

@react-native-bot react-native-bot added the Component: WebView Related to the WebView component. label Dec 2, 2019
@dulmandakh
Copy link
Contributor

Please file an issue to react-native-webview. Thank you

@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: WebView Related to the WebView component. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants