react-native-boxes 1.3.32 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.3.32",
3
+ "version": "1.4.2",
4
4
  "description": "A react native library for rapid development of UI using boxes",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/Input.tsx CHANGED
@@ -86,7 +86,7 @@ export function CompositeTextInputView(props: TextInputProps & {
86
86
  leftIcon?: 'edit' | string | React.Component,
87
87
  icon?: 'close' | 'eye' | string | React.Component,
88
88
  onIconPress?: ((event: GestureResponderEvent) => void) | undefined,
89
- textInputProps?: TextInputProps
89
+ textInputProps?: TextInputProps,
90
90
  }) {
91
91
  const theme = useContext(ThemeContext)
92
92
  const [text, setText] = useState(props.initialText)
@@ -148,6 +148,7 @@ export function CompositeTextInputView(props: TextInputProps & {
148
148
  }} name={props.leftIcon} />
149
149
  ) : props.leftIcon
150
150
 
151
+ const TextComponent = props.readOnly ? TextView : TextInputView
151
152
  return (
152
153
  <HBox style={[{
153
154
  paddingEnd: theme.dimens.space.md,
@@ -185,7 +186,7 @@ export function CompositeTextInputView(props: TextInputProps & {
185
186
 
186
187
  }}
187
188
  >{props.placeholder || ''}</TextView>}
188
- <TextInput
189
+ <TextComponent
189
190
  selectionColor={props.selectionColor || theme.colors.accent}
190
191
  secureTextEntry={props.secureTextEntry}
191
192
  placeholderTextColor={theme.colors.caption}
package/src/Modal.tsx CHANGED
@@ -420,6 +420,7 @@ export const DropDownView = (props: DropDownViewProps) => {
420
420
  }}
421
421
  >
422
422
  <CompositeTextInputView
423
+ readOnly={true}
423
424
  placeholder={props.title}
424
425
  {...props}
425
426
  value={getSelected()?.title || getSelected()?.id}
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
  }