related-ui-components 1.1.8 → 1.2.0
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.
- package/lib/commonjs/app.js +36 -117
- package/lib/commonjs/app.js.map +1 -1
- package/lib/commonjs/components/Badges/Badge.js +3 -1
- package/lib/commonjs/components/Badges/Badge.js.map +1 -1
- package/lib/commonjs/components/Banner/Banner.js +3 -1
- package/lib/commonjs/components/Banner/Banner.js.map +1 -1
- package/lib/commonjs/components/Banner/BannerWithDetails.js +3 -1
- package/lib/commonjs/components/Banner/BannerWithDetails.js.map +1 -1
- package/lib/commonjs/components/BrandIcon/BrandIcon.js +3 -1
- package/lib/commonjs/components/BrandIcon/BrandIcon.js.map +1 -1
- package/lib/commonjs/components/Card/Card.js +5 -3
- package/lib/commonjs/components/Card/Card.js.map +1 -1
- package/lib/commonjs/components/Card/CardHeader.js +3 -1
- package/lib/commonjs/components/Card/CardHeader.js.map +1 -1
- package/lib/commonjs/components/Card/templates/DealCard.js +5 -1
- package/lib/commonjs/components/Card/templates/DealCard.js.map +1 -1
- package/lib/commonjs/components/Card/templates/DealCardWithBackgroundImage.js +10 -4
- package/lib/commonjs/components/Card/templates/DealCardWithBackgroundImage.js.map +1 -1
- package/lib/commonjs/components/CloseIcon/CloseIcon.js +5 -1
- package/lib/commonjs/components/CloseIcon/CloseIcon.js.map +1 -1
- package/lib/commonjs/components/Filters/Filters.js +5 -1
- package/lib/commonjs/components/Filters/Filters.js.map +1 -1
- package/lib/commonjs/components/Filters/PointsRangeSelector.js +5 -1
- package/lib/commonjs/components/Filters/PointsRangeSelector.js.map +1 -1
- package/lib/commonjs/components/Input/Input.js +5 -1
- package/lib/commonjs/components/Input/Input.js.map +1 -1
- package/lib/commonjs/components/Popup/Popup.js +5 -1
- package/lib/commonjs/components/Popup/Popup.js.map +1 -1
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +5 -1
- package/lib/commonjs/components/ProgressBar/ProgressBar.js.map +1 -1
- package/lib/commonjs/components/RedemptionOption/RedemptionOption.js +3 -1
- package/lib/commonjs/components/RedemptionOption/RedemptionOption.js.map +1 -1
- package/lib/commonjs/components/UnlockRewards/RewardItem.js +5 -1
- package/lib/commonjs/components/UnlockRewards/RewardItem.js.map +1 -1
- package/lib/commonjs/components/UnlockRewards/UnlockRewards.js +5 -1
- package/lib/commonjs/components/UnlockRewards/UnlockRewards.js.map +1 -1
- package/lib/commonjs/index.js +5 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theme/ThemeContext.js +16 -7
- package/lib/commonjs/theme/ThemeContext.js.map +1 -1
- package/lib/module/app.js +38 -114
- package/lib/module/app.js.map +1 -1
- package/lib/module/components/Badges/Badge.js +3 -1
- package/lib/module/components/Badges/Badge.js.map +1 -1
- package/lib/module/components/Banner/Banner.js +3 -1
- package/lib/module/components/Banner/Banner.js.map +1 -1
- package/lib/module/components/Banner/BannerWithDetails.js +3 -1
- package/lib/module/components/Banner/BannerWithDetails.js.map +1 -1
- package/lib/module/components/BrandIcon/BrandIcon.js +3 -1
- package/lib/module/components/BrandIcon/BrandIcon.js.map +1 -1
- package/lib/module/components/Card/Card.js +5 -3
- package/lib/module/components/Card/Card.js.map +1 -1
- package/lib/module/components/Card/CardHeader.js +3 -1
- package/lib/module/components/Card/CardHeader.js.map +1 -1
- package/lib/module/components/Card/templates/DealCard.js +5 -1
- package/lib/module/components/Card/templates/DealCard.js.map +1 -1
- package/lib/module/components/Card/templates/DealCardWithBackgroundImage.js +10 -4
- package/lib/module/components/Card/templates/DealCardWithBackgroundImage.js.map +1 -1
- package/lib/module/components/CloseIcon/CloseIcon.js +5 -1
- package/lib/module/components/CloseIcon/CloseIcon.js.map +1 -1
- package/lib/module/components/Filters/Filters.js +5 -1
- package/lib/module/components/Filters/Filters.js.map +1 -1
- package/lib/module/components/Filters/PointsRangeSelector.js +5 -1
- package/lib/module/components/Filters/PointsRangeSelector.js.map +1 -1
- package/lib/module/components/Input/Input.js +5 -1
- package/lib/module/components/Input/Input.js.map +1 -1
- package/lib/module/components/Popup/Popup.js +5 -1
- package/lib/module/components/Popup/Popup.js.map +1 -1
- package/lib/module/components/ProgressBar/ProgressBar.js +5 -1
- package/lib/module/components/ProgressBar/ProgressBar.js.map +1 -1
- package/lib/module/components/RedemptionOption/RedemptionOption.js +3 -1
- package/lib/module/components/RedemptionOption/RedemptionOption.js.map +1 -1
- package/lib/module/components/UnlockRewards/RewardItem.js +5 -1
- package/lib/module/components/UnlockRewards/RewardItem.js.map +1 -1
- package/lib/module/components/UnlockRewards/UnlockRewards.js +5 -1
- package/lib/module/components/UnlockRewards/UnlockRewards.js.map +1 -1
- package/lib/module/index.js +4 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/ThemeContext.js +15 -6
- package/lib/module/theme/ThemeContext.js.map +1 -1
- package/lib/typescript/commonjs/app.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Card/templates/DealCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Card/templates/DealCardWithBackgroundImage.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/CloseIcon/CloseIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Filters/Filters.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Filters/PointsRangeSelector.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Input/Input.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Popup/Popup.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/UnlockRewards/RewardItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/UnlockRewards/UnlockRewards.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/ThemeContext.d.ts +9 -4
- package/lib/typescript/commonjs/theme/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/module/app.d.ts.map +1 -1
- package/lib/typescript/module/components/Card/templates/DealCard.d.ts.map +1 -1
- package/lib/typescript/module/components/Card/templates/DealCardWithBackgroundImage.d.ts.map +1 -1
- package/lib/typescript/module/components/CloseIcon/CloseIcon.d.ts.map +1 -1
- package/lib/typescript/module/components/Filters/Filters.d.ts.map +1 -1
- package/lib/typescript/module/components/Filters/PointsRangeSelector.d.ts.map +1 -1
- package/lib/typescript/module/components/Input/Input.d.ts.map +1 -1
- package/lib/typescript/module/components/Popup/Popup.d.ts.map +1 -1
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/lib/typescript/module/components/UnlockRewards/RewardItem.d.ts.map +1 -1
- package/lib/typescript/module/components/UnlockRewards/UnlockRewards.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/theme/ThemeContext.d.ts +9 -4
- package/lib/typescript/module/theme/ThemeContext.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/app.tsx +39 -84
- package/src/components/Badges/Badge.tsx +1 -1
- package/src/components/Banner/Banner.tsx +1 -1
- package/src/components/Banner/BannerWithDetails.tsx +1 -1
- package/src/components/BrandIcon/BrandIcon.tsx +1 -1
- package/src/components/Card/Card.tsx +3 -3
- package/src/components/Card/CardHeader.tsx +1 -1
- package/src/components/Card/templates/DealCard.tsx +2 -1
- package/src/components/Card/templates/DealCardWithBackgroundImage.tsx +6 -3
- package/src/components/CloseIcon/CloseIcon.tsx +3 -1
- package/src/components/Filters/Filters.tsx +2 -1
- package/src/components/Filters/PointsRangeSelector.tsx +2 -1
- package/src/components/Input/Input.tsx +2 -1
- package/src/components/Popup/Popup.tsx +2 -1
- package/src/components/ProgressBar/ProgressBar.tsx +2 -1
- package/src/components/RedemptionOption/RedemptionOption.tsx +1 -1
- package/src/components/UnlockRewards/RewardItem.tsx +2 -1
- package/src/components/UnlockRewards/UnlockRewards.tsx +2 -1
- package/src/index.ts +4 -4
- package/src/theme/ThemeContext.tsx +27 -8
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { registerRootComponent } from 'expo';
|
|
2
|
+
import "react-native-reanimated";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import App from "./app";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
registerRootComponent(App);
|
|
8
8
|
|
|
9
9
|
export * from "./theme"
|
|
10
10
|
export * from "./components";
|
|
@@ -6,28 +6,40 @@ import React, {
|
|
|
6
6
|
ReactNode,
|
|
7
7
|
} from "react";
|
|
8
8
|
|
|
9
|
-
import { useColorScheme } from "react-native";
|
|
9
|
+
import { I18nManager, useColorScheme } from "react-native";
|
|
10
10
|
import { lightTheme, ThemeType, darkTheme } from "./Colors";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface RelatedContext {
|
|
13
|
+
theme: ThemeType;
|
|
14
|
+
isRTL: boolean;
|
|
15
|
+
}
|
|
16
|
+
export const ThemeContext = createContext<RelatedContext>({
|
|
17
|
+
theme: lightTheme,
|
|
18
|
+
isRTL: I18nManager.isRTL,
|
|
19
|
+
});
|
|
13
20
|
|
|
14
21
|
// Define props for ThemeProvider
|
|
15
|
-
interface
|
|
22
|
+
interface RelatedProviderProps {
|
|
16
23
|
children: ReactNode;
|
|
17
24
|
customLightTheme?: Partial<ThemeType>;
|
|
18
25
|
customDarkTheme?: Partial<ThemeType>;
|
|
19
26
|
dark?: boolean;
|
|
27
|
+
forceRTL?: boolean;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
// Provider component
|
|
23
|
-
export const
|
|
31
|
+
export const RelatedProvider: React.FC<RelatedProviderProps> = ({
|
|
24
32
|
children,
|
|
25
33
|
customLightTheme,
|
|
26
34
|
customDarkTheme,
|
|
27
|
-
dark
|
|
35
|
+
dark,
|
|
36
|
+
forceRTL,
|
|
28
37
|
}) => {
|
|
29
38
|
// Use system preference as initial value
|
|
30
|
-
const [isDark, setIsDark] = useState<boolean>(
|
|
39
|
+
const [isDark, setIsDark] = useState<boolean>(
|
|
40
|
+
dark || useColorScheme() === "dark"
|
|
41
|
+
);
|
|
42
|
+
const currentIsRTL = typeof forceRTL === "boolean" ? forceRTL : false;
|
|
31
43
|
|
|
32
44
|
// Allow custom themes to override defaults
|
|
33
45
|
const [themes, setThemes] = useState({
|
|
@@ -35,10 +47,17 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
|
|
|
35
47
|
dark: { ...darkTheme, ...customDarkTheme } as ThemeType,
|
|
36
48
|
});
|
|
37
49
|
|
|
38
|
-
const
|
|
50
|
+
const currentTheme = isDark ? themes.dark : themes.light;
|
|
51
|
+
|
|
52
|
+
const contextValue: RelatedContext = {
|
|
53
|
+
theme: currentTheme,
|
|
54
|
+
isRTL: currentIsRTL,
|
|
55
|
+
};
|
|
39
56
|
|
|
40
57
|
return (
|
|
41
|
-
<ThemeContext.Provider value={
|
|
58
|
+
<ThemeContext.Provider value={contextValue}>
|
|
59
|
+
{children}
|
|
60
|
+
</ThemeContext.Provider>
|
|
42
61
|
);
|
|
43
62
|
};
|
|
44
63
|
|