2017-11-17 11 views
1

react-native-sqlite-storage 정의되지 않은 객체입니다 ('NativeModules [ "SQLite"] [method] ')react-native-sqlite-storage 정의되지 않음이 개체가 아닙니다 (NativeModules [ "SQLite"] [메서드]를 평가 중임)

react-native-sqlite-storage를 사용할 때이 오류가 발생합니다. 내 반응 네이티브 앱을 테스트하기 위해 엑스포를 사용하고 있습니다. 당신은 아마 안드로이드/애플 리케이션에 모든 것을 추가

import SQLite from 'react-native-sqlite-storage'; 
SQLite.DEBUG(true); 
SQLite.enablePromise(true); 
let db = SQLite.openDatabase(DataAccess.dbName, DataAccess.dbVersion, "Test Database", 200000, DataAccess.openCB, DataAccess.errorCB); 

답변

0

/SRC/메인/자바/COM // MainApplication.java 추가되어 있지 않은 경우 https://github.com/andpor/react-native-sqlite-storage 에 설명 된대로 :

import org.pgsqlite.SQLitePluginPackage; // Add import 

public class MainApplication extends Application implements ReactApplication { 
... 

    @Override 
    protected List<ReactPackage> getPackages() { 
     return Arrays.<ReactPackage>asList(
       new SQLitePluginPackage(), // register SQLite Plugin here 
       new MainReactPackage() 
    ); 
} 

당신이 한 경우 다시 한번 프로젝트를 재건하면 효과가 있습니다.