Skip to content

Commit

Permalink
chore(*): optimize render perfs
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesMangwa committed Sep 11, 2016
2 parents 4f3363b + bc310ae commit f475fda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MyAwesomeApp = () => {
{'\n\n'}
You can **emphasize** what you want, or just _suggest it_ 😏…
{'\n\n'}
You can even [link your website](http://charlesmangwa.surge.sh) or if you prefer: [email sombedy](mailto:charlesmangwa@gmail.com)
You can even [link your website](http://charlesmangwa.surge.sh) or if you prefer: [email sombedy](mailto:email@somebody.com)
{'\n\n'}
Spice it up with some GIF 💃:
{'\n\n'}
Expand Down
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ class Markdown extends Component {
return SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules, 'react'))(tree)
}

shouldComponentUpdate(nextProps, nextState) {
if (
this.props.children === nextProps.children &&
this.props.styles === nextProps.styles
) {
return false
}
return true
}

render() {
return (
<View style={[styles.view, this.props.styles.view]}>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-native": "*"
},
"keywords": [
"react",
"react-native",
"native",
"markdown",
"md",
Expand Down

0 comments on commit f475fda

Please sign in to comment.