LoginSignup
2
1

More than 5 years have passed since last update.

React Nativeの赤いエラー画面が心臓に悪いので色を変える

Last updated at Posted at 2018-10-22

ReactNativeの赤いエラー画面、心臓に悪いですよね。
こんなIssueが報告されるほどです。

Serious problem related to our health!!! Need to change the colour of error screen!
https://github.com/facebook/react-native/issues/11048

スクリーンショット 2018-10-22 18.46.39.png

以下の手順で赤いエラー画面の色を変えることができました。

  • Xcodeでプロジェクトを開く
  • self.backgroundColorで検索する
  • RCTRedBox.mを開き、
self.backgroundColor = [UIColor colorWithRed:0.8 green:0 blue:0 alpha:1];

を探す。(0.53.3の場合は52行目にありました。)

スクリーンショット 2018-10-22 18.47.43.png

  • 好きな色を登録する。
[UIColor colorWithRed:(0/255.0) green:(71/255.0) blue:(143/255.0) alpha:1.0];

Objective-CはRGBの指定を 0.0-1.0 で指定します。上の例は #00478F 相当です。

スクリーンショット 2018-10-22 18.39.18.png

以上です。それでは心臓に良いReactNativeライフを!!

参考 iPhoneアプリ開発虎の巻 UIColor
https://iphone-tora.sakura.ne.jp/uicolor.html

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1