Yama
Yama

Reputation: 431

Getting an entire black screen when running react-native run-ios

When running the code an emulator for an IOS phone is produced. The application launches but produces an entire black screen. The only way to see the text is by changing the color of the text. My code is seen in the bottom.

import React from "react";
import { AppRegistry, Text } from "react-native";

const App = () => {
 return <Text style={{ color: "red" }}>Some Text</Text>;
};

AppRegistry.registerComponent("albums", () => App);

From my understanding. The initial default should be a white background and the text should be in black. Hope someone can help me better understand what the issue might be. This is my first attempt with React Native although I do have some experience with React.

Thank you

Upvotes: 0

Views: 3685

Answers (1)

stever
stever

Reputation: 1241

You need to wrap text in a View like

<View style={{backgroundColor: 'white'}}>
  <Text style={{ color: "red" }}>Some Text</Text>
</View>

As for the default style being black text on white background, that's the case if you use react-native-init or Expo to generate the project.

Upvotes: 1

Related Questions