Skip to content

Commit

Permalink
Bugfix: bowser bottom bar navigation (#984)
Browse files Browse the repository at this point in the history
* fix disabled behavior

* handle undefined webvies and approvalRequest callbacks

* snaps
  • Loading branch information
estebanmino authored Aug 12, 2019
1 parent 866f681 commit 653b1e4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ exports[`BrowserBottomBar should render correctly 1`] = `
>
<Icon
allowFontScaling={false}
disabled={false}
name="angle-left"
size={24}
style={
Expand All @@ -51,6 +50,7 @@ exports[`BrowserBottomBar should render correctly 1`] = `
</TouchableOpacity>
<TouchableOpacity
activeOpacity={0.2}
disabled={true}
onPress={[Function]}
style={
Object {
Expand Down
9 changes: 2 additions & 7 deletions app/components/UI/BrowserBottomBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,9 @@ export default class BrowserBottomBar extends PureComponent {
return (
<ElevatedView elevation={11} style={styles.bottomBar}>
<TouchableOpacity onPress={goBack} style={styles.iconButton} disabled={!canGoBack}>
<Icon
name="angle-left"
disabled={!canGoBack}
size={24}
style={[styles.icon, !canGoBack ? styles.disabledIcon : {}]}
/>
<Icon name="angle-left" size={24} style={[styles.icon, !canGoBack ? styles.disabledIcon : {}]} />
</TouchableOpacity>
<TouchableOpacity onPress={goForward} style={styles.iconButton}>
<TouchableOpacity onPress={goForward} style={styles.iconButton} disabled={!canGoForward}>
<Icon
name="angle-right"
size={24}
Expand Down
10 changes: 8 additions & 2 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,13 @@ export class BrowserTab extends PureComponent {
if (!isInitialReload) {
this.isReloading = true;
}
// As we're reloading to other url we should remove this callback
this.approvalRequest = undefined;
const url2Reload = this.state.inputValue;
// Force unmount the webview to avoid caching problems
this.setState({ forceReload: true }, () => {
// Make sure we're not calling last mounted webview during this time threshold
this.webview.current = null;
setTimeout(() => {
this.setState({ forceReload: false }, () => {
this.go(url2Reload);
Expand Down Expand Up @@ -1527,12 +1531,14 @@ export class BrowserTab extends PureComponent {
this.setState({ showApprovalDialog: false });
approveHost(this.state.fullHostname);
this.backgroundBridge.enableAccounts();
this.approvalRequest.resolve([selectedAddress]);
this.approvalRequest && this.approvalRequest.resolve && this.approvalRequest.resolve([selectedAddress]);
};

onAccountsReject = () => {
this.setState({ showApprovalDialog: false });
this.approvalRequest.reject('User rejected account access');
this.approvalRequest &&
this.approvalRequest.reject &&
this.approvalRequest.reject('User rejected account access');
};

renderApprovalModal = () => {
Expand Down

0 comments on commit 653b1e4

Please sign in to comment.