fix: replace require with import

This commit is contained in:
Ivan Vershigora 2024-04-09 22:36:59 +02:00
parent c0b75de5b0
commit c3b37d99a9
No known key found for this signature in database
GPG Key ID: DCCF7FB5ED2CEBD7
7 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import { Alert, Linking, PermissionsAndroid, Platform } from 'react-native';
import RNFS from 'react-native-fs';
import Share from 'react-native-share';
import LocalQRCode from '@remobile/react-native-qrcode-local-image';
import loc from '../loc';
import DocumentPicker from 'react-native-document-picker';
import { launchImageLibrary } from 'react-native-image-picker';
@ -8,8 +9,6 @@ import { isDesktop } from './environment';
import presentAlert from '../components/Alert';
import { readFile } from './react-native-bw-file-access';
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
const _shareOpen = async (filePath: string, showShareDialog: boolean = false) => {
return await Share.open({
url: 'file://' + filePath,

View File

@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
import BigNumber from 'bignumber.js';
import { Badge, Icon, Text } from 'react-native-elements';
import { Image, LayoutAnimation, Pressable, StyleSheet, TextInput, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
import dayjs from 'dayjs';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import confirm from '../helpers/confirm';
import { BitcoinUnit } from '../models/bitcoinUnits';
import loc, { formatBalanceWithoutSuffix, formatBalancePlain, removeTrailingZeros } from '../loc';
import { BlueText } from '../BlueComponents';
import dayjs from 'dayjs';
import { useTheme } from './themes';
import {
fiatToBTC,
@ -18,7 +19,8 @@ import {
satoshiToBTC,
updateExchangeRate,
} from '../blue_modules/currency';
dayjs.extend(require('dayjs/plugin/localizedFormat'));
dayjs.extend(localizedFormat);
class AmountInput extends Component {
static propTypes = {

View File

@ -3,7 +3,7 @@ import { StyleProp, ViewStyle } from 'react-native';
import ToolTipMenu from './TooltipMenu';
import loc from '../loc';
import { ActionIcons } from '../typings/ActionIcons';
const fs = require('../blue_modules/fs');
import * as fs from '../blue_modules/fs';
interface SaveFileButtonProps {
fileName: string;

View File

@ -6,6 +6,7 @@ import * as bip39 from 'bip39';
import bip38 from 'bip38';
import BIP32Factory from 'bip32';
import * as bitcoin from 'bitcoinjs-lib';
import BlueCrypto from 'react-native-blue-crypto';
import loc from '../loc';
import { BlueSpacing20, BlueCard, BlueText, BlueLoading } from '../BlueComponents';
@ -27,8 +28,6 @@ import * as fs from '../blue_modules/fs';
import SaveFileButton from '../components/SaveFileButton';
import * as BlueElectrum from '../blue_modules/BlueElectrum';
const BlueCrypto = require('react-native-blue-crypto');
const bip32 = BIP32Factory(ecc);
const styles = StyleSheet.create({

View File

@ -6,6 +6,7 @@ import { Alert, Image, Platform, StyleSheet, TextInput, TouchableOpacity, View }
import { CameraScreen } from 'react-native-camera-kit';
import { Icon } from 'react-native-elements';
import { launchImageLibrary } from 'react-native-image-picker';
import LocalQRCode from '@remobile/react-native-qrcode-local-image';
import { BlueLoading, BlueSpacing40, BlueText } from '../../BlueComponents';
import * as fs from '../../blue_modules/fs';
@ -18,8 +19,6 @@ import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
import loc from '../../loc';
import Base43 from '../../blue_modules/base43';
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
let decoder = false;
const styles = StyleSheet.create({

View File

@ -1,5 +1,6 @@
import { useNavigation } from '@react-navigation/native';
import dayjs from 'dayjs';
import calendar from 'dayjs/plugin/calendar';
import React, { useLayoutEffect, useState } from 'react';
import { FlatList, NativeSyntheticEvent, StyleSheet, View } from 'react-native';
import { BlueCard, BlueSpacing10, BlueText } from '../../BlueComponents';
@ -16,7 +17,8 @@ import { useTheme } from '../../components/themes';
import loc from '../../loc';
import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../models/fiatUnit';
import { useSettings } from '../../components/Context/SettingsContext';
dayjs.extend(require('dayjs/plugin/calendar'));
dayjs.extend(calendar);
const Currency = () => {
const { setPreferredFiatCurrencyStorage } = useSettings();

View File

@ -0,0 +1,3 @@
declare module '@remobile/react-native-qrcode-local-image' {
export function decode(uri: string, callback: (error: any, result: string) => void): void;
}