Skip to content

Commit 7ca4d8e

Browse files
committed
Merge branch 'master' of https://github.com/SoyDiego/react-native-paper-dates into fix-modal-jump-on-open
2 parents 302f74e + 5f29b60 commit 7ca4d8e

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-paper-dates",
3-
"version": "0.18.16",
3+
"version": "0.18.17",
44
"description": "Performant Date Picker for React Native Paper",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/Date/DatePickerInput.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react'
22

3-
import { IconButton } from 'react-native-paper'
4-
import { StyleSheet } from 'react-native'
3+
import { TextInput } from 'react-native-paper'
54
import DatePickerModal from './DatePickerModal'
65
import { useLatest } from '../utils'
76
import type { DatePickerInputProps } from './DatePickerInput.shared'
@@ -32,11 +31,10 @@ function DatePickerInput(
3231
<DatePickerInputWithoutModal
3332
ref={ref}
3433
{...rest}
35-
inputButtons={
34+
inputButton={
3635
withModal ? (
37-
<IconButton
36+
<TextInput.Icon
3837
size={24}
39-
style={styles.calendarButton}
4038
icon={calendarIcon}
4139
disabled={rest.disabled}
4240
onPress={() => setVisible(true)}
@@ -79,8 +77,4 @@ function DatePickerInput(
7977
)
8078
}
8179

82-
const styles = StyleSheet.create({
83-
calendarButton: { position: 'absolute', right: 0, zIndex: 10 },
84-
})
85-
8680
export default React.forwardRef(DatePickerInput)

src/Date/DatePickerInputWithoutModal.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function DatePickerInputWithoutModal(
2020
hideValidationErrors,
2121
onValidationError,
2222
modal,
23-
inputButtons,
23+
inputButton,
2424
saveLabel,
2525
saveLabelDisabled,
2626
uppercase,
@@ -42,7 +42,7 @@ function DatePickerInputWithoutModal(
4242
endYear: DatePickerInputProps['endYear']
4343
inputEnabled: DatePickerInputProps['inputEnabled']
4444
}) => any
45-
inputButtons?: any
45+
inputButton?: React.ReactNode
4646
},
4747
ref: any
4848
) {
@@ -93,8 +93,8 @@ function DatePickerInputWithoutModal(
9393
keyboardAppearance={theme.dark ? 'dark' : 'default'}
9494
error={(!!error && !hideValidationErrors) || !!hasError}
9595
style={[styles.input, style]}
96+
inputButton={inputButton}
9697
/>
97-
{inputButtons}
9898
</View>
9999
{error && !hideValidationErrors ? (
100100
<HelperText type="error" visible={!!error}>
@@ -136,6 +136,8 @@ function getLabel({
136136
const styles = StyleSheet.create({
137137
root: {
138138
flexGrow: 1,
139+
justifyContent: 'center',
140+
alignItems: 'flex-start',
139141
},
140142
inputContainer: {
141143
flexGrow: 1,

src/TextInputMask.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ function escapeForRegExp(value: string): string {
1313

1414
function TextInputWithMask(
1515
{
16+
inputButton,
1617
onChangeText,
1718
onChange,
1819
value,
1920
mask,
2021
disabled,
2122
...rest
22-
}: React.ComponentProps<typeof TextInput> & { mask: string; value: string },
23+
}: React.ComponentProps<typeof TextInput> & {
24+
mask: string
25+
value: string
26+
inputButton: React.ReactNode
27+
},
2328
ref: any
2429
) {
2530
const [controlledValue, setControlledValue] = React.useState<string>(
@@ -79,6 +84,7 @@ function TextInputWithMask(
7984
onChange && onChange(e)
8085
}}
8186
maxLength={10}
87+
right={inputButton}
8288
/>
8389
)
8490
}

src/__tests__/Date/__snapshots__/AnimatedCrossView.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,7 +3859,9 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
38593859
<View
38603860
style={
38613861
{
3862+
"alignItems": "flex-start",
38623863
"flexGrow": 1,
3864+
"justifyContent": "center",
38633865
}
38643866
}
38653867
>

src/__tests__/Date/__snapshots__/CalendarEdit.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ exports[`renders CalendarEdit 1`] = `
1111
<View
1212
style={
1313
{
14+
"alignItems": "flex-start",
1415
"flexGrow": 1,
16+
"justifyContent": "center",
1517
}
1618
}
1719
>

src/__tests__/Date/__snapshots__/DatePickerInputWithoutModal.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ exports[`renders DatePickerInput 1`] = `
44
<View
55
style={
66
{
7+
"alignItems": "flex-start",
78
"flexGrow": 1,
9+
"justifyContent": "center",
810
}
911
}
1012
>

0 commit comments

Comments
 (0)