mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Rename prop "injectedJavascriptIOS" to "injectedJavaScript
Summary: Android WebView now supports the prop "injectedJavaScript", too. It's time to rename "injectedJavascriptIOS" to "injectedJavaScript" for API consistency between IOS and Android.
This commit is contained in:
@@ -43,6 +43,12 @@ var WebView = React.createClass({
|
||||
startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load
|
||||
style: View.propTypes.style,
|
||||
javaScriptEnabledAndroid: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Sets the JS to be injected when the webpage loads.
|
||||
*/
|
||||
injectedJavaScript: PropTypes.string,
|
||||
|
||||
/**
|
||||
* Sets the user-agent for this WebView. The user-agent can also be set in native through
|
||||
* WebViewConfig, but this can and will overwrite that config.
|
||||
@@ -96,6 +102,7 @@ var WebView = React.createClass({
|
||||
key="webViewKey"
|
||||
style={webViewStyles}
|
||||
url={this.props.url}
|
||||
injectedJavaScript={this.props.injectedJavaScript}
|
||||
userAgent={this.props.userAgent}
|
||||
javaScriptEnabledAndroid={this.props.javaScriptEnabledAndroid}
|
||||
contentInset={this.props.contentInset}
|
||||
@@ -176,8 +183,9 @@ var WebView = React.createClass({
|
||||
|
||||
var RCTWebView = createReactNativeComponentClass({
|
||||
validAttributes: merge(ReactNativeViewAttributes.UIView, {
|
||||
url: true,
|
||||
injectedJavaScript: true,
|
||||
javaScriptEnabledAndroid: true,
|
||||
url: true,
|
||||
userAgent: true,
|
||||
}),
|
||||
uiViewClassName: 'RCTWebView',
|
||||
|
||||
@@ -98,9 +98,9 @@ var WebView = React.createClass({
|
||||
*/
|
||||
javaScriptEnabledAndroid: PropTypes.bool,
|
||||
/**
|
||||
* Used for iOS only, sets the JS to be injected when the webpage loads.
|
||||
* Sets the JS to be injected when the webpage loads.
|
||||
*/
|
||||
injectedJavascriptIOS: PropTypes.string,
|
||||
injectedJavaScript: PropTypes.string,
|
||||
|
||||
/**
|
||||
* Used for iOS only, sets whether the webpage scales to fit the view and the
|
||||
@@ -159,7 +159,7 @@ var WebView = React.createClass({
|
||||
style={webViewStyles}
|
||||
url={this.props.url}
|
||||
html={this.props.html}
|
||||
injectedJavascriptIOS={this.props.injectedJavascriptIOS}
|
||||
injectedJavaScript={this.props.injectedJavaScript}
|
||||
bounces={this.props.bounces}
|
||||
scrollEnabled={this.props.scrollEnabled}
|
||||
contentInset={this.props.contentInset}
|
||||
@@ -179,15 +179,15 @@ var WebView = React.createClass({
|
||||
},
|
||||
|
||||
goForward: function() {
|
||||
RCTWebViewManager.goForward(this.getWebWiewHandle());
|
||||
RCTWebViewManager.goForward(this.getWebViewHandle());
|
||||
},
|
||||
|
||||
goBack: function() {
|
||||
RCTWebViewManager.goBack(this.getWebWiewHandle());
|
||||
RCTWebViewManager.goBack(this.getWebViewHandle());
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
RCTWebViewManager.reload(this.getWebWiewHandle());
|
||||
RCTWebViewManager.reload(this.getWebViewHandle());
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -200,7 +200,7 @@ var WebView = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
getWebWiewHandle: function(): any {
|
||||
getWebViewHandle: function(): any {
|
||||
return React.findNodeHandle(this.refs[RCT_WEBVIEW_REF]);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user