Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 扩展react native webview的设计_Reactjs_React Native_React Native Webview - Fatal编程技术网

Reactjs 扩展react native webview的设计

Reactjs 扩展react native webview的设计,reactjs,react-native,react-native-webview,Reactjs,React Native,React Native Webview,我想围绕react native webview创建一个包装器,这样我就可以提供一些默认值,客户机就可以覆盖它们。我还想提供方法的默认实现 例如: <MyBaseWebView uri ={provided by user of MyBaseWebView}> MyBaseWebView can have default implementations for onError etc. 在我看来,您需要添加状态变量,可能是在webview之前的屏幕上 constructor(pro

我想围绕react native webview创建一个包装器,这样我就可以提供一些默认值,客户机就可以覆盖它们。我还想提供方法的默认实现

例如:

<MyBaseWebView uri ={provided by user of MyBaseWebView}>
MyBaseWebView can have default implementations for onError etc.

在我看来,您需要添加
状态
变量,可能是在webview之前的屏幕上

constructor(props) {
    super(props);
    this.state = {
      uri: "www.defaultUri.com",
      injectedJavascript: "", 
    };
  }

//then for example in a textInput in render() you could allow your 
//user to update these values

<TextInput
value={this.state.uri}
onChangeText={text => this.setState({uri: text})}/>
构造函数(道具){
超级(道具);
此.state={
uri:“www.defaultUri.com”,
injectedJavascript:“”,
};
}
//例如,在render()中的textInput中,您可以允许
//用户可以更新这些值
this.setState({uri:text})}/>
您可以对
injectedJavascript
或任何其他变量执行相同的操作,当用户点击提交或其他操作时,您可以将这些状态变量作为道具传递给
webview

如果这不是你想要的或者不够清楚,请告诉我

constructor(props) {
    super(props);
    this.state = {
      uri: "www.defaultUri.com",
      injectedJavascript: "", 
    };
  }

//then for example in a textInput in render() you could allow your 
//user to update these values

<TextInput
value={this.state.uri}
onChangeText={text => this.setState({uri: text})}/>