React native TypeError:undefined不是对象(正在计算“\u expo.default.FileSystem”)]

React native TypeError:undefined不是对象(正在计算“\u expo.default.FileSystem”)],react-native,expo,React Native,Expo,我正在尝试将数据库文件从assets导入expo。但它就是不起作用,并返回我以下警告: TypeError:undefined不是计算“\u expo.default.FileSystem”的对象 我尝试过很多次,如果我创建一个新的数据库,它可以工作,但如果我尝试从资产加载一个现有的数据库,它将无法工作 类项扩展了React.Component{ 状态={ 项目:空 }; componentDidMount=async=>{ 等待Expo.FileSystem.downloadAsync Exp

我正在尝试将数据库文件从assets导入expo。但它就是不起作用,并返回我以下警告:

TypeError:undefined不是计算“\u expo.default.FileSystem”的对象

我尝试过很多次,如果我创建一个新的数据库,它可以工作,但如果我尝试从资产加载一个现有的数据库,它将无法工作

类项扩展了React.Component{ 状态={ 项目:空 }; componentDidMount=async=>{ 等待Expo.FileSystem.downloadAsync Expo.Asset.fromModulerequire./assets/exu-word.db.uri, `${Expo.FileSystem.documentDirectory}SQLite/exu-word.db` ; 设db1=SQLite.openDatabaseexu-word.db; }; 渲染{ const{items}=this.state; 如果items==null | | items.length==0{ 返回null; } 回来 {items.map{id,words}=> this.props.onPressItem&&this.props.onPressItemid} 风格={{ 背景颜色:fff, 边框颜色:000, 边框宽度:1, 填充:8 }} > {words} } ; } 更新{ db.transactiontx=>{ tx.executeSql `从单词中选择*,`, [], _,{rows:{u array}=>this.setState{items:{u array} ; }; } } 我使用的是sdkVersion:35.0.0。世博会似乎改变了它的API。 现在,您需要安装一个单独的依赖项:

npm i --save expo-file-system
然后为组件独立导入文件系统对象:

import * as FileSystem from 'expo-file-system';