@@ -3,24 +3,28 @@ import { View, StyleSheet } from 'react-native'
33import { MD2Theme , Text , TouchableRipple , useTheme } from 'react-native-paper'
44import { useMemo } from 'react'
55import Color from 'color'
6- import { useSwitchColors } from './timeUtils'
6+ import { inputTypes , PossibleInputTypes , useSwitchColors } from './timeUtils'
77import { DisplayModeContext } from './TimePicker'
88
99export default function AmPmSwitcher ( {
1010 onChange,
1111 hours,
12+ inputType,
1213} : {
1314 hours : number
14- onChange : ( newHours : number ) => any
15+ onChange : ( newHours : number ) => any ,
16+ inputType : PossibleInputTypes
1517} ) {
1618 const { setMode, mode } = React . useContext ( DisplayModeContext )
1719 const theme = useTheme ( )
1820 const backgroundColor = useMemo < string > ( ( ) => {
19- if ( theme . dark ) {
20- return Color ( theme . colors . surface ) . lighten ( 1.2 ) . hex ( )
21+ if ( theme . isV3 ) {
22+ return theme . colors . outline
2123 }
2224 return Color (
23- theme . isV3 ? theme . colors . inverseOnSurface : theme . colors . surface
25+ theme . dark
26+ ? Color ( theme . colors . surface ) . lighten ( 1.2 ) . hex ( )
27+ : theme . colors . surface
2428 )
2529 . darken ( 0.1 )
2630 . hex ( )
@@ -31,9 +35,12 @@ export default function AmPmSwitcher({
3135 < View
3236 style = { [
3337 styles . root ,
38+ // eslint-disable-next-line react-native/no-inline-styles
3439 {
3540 borderColor : backgroundColor ,
36- borderRadius : theme . roundness ,
41+ borderRadius : theme . roundness * 2 ,
42+ height : inputType === inputTypes . keyboard ? 72 : 80 ,
43+ marginBottom : inputType === 'keyboard' ? 24 : 0 ,
3744 } ,
3845 ] }
3946 >
@@ -79,7 +86,7 @@ function SwitchButton({
7986 const { backgroundColor, color } = useSwitchColors ( selected )
8087
8188 let textFont = theme ?. isV3
82- ? theme . fonts . bodyMedium
89+ ? theme . fonts . titleMedium
8390 : ( theme as any as MD2Theme ) . fonts . medium
8491
8592 return (
@@ -114,14 +121,13 @@ function SwitchButton({
114121
115122const styles = StyleSheet . create ( {
116123 root : {
117- width : 50 ,
118- height : 80 ,
124+ width : 52 ,
119125 borderWidth : 1 ,
120126 overflow : 'hidden' ,
121127 } ,
122128 switchSeparator : {
123129 height : 1 ,
124- width : 48 ,
130+ width : 52 ,
125131 } ,
126132 switchButton : {
127133 flex : 1 ,
0 commit comments