Skip to content

isDarkModeEnabled doesn't work on spinner in iOS #749

Open
@darshan-palm

Description

@darshan-palm

Hi! 👋

Firstly, thanks for your work on this project! 🙂

The prop "isDarkModeEnabled" doesn't have an effect on the internal Picker theme in iOS.
Here is the diff that solved my problem:

diff --git a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
index 6ef0b0a..89a5bb6 100644
--- a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
+++ b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
@@ -178,6 +178,7 @@ export class DateTimePickerModal extends React.PureComponent {
               display={display || "spinner"}
               {...otherProps}
               value={this.state.currentDate}
+              themeVariant={_isDarkModeEnabled ? 'dark' : 'light'}
               onChange={this.handleChange}
               // Recent versions @react-native-community/datetimepicker (at least starting with 6.7.0)
               // have a peculiar iOS behaviour where sometimes, for example in react-native Modal,

Activity

linked a pull request that will close this issue on Sep 10, 2024
nehresma

nehresma commented on Sep 10, 2024

@nehresma

Thanks for the pointer on this @darshan-palm. I've submitted a slightly modified PR that only sets this when not using the customPickerIOS prop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @nehresma@darshan-palm

      Issue actions

        isDarkModeEnabled doesn't work on spinner in iOS · Issue #749 · mmazzarolo/react-native-modal-datetime-picker