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.

Android: Picker does not show correctly when the mode prop changes

See original GitHub issue

Describe the bug On Android, when the mode prop changes, the UI shows a blank space with only the separator.

Expected behavior When the mode prop changes, the UI should show the correct picker for that mode.

Screenshots In the video below, the switch toggles the mode prop between "date" and "datetime". The initial value for mode is “date”, which shows correctly. But when the mode prop is changed to "datetime", it shows blank.

https://user-images.githubusercontent.com/4929170/138826099-26e774f8-e0e3-44bc-86e4-3a4a00229435.mp4

To Reproduce Add example code that reproduces the behavior.

export default class App extends Component {

  state = { date: new Date(), mode:  "date"}
  
  render = () => 
  <View>
    <Button title="Toggle" onPress={() => {
      if (this.state.mode === "date") {
        this.setState({ mode: "datetime" })
      } else {
        this.setState({ mode: "date" })
      }
    }} />
    <DatePicker
      mode={this.state.mode}
      date={this.state.date}
      onDateChange={date => this.setState({ date })}
    />
  <View>

}

Smartphone (please complete the following information):

  • OS: Android
  • React Native version: 0.63.4
  • react-native-date-picker version: 4.1.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
matijagrciccommented, Sep 1, 2022

Try using textColor property and set it to black explicitly, that worked on Pixel 6 Pro.

0reactions
nicktibericommented, Nov 7, 2022

Try using textColor property and set it to black explicitly, that worked on Pixel 6 Pro.

This fixes the issue if the phone is using dark mode, since the datepicker seems to use a white font when the phone is in dark mode, making it appear as if the datepicker is blank.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Picker: onValueChange triggers unintended ...
The state variable changes to the desired dropdown item for one render iteration and then automatically resets to the defaultPlaceholder value.
Read more >
react-native-community/datetimepicker - npm
Defines the maximum date that can be selected. Note that on Android, this only works for date mode because TimePicker does not support...
Read more >
<input type="color"> - HTML: HyperText Markup Language
The change event is fired when the user dismisses the color picker. In both cases, you can determine the new value of the...
Read more >
<activity> | Android Developers
All activities must be represented by {@code } elements in the manifest file. Any that are not declared there will not be seen...
Read more >
Notifications - Expo Documentation
This prompt will not appear until at least one notification channel is created ... app with eas build -p android or npx expo...
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