Reorder import buttons depending on OS

This commit is contained in:
Liv
2024-01-16 18:10:34 +01:00
committed by bl00dymarie
parent 5e55a2e2ef
commit 1e56f4e3f4
@@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Alert } from 'react-native' import { Alert, Platform } from 'react-native'
import DocumentPicker from 'react-native-document-picker' import DocumentPicker from 'react-native-document-picker'
import rnfs from 'react-native-fs' import rnfs from 'react-native-fs'
import importCsv from '../../../lib/import-export/import-from-csv' import importCsv from '../../../lib/import-export/import-from-csv'
@@ -59,21 +59,28 @@ export default function ImportData({ resetIsDeletingData, setIsLoading }) {
function openImportDialog() { function openImportDialog() {
resetIsDeletingData() resetIsDeletingData()
Alert.alert(t('dialog.title'), t('dialog.message'), [
let buttons = [
{ {
text: t('dialog.cancel'), text: t('dialog.cancel'),
style: 'cancel', style: 'cancel',
onPress: () => {}, onPress: () => {},
}, },
{
text: t('dialog.delete'),
onPress: () => startImport(true),
},
{ {
text: t('dialog.replace'), text: t('dialog.replace'),
onPress: () => startImport(false), onPress: () => startImport(false),
}, },
]) {
text: t('dialog.delete'),
onPress: () => startImport(true),
},
]
if (Platform.OS === 'android') {
buttons = [buttons[0], buttons[2], buttons[1]]
}
Alert.alert(t('dialog.title'), t('dialog.message'), buttons)
} }
function showImportErrorAlert(message) { function showImportErrorAlert(message) {