javascript - How to close a React-Native Webview? -


i'm new react native , have simple app opens webview when button pressed. if navigation state changes, want close webview. i'm able know when close unable find how.

the doc not mention function it. what's solution this?

version : react-native: 0.47.2

you can add in modal

_onnavigationstatechange (webviewstate) {    this.hide() } show () {   this.setstate({ modalvisible: true }) }  hide () {   this.setstate({ modalvisible: false }) }  render () { const { clientid, redirecturl, scopes } = this.props return (   <modal     animationtype={'slide'}     visible={this.state.modalvisible}     onrequestclose={this.hide.bind(this)}     transparent   >     <view style={styles.modalwarp}>       <view style={styles.contentwarp}>         <webview           style={[{ flex: 1 }, this.props.styles]}           source={{ uri: `http://google.com` }}           scalespagetofit           startinloadingstate           onnavigationstatechange={this._onnavigationstatechange.bind(this)}           onerror={this._onnavigationstatechange.bind(this)}         />         <touchableopacity onpress={this.hide.bind(this)} style={styles.btnstyle}>           <text style={styles.closestyle}>close</text>         </touchableopacity>       </view>     </view>   </modal >   ) } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -