Changing root background color dynamically ?

I know we can change the root view of the native background in app.json. However, it’d be nice if we can change this dynamically.

It happens same in both android and iOS devices. When rotating the screen, or write a keyboard, you can see the different background colors.

It matters when you are supporting multiple themes like light and dark which is a key feature today.

I use to handle this in android like below in MainActivity.java.

    switch (nightModeFlags) {
        case Configuration.UI_MODE_NIGHT_YES:
            getWindow().getDecorView().setBackgroundColor(Color.parseColor("#222222"));
            break;

        case Configuration.UI_MODE_NIGHT_NO:
        case Configuration.UI_MODE_NIGHT_UNDEFINED:
            getWindow().getDecorView().setBackgroundColor(Color.WHITE);
            break;
    }

I’d like to handle them in iOS and android in managed expo. How would this be possible?