Skip to content

Instantly share code, notes, and snippets.

@willmanio
Created August 30, 2018 17:57
Show Gist options
  • Save willmanio/d75985847d68eeb751d90cb68890020b to your computer and use it in GitHub Desktop.
Save willmanio/d75985847d68eeb751d90cb68890020b to your computer and use it in GitHub Desktop.
// style.js
const BACKGROUND_COLOR = '#7c0a02';
export const HEADER_COLOR = '#666';
export default {
header: {
backgroundColor: BACKGROUND_COLOR,
},
}
// index.js
import Style, { HEADER_COLOR } from './style';
export default function Header() {
return (
<View style={Style.header}>
<Text style={HEADER_COLOR}>Hello world! I am gray.</Text>
</View>
);
}
@jsm-moven
Copy link

can you make this something not involving colors, like the following? otherwise this conflicts with the new STYLE-6.

// style.js
export default {
  view: {
    height: 20,
    width: 20,
  },
}

// index.js
import Style from './style';

export default function Box() {
  return (
    <View style={Style.view} />
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment