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.
@@ -83,14 +83,19 @@ const Button: FC<ButtonProps> = ({
83
83
  }
84
84
  ]}
85
85
  >
86
- <Text
87
- {...textProps}
88
- color={accent === "primary" ? "#fff" : color}
89
- style={styles.text}
90
- weight='600SemiBold'
91
- >
92
- {children}
93
- </Text>
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
  };
@@ -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;
@@ -34,7 +34,6 @@ const Separator: React.FC<SeparatorProps> = ({
34
34
  });
35
35
  toReturn = parseInt(toReturn.join(""));
36
36
  theWidth = toReturn / 100 * Dimensions.get('screen').width;
37
- console.log(theWidth);
38
37
  }
39
38
  return (
40
39
  <Inline justifyContent="center">
@@ -25,7 +25,6 @@ const Switch: React.FC<SwitchProps> = ({
25
25
  if (onChange) {
26
26
  onChange();
27
27
  }
28
- console.log('hehe');
29
28
  }}
30
29
  >
31
30
  <Inline
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
- if (config.appLangs.default !== null) {
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[config.appLangs.default]);
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.21",
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": "^18.0.0",
12
- "react-native": "^0.74.2"
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",
@@ -1,6 +1,7 @@
1
1
  // ./scripts/generateConfig.js
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
+ const { exec } = require('child_process');
4
5
 
5
6
  // Define the config file content
6
7
  const configContent = `const config = {