- SDK Version: 3.21.3
- Platforms(Android/iOS/web/all):Android/iOS
Hello, I’m trying to use the recipe described here:[SOLVED] Import asset DB
without any luck, below is App.js:
import React from ‘react’;
import { createStore, combineReducers, applyMiddleware } from ‘redux’;
import { Provider } from ‘react-redux’;
import initReducer from ‘./store/reducers/db’;
import ReduxThunk from ‘redux-thunk’;
import AppNavigator from ‘./navigation/AppNavigator’;
import * as FileSystem from ‘expo-file-system’;
import * as Asset from ‘expo-asset’;
const rootReducer = combineReducers({
init: initReducer
});
const store = createStore(rootReducer, applyMiddleware(ReduxThunk));
const makeSQLiteDirAsync = async () => {
const dbTest = SQLite.openDatabase(‘dummy.db’);
try {
await dbTest.transaction(tx => tx.executeSql(''));
} catch(e) {
if (this.state.debugEnabled) console.log('error while executing SQL in dummy DB');
};
};
export const initDictionaries = () => {
makeSQLiteDirAsync();
const dictionariesURI = Asset.fromModule(require(‘./assets/dictionaries.db’)).uri;
FileSystem.downloadAsync(
dictionariesURI,
`${FileSystem.documentDirectory}SQLite/dictionaries.db`
)
.then(function(){
const dbDictionaries = SQLite.openDatabase(‘dictionaries.db’);
})
};
export default function App() {
return (
<Provider store={store}>
<AppNavigator />
</Provider>
);
}
Every time I get message like that :
“Unable to resolve “./assets/dictionaries.db” from “App.js”
Failed building JavaScript bundle.”