Skip to content

Commit b88011f

Browse files
authored
Merge pull request #1 from TVGSoft/feature/feat-year-calendar-independent-scroll
feat: add custom scroll and allow editing button
2 parents bc91441 + 8122aea commit b88011f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/Date/DatePickerModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export function DatePickerModalContent(
165165
locale={locale}
166166
editIcon={props.editIcon}
167167
calendarIcon={props.calendarIcon}
168+
allowEditing={props.allowEditing || true}
168169
/>
169170
</DatePickerModalHeaderBackground>
170171

src/Date/DatePickerModalContentHeader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface HeaderPickProps {
1919
editIcon?: string
2020
calendarIcon?: string
2121
closeIcon?: string
22+
allowEditing?: boolean
2223
}
2324

2425
export interface HeaderContentProps extends HeaderPickProps {
@@ -60,12 +61,13 @@ export default function DatePickerModalContentHeader(
6061
uppercase,
6162
editIcon = 'pencil',
6263
calendarIcon = 'calendar',
64+
allowEditing,
6365
} = props
6466

6567
const label = getLabel(props.locale, props.mode, props.label)
6668

6769
const color = useHeaderTextColor()
68-
const allowEditing = mode !== 'multiple'
70+
const isAllowEditing = allowEditing && mode !== 'multiple'
6971
return (
7072
<View style={[styles.header]}>
7173
<View>
@@ -89,7 +91,7 @@ export default function DatePickerModalContentHeader(
8991
</View>
9092
</View>
9193
<View style={styles.fill} />
92-
{allowEditing ? (
94+
{isAllowEditing ? (
9395
<IconButton
9496
icon={collapsed ? editIcon : calendarIcon}
9597
accessibilityLabel={

src/Date/YearPicker.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { FlatList, StyleSheet, View } from 'react-native'
2+
import { FlatList, StyleSheet, View, ScrollView } from 'react-native'
33
import { Text, TouchableRipple, useTheme } from 'react-native-paper'
44
import { range } from '../utils'
55

@@ -47,6 +47,9 @@ export default function YearPicker({
4747
ref={flatList}
4848
style={styles.list}
4949
data={years}
50+
renderScrollComponent={(sProps) => {
51+
return <ScrollView {...sProps} />
52+
}}
5053
renderItem={({ item }) => (
5154
<Year
5255
year={item}

0 commit comments

Comments
 (0)