【发布时间】:2017-09-13 12:17:39
【问题描述】:
每当我尝试使用 react-native run-android 运行时,我都会收到此错误:
元素类型无效:应为字符串(用于内置组件) 或类/函数(用于复合组件)但得到:对象。
查看
AppContainer的渲染方法。
这是我发生错误的render方法:
render() {
return (
<Drawer
ref={(ref)=>this._drawer = ref}
type="displace"
content={<View style={{backgroundColor: "#000", height: 1000}}
/>}
onClose={this.closeDrawer.bind(this)}
onOpen={this.openDrawer.bind(this)}
openDrawerOffset={0.2}
>
<Navigator
ref={(ref) => this._navigator = ref}
configureScene={this.configureScene.bind(this)}
renderScene={this.renderScene.bind(this)}
/>
</Drawer>
)
}
这就是我导入的方式:
import { Drawer, View} from 'native-base'
import Navigator from 'react-native'
我也尝试了{Navigator},但它只是抛出了一个不同的错误,所以我认为现在导入没问题,但我认为问题出在其他地方!
【问题讨论】:
-
不是
import { NavigatorIOS } from 'react-native'吗? facebook.github.io/react-native/docs/navigatorios.html -
NavigatorIOS?我正在使用安卓。
-
有什么不同的错误?
-
它说它没有被导出,但没关系这个,因为我认为它在没有花括号的情况下是正确的。
标签: javascript android reactjs react-native import