Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If IOS is forced to dark mode, userInterfaceStyle prop doesnt override it. #236

Open
hani-q opened this issue Aug 12, 2021 · 8 comments
Open

Comments

@hani-q
Copy link

hani-q commented Aug 12, 2021

 props.showActionSheetWithOptions(
            {
                options: calcValArray,
                destructiveButtonIndex: _.indexOf(
                    calcValArray,
                    prayerSettings.caclMethod,
                ),
                cancelButtonIndex: 0,
                useModal: true,
                userInterfaceStyle: 'light',
            },
            (buttonIndex) => {
                if (buttonIndex !== 0)
                    setCalcMethod(
                        calcValArray[buttonIndex],
                    );
            },
        );

in the above example IOS physical phone is forced to Dark Mode. But if sheet is opened with light interfaceStyle. it still opens as dark.

@bradbyte
Copy link
Collaborator

bradbyte commented Sep 7, 2021

@hani-q Are you able to replicate this with the out of box react ActionSheetIOS? We're just passing the prop through to them. Thanks.

@david50407
Copy link

@bradbyte nop, this only happens with this library, if I passed userInterfaceStyle to react-native's ActionSheetIOS, it works well.

@david50407
Copy link

david50407 commented Sep 10, 2021

And the wired thing is:

If I open the just-installed node_modules/@expo/react-native-action-sheet/lib/module/ActionSheet/index.ios.js and save with formatter without modifing any codes maunally, it works again. (And it works even I change back until I re-install the whole package)

This also happened in node_modules/@expo/react-native-action-sheet/lib/module/ActionSheet/ActionGroup.js which should show destructive color on destructive button on Android, but it won't work before I do this TRICK.

This might only happens in dev mode (with online metro bundler).
In production mode (with pre-built bundled js), it seems well.

I'm not sure this is a bundler bug in this package or the issue is on the react-native side.

@bradbyte
Copy link
Collaborator

@david50407 So are you saying that in production the ActionSheet uses the correct style, but only when developing locally it has the issue? It could be an issue with caching... perhaps deleting the dependency from your node_modules and and then reinstalling, or running expo with expo start --clear to reset it's cache too. If you put the app in production mode locally does it work again?

Thank you!

@david50407
Copy link

@bradbyte Yes, I faced this issue only in development mode, but after I clean cache, the problem still happens.
I tried many times to deleting node_module/, cleaning up caches (npx react-native start --reset-cache), reinstalling @expo/react-native-action-sheet, but nothing helps. Until I do the trick "re-save files in node_modules/@expo/react-native-action-sheet/lib/module".
I know, this is so weird though.

btw, I'm using React Native without expo and yarn (I use npm instead), if this is also important information to you.

@francismarcus
Copy link

Facing somewhat of a similar issue.

userInterfaceStyle: 'dark'

Is being displayed as light.
Clearing the cache does not help nor does removing the package and reinstalling.
However, when ejecting from Expo the issue is gone.

@bradbyte
Copy link
Collaborator

I did some digging and found this works as expected when your view is wrapped in a Modal. I remember something like this effecting other native pickers... where the expo userInterfaceStyle was overriding the view but when you are in a modal it's a separate layer and isn't being "forced".

@ryan-reichenberg
Copy link

This doesn't work in expo go regardless of whether the view is wrapped in a modal. What I did find is if you "force" the userInterfaceStyle in the app.json file. It should filter through to react-native-action-sheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants