[REACT NATIVE] 다크모드 disable

테크33·2021년 12월 8일
0

react native

목록 보기
3/11
post-thumbnail

만드는 앱에서 항상 본래 디자인을 유지하기 위해서 다크모드를 막기로 결정했다.

Android

android > app > src > main > res > values > styles.xml

에서 AppTheme에 해당하는 style 부분을 다음과 같이 바꿔준다.

<!-- 기본적으로 Light 모드 => Light.NoActionBar -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:textColor">#000000</item>
    <!-- 다크모드 해제 -->
    <item name="android:forceDarkAllowed">false</item>
</style>

iOS

info.plist 에 다음과 같이 추가해준다.

<key>UIUserInterfaceStyle</key>
   <string>Light</string>

위와 같이 info.plist 에만 추가 해주는 방법 말고 다른 방법도 있다고 한다.
위 방법으로도 충분하겠지만 혹시 문제가 있다면 아래 방법도 있으니 시도해보자.

// AppDeletegate.m
if (@available(iOS 13.0, *)) {
    rootView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}

0개의 댓글