Skip to content

Instantly share code, notes, and snippets.

@JonnyBurger
Created November 10, 2018 13:00
Show Gist options
  • Save JonnyBurger/5aa693964de0e1ecc761a1f7601e9f9d to your computer and use it in GitHub Desktop.
Save JonnyBurger/5aa693964de0e1ecc761a1f7601e9f9d to your computer and use it in GitHub Desktop.
import React, {Component} from 'react';
import {withNavigationFocus} from 'react-navigation';
import hoistNonReactStatics from 'hoist-non-react-statics';
export default Comp => {
const Hoc = class extends Component {
shouldComponentUpdate(nextProps) {
return nextProps.isFocused;
}
render() {
return <Comp {...this.props} />;
}
};
return hoistNonReactStatics(withNavigationFocus(Hoc), Comp);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment