-
-
Save statianzo/c3b7c345abf82e833cb269dea7277709 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {StyleSheet} from 'react-native'; | |
const Styled = (Inner, styles) => { | |
const styleSheet = StyleSheet.create({ | |
styles, | |
}); | |
const displayName = `Styled(${(Inner: any).displayName})`; | |
const wrapper = ({style, children, ...rest}) => { | |
return ( | |
<Inner style={[styleSheet.styles, style]} {...rest}> | |
{children} | |
</Inner> | |
); | |
}; | |
wrapper.displayName = displayName; | |
return wrapper; | |
}; | |
export default Styled; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment