Skip to content

Instantly share code, notes, and snippets.

View Purii's full-sized avatar

Patrick Böder Purii

View GitHub Profile
@Purii
Purii / styleSchemeReactComponent.js
Last active October 7, 2017 09:43
Clean solution to support multiple style schemes on a react (native) component
import React from 'react';
import { StyleSheet, View } from 'react-native';
// Get colorScheme as prop
export default ({ colorScheme }) => (
<View
style={
// Check only once instead of n * (amount of available schemes)
styles[colorScheme]
? styles[colorScheme].container