Skip to content

Commit

Permalink
Network name crash (#966)
Browse files Browse the repository at this point in the history
* fix

* fix
  • Loading branch information
Bruno Barbieri authored Jul 30, 2019
1 parent dad0cfc commit bc6be5d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions app/components/UI/NavbarBrowserTitle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,28 @@ class NavbarBrowserTitle extends PureComponent {
});
};

getNetworkName(network) {
let name = { ...Networks.rpc, color: null }.name;

if (network && network.provider) {
if (network.provider.nickname) {
name = network.provider.nickname;
} else if (network.provider.type) {
const currentNetwork = Networks[network.provider.type];
if (currentNetwork && currentNetwork.name) {
name = currentNetwork.name;
}
}
}

return name;
}

render = () => {
const { https, network, hostname } = this.props;
let name = null;
const color = (Networks[network.provider.type] && Networks[network.provider.type].color) || null;
const name = this.getNetworkName(network);

if (network.provider.nickname) {
name = network.provider.nickname;
} else {
name = Networks[network.provider.type].name || { ...Networks.rpc, color: null }.name;
}
return (
<TouchableOpacity onPress={this.onTitlePress} style={styles.wrapper}>
<View style={styles.currentUrlWrapper}>
Expand Down

0 comments on commit bc6be5d

Please sign in to comment.