2017-10-06 86 views
0

我已经开始react-tutorial并得到了以下错误:的ReferenceError:找不到变量:ToolbarAndroid

enter image description here

组件的定义如下:

export default class CounterComponent extends Component{ 
    render() { 
     return (
      <View> 
       <ToolbarAndroid title="counter demo" /> 
        <Text> Counter Component 
        </Text> 
       </View> 
     ); 
    } } 

App.js包含以下其他代码然后输入:

export default class App extends Component<{}> { 
    render() { 
    return (
     <Counter/> 
    ); 
    } 
} 

我在根index.js但没有index.android.js有以下内容:

AppRegistry.registerComponent('VishnuTest',() => App); 

我不知道为什么它不能够找到ToolbarAndroid。它没有这个说法。

+0

你从反应本地导入ToolbarAndroid? – Raymond

回答

0

你必须在你的CounterComponent类导入此行

import {ToolbarAndroid} from 'react-native'; 

希望它会帮助你...

相关问题