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

    switch (nightModeFlags) {
        case Configuration.UI_MODE_NIGHT_YES:

        case Configuration.UI_MODE_NIGHT_NO:
        case Configuration.UI_MODE_NIGHT_UNDEFINED:

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