-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
JavaScript not work in webview #8996
Comments
iOS / Android? |
me too! |
Just tried on the fresh project:
![image](https://cloud.githubusercontent.com/assets/2273613/17095219/aa43067e-5253-11e6-9ff6-cb2455686765.png)
Corresponding code: /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
WebView,
View
} from 'react-native';
class example extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<WebView
automaticallyAdjustContentInsets={false}
style={{height: 350, width: 300}}
source={require('./test.html')}
javaScriptEnabled={true}
domStorageEnabled={true}
decelerationRate="normal"
startInLoadingState={true}
scalesPageToFit={true}
/>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('example', () => example); |
I think you have a problem with styling. Try fixed dimensions and/or adjust your layout. Let me know if it helps. |
Your example with
![image](https://cloud.githubusercontent.com/assets/2273613/17095416/9b72310a-5254-11e6-846f-f143612330c6.png)
|
Offline package does not work! |
in iOS。 |
The injection of js code doesn't work in the release environment。 |
@Kureev |
@Kureev,Android, |
I think the problem is in the release mode. Probably, something is broken in the packager. |
what should I do for this time?back to RN 0.27?,or init a new project? |
@Kureev,it must be.now I back to 0.27 is not work,too. |
@Kureev shouldn't this issue be converted to StackOverflow? |
@grabbou not sure. Probably, this issue can be reworded to "WebView doesn't work in Release mode". |
I installed 0.30 with cli command |
Then I'm about to close this one as far as its fixed in 0.30. |
@facebook-github-bot close |
@Kureev tells me to close this issue. If you think it should still be opened let us know why. |
Javascript in webview is not working in ios after release.but works in debugging mode |
#16133 |
When I use the webview in my project,JavaScript not work in the HTML file,Here my code:
``
`
`
-I use RN 0.29.2
-in RN 0.27 is ok
what should I do? thanks
The text was updated successfully, but these errors were encountered: