@boneframework/native-components 1.0.55 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,14 @@
1
- import ColorContext from "@boneframework/native-components/contexts/colors";
2
- import { defaultTheme, ThemeColors } from "@boneframework/native-components/contexts/theme";
1
+ import { defaultTheme, ThemeColors } from "../contexts/theme";
2
+ import {useContext} from "react";
3
+ import ColorContext from "../contexts/colors";
3
4
 
4
- const ColorProvider = ({value, children}: {value?: ThemeColors; children: React.ReactNode}) => {
5
- return <ColorContext value={value ?? defaultTheme}>
5
+ const ColorProvider = ({colors, children}: {colors?: ThemeColors; children: React.ReactNode}) => {
6
+ const colorContext: ThemeColors = useContext(ColorContext);
7
+ colorContext.colors = colors.colors;
8
+
9
+ return <>
6
10
  {children}
7
- </ColorContext>;
11
+ </>;
8
12
  };
9
13
 
10
- export default ColorProvider;
14
+ export default ColorProvider;
@@ -1,4 +1,4 @@
1
- import { ThemeColors, defaultTheme } from "@boneframework/native-components/contexts/theme";
1
+ import { ThemeColors, defaultTheme } from "../contexts/theme";
2
2
  import { createContext } from "react";
3
3
 
4
4
  const ColorContext = createContext<ThemeColors>(defaultTheme);
@@ -8,4 +8,4 @@ export type ColorsProviderProps = {
8
8
  value: ThemeColors;
9
9
  };
10
10
 
11
- export default ColorContext;
11
+ export default ColorContext;
package/contexts/theme.ts CHANGED
@@ -1,34 +1,38 @@
1
- import { createContext } from 'react';
1
+ import {Context, createContext} from 'react';
2
2
 
3
3
  type ThemeColors = {
4
- primary: string;
5
- secondary: string;
6
- black: string;
7
- white: string;
8
- light: string;
9
- whitish: string;
10
- medium: string;
11
- darkish: string;
12
- dark: string;
13
- danger: string;
14
- bgGradient: string[];
4
+ colors: {
5
+ primary: string;
6
+ secondary: string;
7
+ black: string;
8
+ white: string;
9
+ light: string;
10
+ whitish: string;
11
+ medium: string;
12
+ darkish: string;
13
+ dark: string;
14
+ danger: string;
15
+ bgGradient: string[];
16
+ }
15
17
  };
16
18
 
17
19
  const defaultTheme: ThemeColors = {
18
- primary: '#fc5c65',
19
- secondary: '#4ecdc4',
20
- black: '#000',
21
- white: '#fff',
22
- light: '#f0f4f4',
23
- whitish: '#ddd',
24
- medium: '#999',
25
- darkish: '#333',
26
- dark: '#222',
27
- danger: '#ff5200',
28
- bgGradient: ['#001C50', '#003698']
20
+ colors: {
21
+ primary: '#fc5c65',
22
+ secondary: '#4ecdc4',
23
+ black: '#000',
24
+ white: '#fff',
25
+ light: '#f0f4f4',
26
+ whitish: '#ddd',
27
+ medium: '#999',
28
+ darkish: '#333',
29
+ dark: '#222',
30
+ danger: '#ff5200',
31
+ bgGradient: ['#001C50', '#003698']
32
+ }
29
33
  };
30
34
 
31
- const ThemeContext = createContext<ThemeColors>(defaultTheme);
35
+ const ThemeContext: Context<ThemeColors> = createContext<ThemeColors>(defaultTheme);
32
36
 
33
37
  export default ThemeContext;
34
38
  export { defaultTheme, ThemeColors };
@@ -1,11 +1,10 @@
1
1
 
2
- // import { useContext } from "react";
3
- import colors from "../../../../config/colors";
4
- // import ColorContext from "@boneframework/native-components/contexts/colors";
2
+ import { useContext } from "react";
3
+ import ColorContext from "../contexts/colors";
4
+ import {ThemeColors} from "../contexts/theme";
5
5
 
6
- const useColors = () => {
7
- // return useContext(ColorContext);
8
- return colors
6
+ const useColors = (): ThemeColors => {
7
+ return useContext(ColorContext);
9
8
  }
10
9
 
11
- export default useColors;
10
+ export default useColors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boneframework/native-components",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "Expo React Native Components for Bone Framework",
5
5
  "main": "src/Bone.ts",
6
6
  "scripts": {