3

Im not familiar with ios app development , but is there a simple way to open a url in myApp's webview , in a simple way ?

Im looking for the same behaviour of facebook's app. once you click on http link , a webview is opened by the app.

clickHndlr: function() {
   someNativeOrNonNativeModule.openUrl('http://google.com');
}


<Text onClick={this.clickHndlr}>google</Text> 

Thanks.

1 Answer 1

2

Hi You can use WebView component in reactnative.

var {
  ....,
  WebView,
} = React;

and in initial state give a default url or no url

getInitialState: function() {
 return {
  url: '', // or default url
  yourInitialStates: 'value',
 };
},

and then at inside render add component

<WebView ....your styles, properties
  url={this.state.url}
/>

Now add your code

clickHndlr: function() {
 this.setState({url:'http://google.com'});
}

This will give the result

Sign up to request clarification or add additional context in comments.

2 Comments

This probably works . i thought there is a an api for that . calling to a native api , will cause the same behaviour
sorry, no native apis for that. If you found answer useful check the tick.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.