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 {Item} from 'react-native-picker-select'
|
||||
|
||||
|
@ -12,18 +13,17 @@ export default function Select({
|
|||
items: Item[]
|
||||
}) {
|
||||
const {colors} = useTheme()
|
||||
const [show, setShow] = useState(false)
|
||||
|
||||
return (
|
||||
<RNPickerSelect
|
||||
style={{
|
||||
placeholder: {
|
||||
color: colors.primary,
|
||||
},
|
||||
}}
|
||||
value={value}
|
||||
placeholder={{}}
|
||||
onValueChange={onChange}
|
||||
items={items}
|
||||
/>
|
||||
<Menu
|
||||
style={{alignSelf: 'flex-start', justifyContent: 'flex-start'}}
|
||||
visible={show}
|
||||
onDismiss={() => setShow(false)}
|
||||
anchor={<Button style={{alignSelf: 'flex-start'}}>{value}</Button>}>
|
||||
{items.map(item => (
|
||||
<Menu.Item title={item.label} onPress={() => onChange(item.value)} />
|
||||
))}
|
||||
</Menu>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import {
|
|||
Platform,
|
||||
View,
|
||||
} from 'react-native'
|
||||
import DeviceTimeFormat from 'react-native-device-time-format'
|
||||
import DocumentPicker from 'react-native-document-picker'
|
||||
import {Button} from 'react-native-paper'
|
||||
import {darkColors, lightColors} from './colors'
|
||||
|
@ -62,9 +61,6 @@ export default function SettingsPage() {
|
|||
})
|
||||
if (Platform.OS !== 'android') return
|
||||
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