-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix: ExceptionsManagerModule android crashes #968
Changes from 5 commits
c164a8e
3a68846
05fc1b2
0764118
50501fe
3110d6e
8227295
202e18c
432b98d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,9 +55,18 @@ export default class WebsiteIcon extends PureComponent { | |
}; | ||
|
||
state = { | ||
renderIconUrlError: false | ||
renderIconUrlError: false, | ||
apiLogoUrl: undefined, | ||
title: undefined | ||
}; | ||
|
||
componentDidMount() { | ||
const { url } = this.props; | ||
const apiLogoUrl = { uri: this.getIconUrl(url) }; | ||
const title = typeof this.props.title === 'string' ? this.props.title : getHost(url); | ||
this.setState({ title: title.substring(0, 1).toUpperCase(), apiLogoUrl }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I oppose to this change because it's gonna cause an extra re-render in every website icon, no matter if it was problematic or not. My suggestion is to can keep those in the render method and use the this prop to capitalize: https://facebook.github.io/react-native/docs/text-style-props#texttransform |
||
} | ||
|
||
/** | ||
* Get image url from favicon api | ||
*/ | ||
|
@@ -74,15 +83,14 @@ export default class WebsiteIcon extends PureComponent { | |
}; | ||
|
||
render = () => { | ||
const { renderIconUrlError } = this.state; | ||
const { url, viewStyle, style, title, textStyle, transparent } = this.props; | ||
const apiLogoUrl = { uri: this.getIconUrl(url) }; | ||
const { renderIconUrlError, title, apiLogoUrl } = this.state; | ||
const { viewStyle, style, textStyle, transparent } = this.props; | ||
|
||
if (renderIconUrlError && title) { | ||
return ( | ||
<View style={viewStyle}> | ||
<View style={[styles.fallback, style]}> | ||
<Text style={[styles.fallbackText, textStyle]}>{title.substring(0, 1).toUpperCase()}</Text> | ||
<Text style={[styles.fallbackText, textStyle]}>{title}</Text> | ||
</View> | ||
</View> | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I literally made this change last night and it didn't go to production yet.
See https://github.com/MetaMask/metamask-mobile/pull/963/files#diff-6b966e9916d92d54ae676b69d898840cR244
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,
title
was the problem nothost
. I was able to get to some cases wheretitle
was{}
making everything crash