I am following a tutorial online to learn how to use React.
The instructor made me create a project called albums
and modify the content of index.js
, however I get a black screen on the ios simulator.
What I did (following the instructor's details):
1) Create a new project react-native init-albums
2) Enter the project directory with cd albums
3) Run react-native run-ios
4) I can see on the simulator screen what is inside the file App.js (The initial screen of - I assume - any new React Native project).
Press Cmd+R to reload, Cmd+D or shake for dev menu etc.
5) Delete the content inside index.js
and replace it with:
import React from "react";
import { AppRegistry, Text } from "react-native";
const App = () => {
return <Text>Some Text</Text>;
};
AppRegistry.registerComponent("albums", () => App);
It should appear Some Text on the top left of the simulator BUT it does not. The screen is black.
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…