Skip to content

Commit b539191

Browse files
fix: improve debounce web + bugfix for calendar size on bigger screens
1 parent b444a14 commit b539191

File tree

9 files changed

+12847
-12376
lines changed

9 files changed

+12847
-12376
lines changed

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@
194194
088111A2EFDE239408F24072 /* Pods-example-tvOSTests.debug.xcconfig */,
195195
A4D9A97DF7C10CCBDCC91C0A /* Pods-example-tvOSTests.release.xcconfig */,
196196
);
197-
name = Pods;
198197
path = Pods;
199198
sourceTree = "<group>";
200199
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/ios/example/Info.plist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<string>UIInterfaceOrientationPortrait</string>
5151
<string>UIInterfaceOrientationLandscapeLeft</string>
5252
<string>UIInterfaceOrientationLandscapeRight</string>
53+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
5354
</array>
5455
<key>UIViewControllerBasedStatusBarAppearance</key>
5556
<false/>

example/src/App.tsx

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Linking,
88
Image,
99
Animated,
10+
StatusBar,
1011
// I18nManager,
1112
} from 'react-native';
1213
import {
@@ -20,6 +21,7 @@ import {
2021
useTheme,
2122
overlay,
2223
Paragraph,
24+
Portal,
2325
} from 'react-native-paper';
2426

2527
import {
@@ -72,7 +74,7 @@ function App({
7274
const [rangeExcludeOpen, setRangeExcludeOpen] = React.useState(false);
7375

7476
const [singleOpen, setSingleOpen] = React.useState(false);
75-
77+
const [customOpen, setCustomOpen] = React.useState(false);
7678
const onDismissTime = React.useCallback(() => {
7779
setTimeOpen(false);
7880
}, [setTimeOpen]);
@@ -89,6 +91,10 @@ function App({
8991
setSingleOpen(false);
9092
}, [setSingleOpen]);
9193

94+
const onDismissCustom = React.useCallback(() => {
95+
setCustomOpen(false);
96+
}, [setCustomOpen]);
97+
9298
const onChangeRange = React.useCallback(
9399
({ startDate, endDate }) => {
94100
setRangeOpen(false);
@@ -133,6 +139,10 @@ function App({
133139

134140
return (
135141
<>
142+
<StatusBar
143+
translucent={true}
144+
barStyle={dark ? 'dark-content' : 'light-content'}
145+
/>
136146
<ScrollView
137147
style={[
138148
styles.root,
@@ -256,37 +266,38 @@ function App({
256266
>
257267
Pick time
258268
</Button>
269+
<View style={styles.buttonSeparator} />
270+
<Button
271+
onPress={() => setCustomOpen(true)}
272+
uppercase={false}
273+
mode="outlined"
274+
style={styles.pickButton}
275+
>
276+
Custom modal
277+
</Button>
259278
</View>
260279
<Enter />
261280
</Animated.View>
262-
{Platform.OS === 'web' ? (
263-
<>
264-
<View style={styles.content}>
265-
<Title>Inside page</Title>
266-
</View>
267-
<Animated.View
268-
style={[
269-
styles.content,
270-
styles.contentShadow,
271-
styles.contentInline,
272-
{ backgroundColor },
273-
]}
274-
>
275-
<DatePickerModalContent
276-
// locale={'en'} optional, default: automatic
277-
mode="range"
278-
onDismiss={onDismissRange}
279-
startDate={range.startDate}
280-
endDate={range.endDate}
281-
onConfirm={onChangeRange}
282-
/>
283-
</Animated.View>
284-
</>
285-
) : null}
281+
286282
<Enter />
287283
<Enter />
288284
<Enter />
289285
</ScrollView>
286+
<Portal>
287+
{customOpen ? (
288+
<View style={[StyleSheet.absoluteFill, styles.customModal]}>
289+
<DatePickerModalContent
290+
// locale={'en'} optional, default: automatic
291+
mode="range"
292+
onDismiss={onDismissCustom}
293+
startDate={range.startDate}
294+
endDate={range.endDate}
295+
onConfirm={onChangeRange}
296+
/>
297+
</View>
298+
) : null}
299+
</Portal>
300+
290301
<DatePickerModal
291302
// locale={'en'} optional, default: automatic
292303
mode="range"
@@ -466,4 +477,23 @@ const styles = StyleSheet.create({
466477
enter: { height: 12 },
467478
label: { width: 100, fontSize: 16 },
468479
row: { paddingTop: 12, paddingBottom: 12, flexDirection: 'row' },
480+
customModal: {
481+
top: 12,
482+
left: 12,
483+
right: 12,
484+
bottom: 12,
485+
// borderTopRightRadius: 20,
486+
// borderBottomRightRadius: 20,
487+
backgroundColor: '#fff',
488+
overflow: 'hidden',
489+
shadowColor: '#000',
490+
shadowOffset: {
491+
width: 0,
492+
height: 2,
493+
},
494+
shadowOpacity: 0.25,
495+
shadowRadius: 3.84,
496+
497+
elevation: 5,
498+
},
469499
});

0 commit comments

Comments
 (0)