Skip to content

Instantly share code, notes, and snippets.

@rgommezz
Last active May 17, 2018 19:34
Show Gist options
  • Save rgommezz/fb215c006b665b8575317efd2d67232a to your computer and use it in GitHub Desktop.
Save rgommezz/fb215c006b665b8575317efd2d67232a to your computer and use it in GitHub Desktop.
// @flow
import React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import SafeAreaView from '../../lib/react-native-safe-area-view';
export default function withSafeAreaView(
WrappedComponent: ReactClass<*>,
): () => React.Element<*> {
function EnhancedComponent(props: any) {
return (
<SafeAreaView style={{ flex: 1, backgroundColor: '#CCC' }}>
<WrappedComponent {...props} />
</SafeAreaView>
);
}
return hoistNonReactStatics(EnhancedComponent, WrappedComponent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment