ripal-ui 1.0.21 → 1.0.71
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/elements/Button.tsx +13 -8
- package/elements/Inline.tsx +15 -3
- package/elements/Separator.tsx +0 -1
- package/elements/Switch.tsx +0 -1
- package/elements/Text.tsx +15 -3
- package/package.json +4 -3
- package/scripts/generateConfig.js +1 -0
package/elements/Button.tsx
CHANGED
|
@@ -83,14 +83,19 @@ const Button: FC<ButtonProps> = ({
|
|
|
83
83
|
}
|
|
84
84
|
]}
|
|
85
85
|
>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
{
|
|
87
|
+
typeof children === "string" ?
|
|
88
|
+
<Text
|
|
89
|
+
{...textProps}
|
|
90
|
+
color={accent === "primary" ? "#fff" : color}
|
|
91
|
+
style={styles.text}
|
|
92
|
+
weight='600SemiBold'
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</Text>
|
|
96
|
+
:
|
|
97
|
+
children
|
|
98
|
+
}
|
|
94
99
|
</TouchableOpacity>
|
|
95
100
|
);
|
|
96
101
|
};
|
package/elements/Inline.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Pressable, PressableProps, StyleSheet, ViewStyle } from "react-native";
|
|
2
|
+
import { Pressable, PressableProps, StyleSheet, View, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
interface InlineProps extends PressableProps {
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -18,7 +18,7 @@ const Inline: React.FC<InlineProps> = ({
|
|
|
18
18
|
onPress,
|
|
19
19
|
onLayout,
|
|
20
20
|
}) => {
|
|
21
|
-
return (
|
|
21
|
+
return onPress ? (
|
|
22
22
|
<Pressable
|
|
23
23
|
style={{
|
|
24
24
|
flexDirection: 'row',
|
|
@@ -32,7 +32,19 @@ const Inline: React.FC<InlineProps> = ({
|
|
|
32
32
|
>
|
|
33
33
|
{children}
|
|
34
34
|
</Pressable>
|
|
35
|
-
)
|
|
35
|
+
) :
|
|
36
|
+
<View
|
|
37
|
+
style={{
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems,
|
|
40
|
+
justifyContent,
|
|
41
|
+
gap,
|
|
42
|
+
...style,
|
|
43
|
+
}}
|
|
44
|
+
onLayout={onLayout}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</View>
|
|
36
48
|
};
|
|
37
49
|
|
|
38
50
|
export default Inline;
|
package/elements/Separator.tsx
CHANGED
package/elements/Switch.tsx
CHANGED
package/elements/Text.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
1
|
+
import React, { FC, useEffect, useState } from "react";
|
|
2
2
|
import { Text as RNText, TextStyle } from "react-native";
|
|
3
3
|
import { useFonts, Poppins_300Light, Poppins_400Regular, Poppins_500Medium, Poppins_600SemiBold, Poppins_700Bold, Poppins_900Black } from "@expo-google-fonts/poppins";
|
|
4
4
|
import config from "../config";
|
|
5
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
5
6
|
|
|
6
7
|
interface TextProps {
|
|
7
8
|
children: React.ReactNode;
|
|
@@ -35,13 +36,24 @@ const Text: FC<TextProps> = ({
|
|
|
35
36
|
Poppins_700Bold,
|
|
36
37
|
Poppins_900Black
|
|
37
38
|
});
|
|
39
|
+
const [lang, setLang] = useState(config.appLangs.default);
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
AsyncStorage.getItem('app_lang').then(appLang => {
|
|
43
|
+
if (appLang != null) {
|
|
44
|
+
console.log('setting to ', appLang);
|
|
45
|
+
setLang(appLang);
|
|
46
|
+
}
|
|
47
|
+
console.log(appLang);
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
if (lang !== null) {
|
|
40
52
|
const ogChildren = children;
|
|
41
53
|
if (typeof children === "string") {
|
|
42
54
|
children = children.split('.').reduce((acc, key) => {
|
|
43
55
|
return acc && acc[key] !== undefined ? acc[key] : ogChildren;
|
|
44
|
-
}, config.appLangs[
|
|
56
|
+
}, config.appLangs[lang]);
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripal-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "A collection of React elements and components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"postinstall": "node ./scripts/generateConfig.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"react": "
|
|
12
|
-
"react-native": "
|
|
11
|
+
"react": "18.3.1",
|
|
12
|
+
"react-native": "0.76.2",
|
|
13
|
+
"@react-native-async-storage/async-storage": "1.23.1"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@babel/cli": "^7.25.6",
|