Skip to content

Commit

Permalink
fix(themes): fix theme export issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Bien committed Jan 7, 2021
1 parent 7894b70 commit ecc2715
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions example/src/examples/PanelExample.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import { Panel, Text, original } from 'react95-native';
import { Panel, Text, themes } from 'react95-native';

import Container from '../util/Container';

Expand Down Expand Up @@ -57,7 +57,7 @@ const styles = StyleSheet.create({
padding,
},
label: {
color: original.borderLightest,
color: themes.original.borderLightest,
marginBottom: 4,
},
});
Expand Down
4 changes: 2 additions & 2 deletions example/src/util/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
StyleProp,
ViewStyle,
} from 'react-native';
import { original, Text } from 'react95-native';
import { themes, Text } from 'react95-native';

const styles = StyleSheet.create({
container: {
Expand All @@ -17,7 +17,7 @@ const styles = StyleSheet.create({
padding: 16,
},
label: {
color: original.borderDarkest,
color: themes.original.borderDarkest,
marginBottom: 4,
},
section: {
Expand Down
10 changes: 6 additions & 4 deletions src/common/theming/Theme.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { createContext } from 'react';

import type { Theme } from '../../types';
import originalTheme from './themes/original';
import themes from './themes';

import {
border as borderStylesBuilder,
text as textStylesBuilder,
} from '../styles';

const defaultTheme = themes.original;

type ThemeProviderProps = {
children: React.ReactNode;
theme: Theme;
};

const ThemeContext = createContext({
...originalTheme,
border: borderStylesBuilder(originalTheme),
text: textStylesBuilder(originalTheme),
...defaultTheme,
border: borderStylesBuilder(defaultTheme),
text: textStylesBuilder(defaultTheme),
});

const ThemeProvider = ({ children, theme }: ThemeProviderProps) => {
Expand Down
9 changes: 0 additions & 9 deletions src/common/theming/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export { Select, SelectBox } from './Select';
export { Text, Title, Anchor } from './Typography';

export * from './Icons';
export * from './common/theming';
export { ThemeProvider } from './common/theming/Theme';
export { default as themes } from './common/theming/themes';

export { Theme } from './types';
export { fontNames } from './common/styles';

0 comments on commit ecc2715

Please sign in to comment.