hyrwork / react-native-row

A wrapper around the react-native View component enabling concise assignment of flexbox properties
MIT License
51 stars 5 forks source link

Styled #9

Open ssomnoremac opened 7 years ago

ssomnoremac commented 7 years ago

I've added an implementation of Styled Components for this library. Use regular object styles.

Needs to be tested but the idea is

import { Styled } from react-native-row

const GreenRow = Styled.Row({
    backgroundColor: "green"
})

<GreenRow dial={5} flex>
    <Text>Hi</Text>
</GreenRow>

Best of both worlds? My problem with Styles Components is that dial, or layout should be defined on the component instance itself. Layout is only visually relevant in relation to its context. So by putting layout styles in Styled definitions, you lose that context. Colors and other styles however, I'm fine to extract away. So this might get it done for some people. We'll see.