Black screen after modifying index.js

前端 未结 1 1209
天涯浪人
天涯浪人 2020-12-11 09:48

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.

1条回答
  •  盖世英雄少女心
    2020-12-11 10:01

    You need to define a background color for you application. You should also import View from react-native

    import { AppRegistry, Text, View } from "react-native";
    
    const App = () => {
     return (
       
         Some Text
       
      );
    };
    

    The reason that it is black is because the in the AppDelegate.m the rootView backgroundColor has been changed in version 0.58.0

    In prior versions it was

    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
    

    It is now the following in 0.58.+

    rootView.backgroundColor = [UIColor blackColor];
    

    0 讨论(0)
提交回复
热议问题