react-native-boxes 1.4.1 → 1.4.2
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/package.json +1 -1
- package/src/Text.tsx +11 -1
package/package.json
CHANGED
package/src/Text.tsx
CHANGED
|
@@ -4,14 +4,24 @@ import { ThemeContext } from "./ThemeContext";
|
|
|
4
4
|
|
|
5
5
|
export type TextViewProps = TextProps & {
|
|
6
6
|
skipI18n?: boolean
|
|
7
|
+
value?: string
|
|
8
|
+
text?: string
|
|
7
9
|
}
|
|
8
10
|
export function TextView(props: TextViewProps) {
|
|
9
11
|
const theme = useContext(ThemeContext)
|
|
10
12
|
let children = props.children
|
|
13
|
+
let value = props.value
|
|
14
|
+
let text = props.text
|
|
11
15
|
if (theme.i18n && !props.skipI18n) {
|
|
12
16
|
if (children && typeof children == 'string') {
|
|
13
17
|
children = theme.i18n.t(children)
|
|
14
18
|
}
|
|
19
|
+
if (value) {
|
|
20
|
+
value = theme.i18n.t(value)
|
|
21
|
+
}
|
|
22
|
+
if (text) {
|
|
23
|
+
text = theme.i18n.t(text)
|
|
24
|
+
}
|
|
15
25
|
}
|
|
16
26
|
return (
|
|
17
27
|
<Text {...props}
|
|
@@ -20,7 +30,7 @@ export function TextView(props: TextViewProps) {
|
|
|
20
30
|
color: theme.colors.text,
|
|
21
31
|
padding: theme.dimens.space.sm
|
|
22
32
|
}, theme.styles.text, props.style]} >
|
|
23
|
-
{children}
|
|
33
|
+
{children || text || value}
|
|
24
34
|
</Text>
|
|
25
35
|
)
|
|
26
36
|
}
|