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

Categories items multiply on colorScheme change in SwiftUI. #30

Open
Hollycene opened this issue Oct 10, 2023 · 1 comment
Open

Categories items multiply on colorScheme change in SwiftUI. #30

Hollycene opened this issue Oct 10, 2023 · 1 comment

Comments

@Hollycene
Copy link

Hollycene commented Oct 10, 2023

I noticed an unusual behavior where category items multiply when the colorScheme changes while the emojiPicker is open in SwiftUI using the .emojiPicker modifier. It appears that these categories multiply each time the colorScheme changes.
image

Minimal Reproducible Example:
XCode Version 14.2 (14C18), iOS 16.2

struct EmojiPickerTest: View {
    
    @State private var isEmojiPickerShown: Bool = false
    @State private var emoji: String = "😀"
    
    var body: some View {
        Button(emoji, action: { isEmojiPickerShown = true })
            .emojiPicker(isPresented: $isEmojiPickerShown,
                         selectedEmoji: $emoji)
    }
}

struct EmojiPickerTest_Previews: PreviewProvider {
    static var previews: some View {
        EmojiPickerTest()
    }
}

There is a workaround for the problem: manually dismiss the emojiPicker when colorScheme is changed using the onChange() modifier like this:

        .onChange(of: colorScheme, perform: { _ in
            isEmojiPickerShown = false
        })

However, I believe the issue is still worth mentioning.

@Jsmith4523
Copy link

Same issue I'm having and didn't know was already submitted. This appears to be a application state issue as well; as exiting then reopening the application with the view controller open will cause this issue as well

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

2 participants