question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DatePicker modal background color

See original GitHub issue

I have gone through these following points

Issue Description

node, npm, react-native, react and native-base version, expo version if used, xcode version

Expo v35.0.0

Expected behaviour

The date should be seen in order to select.

Actual behaviour

For iOS dark mode the date is not seen. Actually it is rendered but the color matches with modal’s background so can not be seen.

Steps to reproduce

Just a standard DatePicker code causes same experience if the code is tested with iOS dark-mode.

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { DatePicker } from 'native-base';

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { chosenDate: new Date() };

    this.setDate = this.setDate.bind(this);
  }
  setDate(newDate) {
    this.setState({ chosenDate: newDate });
  }
  render() {
    return (
      <View style={styles.container}>
        <Text />
        <Text />
        <Text />
        <DatePicker
          defaultDate={new Date(1976, 12, 23)}
          minimumDate={new Date(1940, 1, 1)}
          maximumDate={new Date(2040, 12, 31)}
          locale={'en'}
          timeZoneOffsetInMinutes={undefined}
          modalTransparent={false}
          animationType={'fade'}
          androidMode={'default'}
          placeHolderText="Select date"
          textStyle={{ color: 'green' }}
          placeHolderTextStyle={{ color: '#d3d3d3' }}
          onDateChange={this.setDate}
        />
        <Text>Date: {this.state.chosenDate.toString().substr(4, 12)}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
});

Is the bug present in both iOS and Android or in any one of them?

Problem is only for iOS in dark mode

Any other additional info which would help us debug the issue quicker.

###Important

Expo snack here: (https://snack.expo.io/@mehmetkaplan/native-base-datepicker-test)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
Kuhne1commented, Nov 8, 2019

I know it isn’t a solution, but for those looking for a temporary fix on their apps, you can add this to your AppDelegate.m. This will force light mode, for your application.

if (@available(iOS 13, *)) { self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; }

Source https://github.com/facebook/react-native/issues/26299

0reactions
MehmetKaplancommented, Mar 31, 2020

Closed as per the duplicate label

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change background color of Material Ui datepicker
In recent version of MUI (v5.3.1) I resolved this issue by adding sx={{ backgroundColor: 'white' }} to TextField in renderInput prop as ...
Read more >
Step by step guide on how to Change background and text ...
The android date time picker has a default background color of green and text color of black. While developing, it might become necessary...
Read more >
datepicker.scss
Modal */ .datepicker-modal { max-width: 325px; min-width: 300px; max-height: none; } ... cursor: pointer; background-color: transparent; border: none; ...
Read more >
UIDatePicker iOS 14 compact remove default background
I have exactly the same issue! The background color will change with any color except .white. If you choose: Code Block swift. datePicker.backgroundColor ......
Read more >
Date pickers – Material Design 3
M2: Date pickers had a drop shadow and different color mappings. New version of date picker with a colorful background, rounded corners, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found