Move toast showing function to helper
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import Toast from 'react-native-simple-toast'
|
||||||
|
|
||||||
|
export const showToast = (text) => Toast.show(
|
||||||
|
text, Toast.SHORT, ['RCTModalHostViewController', 'UIAlertController']
|
||||||
|
)
|
||||||
@@ -2,7 +2,6 @@ import React, { Component } from 'react'
|
|||||||
import RNFS from 'react-native-fs'
|
import RNFS from 'react-native-fs'
|
||||||
import { Alert } from 'react-native'
|
import { Alert } from 'react-native'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Toast from 'react-native-simple-toast'
|
|
||||||
|
|
||||||
import Button from '../../common/button'
|
import Button from '../../common/button'
|
||||||
|
|
||||||
@@ -10,6 +9,7 @@ import ConfirmWithPassword from '../common/confirm-with-password'
|
|||||||
import alertError from '../common/alert-error'
|
import alertError from '../common/alert-error'
|
||||||
|
|
||||||
import { clearDb, isDbEmpty } from '../../../db'
|
import { clearDb, isDbEmpty } from '../../../db'
|
||||||
|
import { showToast } from '../../helpers/general'
|
||||||
import { hasEncryptionObservable } from '../../../local-storage'
|
import { hasEncryptionObservable } from '../../../local-storage'
|
||||||
import settings from '../../../i18n/en/settings'
|
import settings from '../../../i18n/en/settings'
|
||||||
import { shared as sharedLabels } from '../../../i18n/en/labels'
|
import { shared as sharedLabels } from '../../../i18n/en/labels'
|
||||||
@@ -70,7 +70,7 @@ export default class DeleteData extends Component {
|
|||||||
clearDb()
|
clearDb()
|
||||||
}
|
}
|
||||||
await this.deleteExportedFile()
|
await this.deleteExportedFile()
|
||||||
Toast.show(success.message, Toast.LONG)
|
showToast(success.message)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alertError(errors.couldNotDeleteFile)
|
alertError(errors.couldNotDeleteFile)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user