Здравствуйте. Пытаюсь разобраться в React Native под Android. Удалось все настроить, запустить. App.js, который генерируется при создании проекта - работает. Сообщение выводится на экран телефона через Expo.
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Привет!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Но, если я пытаюсь скомпилировать код из официальной документации http://reactnativedocs.ru/docs/tutorial.html
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
class HelloWorldApp extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
То появляется ошибка
12:05:27: Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.
Check the render method of
AwakeInDevApp
. in AwakeInDevApp (at registerRootComponent.js:33) in ExpoRootComponent (at renderApplication.js:35) in RCTView (at View.js:113) in View (at AppContainer.js:100) in RCTView (at View.js:113) in View (at AppContainer.js:121) in AppContainer (at renderApplication.js:34)
Подскажите, в чем может быть проблема?