summaryrefslogtreecommitdiffhomepage
path: root/app/lib/styles.js
blob: 840c7c79ab006c22a8cc1c9daf79bde1d13101e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// @flow

import { Styles } from 'reactxp';

type ExtractReturnType = (*) => Object;

export function createViewStyles<T: { [string]: Object }>(styles: T): $ObjMap<T, ExtractReturnType> {
  const viewStyles = {};
  for (const style of Object.keys(styles)) {
    viewStyles[style] = Styles.createViewStyle(styles[style]);
  }
  return viewStyles;
}

export function createTextStyles<T: { [string]: Object }>(styles: T): $ObjMap<T, ExtractReturnType> {
  const textStyles = {};
  for (const style of Object.keys(styles)) {
    textStyles[style] = Styles.createTextStyle(styles[style]);
  }
  return textStyles;
}