Skip to content

Commit 96e42a3

Browse files
committed
Fix keyboard picker landscape being too wide.
1 parent 9eb93c7 commit 96e42a3

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/Time/TimePicker.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,24 @@ function TimePicker({
8484
<DisplayModeContext.Provider
8585
value={{ mode: displayMode, setMode: setDisplayMode }}
8686
>
87-
<View style={isLandscape ? styles.rootLandscape : styles.rootPortrait}>
87+
<View
88+
style={
89+
isLandscape
90+
? [
91+
styles.rootLandscape,
92+
{
93+
width:
94+
24 * 3 +
95+
96 * 2 +
96+
52 +
97+
(inputType === inputTypes.picker
98+
? circleSize
99+
: -circleSize),
100+
},
101+
]
102+
: styles.rootPortrait
103+
}
104+
>
88105
<TimeInputs
89106
inputType={inputType}
90107
hours={hours}
@@ -115,7 +132,6 @@ const styles = StyleSheet.create({
115132
flexDirection: 'row',
116133
alignItems: 'center',
117134
justifyContent: 'center',
118-
width: 24 * 3 + 96 * 2 + 52 + circleSize,
119135
},
120136
rootPortrait: {
121137
alignItems: 'center',

src/Time/TimePickerModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ import {
2727
reverseInputTypes,
2828
} from './timeUtils'
2929

30-
const supportedOrientations: any[] = [
30+
const supportedOrientations: (
31+
| 'portrait'
32+
| 'portrait-upside-down'
33+
| 'landscape'
34+
| 'landscape-left'
35+
| 'landscape-right'
36+
)[] = [
3137
'portrait',
3238
'portrait-upside-down',
3339
'landscape',
@@ -125,7 +131,6 @@ export function TimePickerModal({
125131
onRequestClose={onDismiss}
126132
presentationStyle="overFullScreen"
127133
supportedOrientations={supportedOrientations}
128-
//@ts-ignore
129134
statusBarTranslucent={true}
130135
>
131136
<>

0 commit comments

Comments
 (0)