diff --git a/Examples/UIExplorer/XHRExampleCookies.js b/Examples/UIExplorer/XHRExampleCookies.js index c4e710084..d07c7af03 100644 --- a/Examples/UIExplorer/XHRExampleCookies.js +++ b/Examples/UIExplorer/XHRExampleCookies.js @@ -22,6 +22,7 @@ var { Text, TouchableHighlight, View, + WebView, } = ReactNative; var RCTNetworking = require('RCTNetworking'); @@ -45,6 +46,7 @@ class XHRExampleCookies extends React.Component { var url = `https://${domain}/cookies/set?a=${a}&b=${b}`; fetch(url).then((response) => { this.setStatus(`Cookies a=${a}, b=${b} set`); + this.refreshWebview(); }); this.setState({ @@ -59,6 +61,7 @@ class XHRExampleCookies extends React.Component { return response.json(); }).then((data) => { this.setStatus(`Got cookies ${JSON.stringify(data.cookies)} from server`); + this.refreshWebview(); }); this.setStatus('Getting cookies...'); @@ -67,9 +70,14 @@ class XHRExampleCookies extends React.Component { clearCookies() { RCTNetworking.clearCookies((cleared) => { this.setStatus('Cookies cleared, had cookies=' + cleared); + this.refreshWebview(); }); } + refreshWebview() { + this.refs.webview.reload(); + } + setStatus(status: string) { this.setState({status}); } @@ -113,6 +121,18 @@ class XHRExampleCookies extends React.Component { {this.state.status} + + + Refresh Webview + + + ); }