Start moving select dropdowns to use menus
This commit is contained in:
parent
19ec8ac5e9
commit
e7e2f299da
24
Select.tsx
24
Select.tsx
|
@ -1,4 +1,5 @@
|
||||||
import {useTheme} from 'react-native-paper'
|
import {useState} from 'react'
|
||||||
|
import {Button, Menu, useTheme} from 'react-native-paper'
|
||||||
import RNPickerSelect from 'react-native-picker-select'
|
import RNPickerSelect from 'react-native-picker-select'
|
||||||
import {Item} from 'react-native-picker-select'
|
import {Item} from 'react-native-picker-select'
|
||||||
|
|
||||||
|
@ -12,18 +13,17 @@ export default function Select({
|
||||||
items: Item[]
|
items: Item[]
|
||||||
}) {
|
}) {
|
||||||
const {colors} = useTheme()
|
const {colors} = useTheme()
|
||||||
|
const [show, setShow] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RNPickerSelect
|
<Menu
|
||||||
style={{
|
style={{alignSelf: 'flex-start', justifyContent: 'flex-start'}}
|
||||||
placeholder: {
|
visible={show}
|
||||||
color: colors.primary,
|
onDismiss={() => setShow(false)}
|
||||||
},
|
anchor={<Button style={{alignSelf: 'flex-start'}}>{value}</Button>}>
|
||||||
}}
|
{items.map(item => (
|
||||||
value={value}
|
<Menu.Item title={item.label} onPress={() => onChange(item.value)} />
|
||||||
placeholder={{}}
|
))}
|
||||||
onValueChange={onChange}
|
</Menu>
|
||||||
items={items}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
Platform,
|
Platform,
|
||||||
View,
|
View,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import DeviceTimeFormat from 'react-native-device-time-format'
|
|
||||||
import DocumentPicker from 'react-native-document-picker'
|
import DocumentPicker from 'react-native-document-picker'
|
||||||
import {Button} from 'react-native-paper'
|
import {Button} from 'react-native-paper'
|
||||||
import {darkColors, lightColors} from './colors'
|
import {darkColors, lightColors} from './colors'
|
||||||
|
@ -62,9 +61,6 @@ export default function SettingsPage() {
|
||||||
})
|
})
|
||||||
if (Platform.OS !== 'android') return
|
if (Platform.OS !== 'android') return
|
||||||
NativeModules.AlarmModule.ignoringBattery(setIgnoring)
|
NativeModules.AlarmModule.ignoringBattery(setIgnoring)
|
||||||
DeviceTimeFormat.is24HourFormat().then(is24 => {
|
|
||||||
if (is24) setFormatOptions(['P', 'P, k:m', 'ccc k:m', 'k:m'])
|
|
||||||
})
|
|
||||||
}, []),
|
}, []),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user