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

Working ok with embedded JS but not with separate JS #109

Open
mako34 opened this issue Nov 20, 2021 · 0 comments
Open

Working ok with embedded JS but not with separate JS #109

mako34 opened this issue Nov 20, 2021 · 0 comments

Comments

@mako34
Copy link

mako34 commented Nov 20, 2021

I have a test app with react-native-static-server rendering a local HTML file

for using JS, it works if I have the JS embedded in the HTML, but if I call it on a separate JS file it won't work...

in my App.tsx:

<WebView source={{uri:${origin}/${file}}} style={styles.webview} />
here is the embedded HTML:

<button type="button" onclick="alabama();">Play</button>
<button type="button" onclick="alert('Hello alabama')">music</button>
<script src="./chusa.js"></script>

chusa.js:

function alabama() {
  alert('Hello alabama');
}

So, alert works, the function doesn't.

How can I call the script on a separate file?

Thanks in advance

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