react-native-boxes 1.4.22 → 1.4.24
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/Input.tsx +15 -11
- package/src/List.tsx +9 -7
package/package.json
CHANGED
package/src/Input.tsx
CHANGED
|
@@ -68,16 +68,7 @@ export function TextInputView(props: TextInputProps & {
|
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Note: if input is inside a ScrollView in heirarchy anywhere then add keyboardShouldPersistTaps={'handled'}
|
|
74
|
-
* to the scrollview else the icon click wont work
|
|
75
|
-
* In case, you textinput is getting hidden due to keyboard see https://stackoverflow.com/a/77563800/6865753
|
|
76
|
-
|
|
77
|
-
* @param props
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
export function CompositeTextInputView(props: TextInputProps & {
|
|
71
|
+
export type CompositeTextInputViewProps = TextInputProps & {
|
|
81
72
|
hint?: string,
|
|
82
73
|
alertText?: string,
|
|
83
74
|
alertTextColor?: string,
|
|
@@ -87,7 +78,17 @@ export function CompositeTextInputView(props: TextInputProps & {
|
|
|
87
78
|
icon?: 'close' | 'eye' | string | React.Component,
|
|
88
79
|
onIconPress?: ((event: GestureResponderEvent) => void) | undefined,
|
|
89
80
|
textInputProps?: TextInputProps,
|
|
90
|
-
|
|
81
|
+
onDone?: (txt: string) => void
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Note: if input is inside a ScrollView in heirarchy anywhere then add keyboardShouldPersistTaps={'handled'}
|
|
85
|
+
* to the scrollview else the icon click wont work
|
|
86
|
+
* In case, you textinput is getting hidden due to keyboard see https://stackoverflow.com/a/77563800/6865753
|
|
87
|
+
|
|
88
|
+
* @param props
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
export function CompositeTextInputView(props: CompositeTextInputViewProps) {
|
|
91
92
|
const theme = useContext(ThemeContext)
|
|
92
93
|
const [text, setText] = useState(props.initialText)
|
|
93
94
|
const [alerttext, setAlertText] = useState(props.alertText)
|
|
@@ -187,6 +188,9 @@ export function CompositeTextInputView(props: TextInputProps & {
|
|
|
187
188
|
}}
|
|
188
189
|
>{props.placeholder || ''}</TextView>}
|
|
189
190
|
<TextComponent
|
|
191
|
+
onSubmitEditing={(e) => {
|
|
192
|
+
props.onDone && props.onDone(text!)
|
|
193
|
+
}}
|
|
190
194
|
selectionColor={props.selectionColor || theme.colors.accent}
|
|
191
195
|
secureTextEntry={props.secureTextEntry}
|
|
192
196
|
placeholderTextColor={theme.colors.caption}
|
package/src/List.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { ActivityIndicator, Text, View, ViewProps } from "react-native"
|
|
|
2
2
|
import { Box, CardView, Center, HBox, VBox } from "./Box"
|
|
3
3
|
import { getIcon } from "./Image"
|
|
4
4
|
import { Icon } from "@expo/vector-icons/build/createIconSet"
|
|
5
|
-
import { Caption, Subtitle, TextView } from "./Text"
|
|
5
|
+
import { Caption, Subtitle, TextView, TitleText } from "./Text"
|
|
6
6
|
import { useContext } from "react"
|
|
7
7
|
import { ThemeContext } from "./ThemeContext"
|
|
8
8
|
import { PressableView } from "./Button"
|
|
@@ -49,10 +49,12 @@ export type SimpleDatatableViewItemProps = {
|
|
|
49
49
|
onPress?: () => void,
|
|
50
50
|
flexRatio?: [number, number, number]
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
|
|
52
54
|
export function SimpleDatatlistViewItem(props: SimpleDatatableViewItemProps & ViewProps) {
|
|
53
|
-
const
|
|
55
|
+
const Icon = getIcon(props.icon, true)
|
|
54
56
|
const theme = useContext(ThemeContext)
|
|
55
|
-
let flexRatio = props.flexRatio || [1,
|
|
57
|
+
let flexRatio = props.flexRatio || [1.5, 7.5, 1]
|
|
56
58
|
let [left, middle, right] = flexRatio
|
|
57
59
|
const ttl = left + right + middle
|
|
58
60
|
const percentages = {
|
|
@@ -80,7 +82,7 @@ export function SimpleDatatlistViewItem(props: SimpleDatatableViewItemProps & Vi
|
|
|
80
82
|
width: `${percentages.left}%`,
|
|
81
83
|
maxWidth: 30
|
|
82
84
|
}}>
|
|
83
|
-
{
|
|
85
|
+
{Icon && <Icon style={{
|
|
84
86
|
padding: theme.dimens.space.md,
|
|
85
87
|
paddingStart: 0,
|
|
86
88
|
}} />}
|
|
@@ -95,14 +97,14 @@ export function SimpleDatatlistViewItem(props: SimpleDatatableViewItemProps & Vi
|
|
|
95
97
|
justifyContent: 'flex-start',
|
|
96
98
|
alignContent: 'flex-start',
|
|
97
99
|
}}>
|
|
98
|
-
{props.title && (<
|
|
100
|
+
{props.title && (<TitleText style={{
|
|
99
101
|
marginBottom: 0,
|
|
100
102
|
paddingBottom: 0,
|
|
101
|
-
|
|
103
|
+
padding: 0,
|
|
104
|
+
}}>{props.title}</TitleText>)}
|
|
102
105
|
{props.subtitle && (<TextView style={{
|
|
103
106
|
marginTop: 0,
|
|
104
107
|
padding: 0,
|
|
105
|
-
paddingTop: theme.dimens.space.sm,
|
|
106
108
|
}}>{props.subtitle}</TextView>)}
|
|
107
109
|
{props.body && (<Caption style={{
|
|
108
110
|
margin: 0,
|