UNPKG

505 BPlain TextView Raw
1import { StyleSheet } from 'react-native';
2
3// Kept in separate file, to avoid name collision with Symbol element
4export function resolve<T>(styleProp: Iterable<T>, cleanedProps: T) {
5 if (styleProp) {
6 return StyleSheet
7 ? [styleProp, cleanedProps]
8 : // Compatibility for arrays of styles in plain react web
9 styleProp[Symbol.iterator]
10 ? Object.assign({}, ...styleProp, cleanedProps)
11 : Object.assign({}, styleProp, cleanedProps);
12 } else {
13 return cleanedProps;
14 }
15}