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

iOS 15 keyboard numpad accepts off numbers and cannot disable it #435

Closed
gabimoncha opened this issue Dec 14, 2021 · 5 comments
Closed

iOS 15 keyboard numpad accepts off numbers and cannot disable it #435

gabimoncha opened this issue Dec 14, 2021 · 5 comments

Comments

@gabimoncha
Copy link

Describe the bug
Since iOS 15 you can tap on the wheel to call the keyboard and type the time. There is no way to disable it and also you can type out of range numbers.

RPReplay_Final1639473156.MP4

Expected behavior
Need a way to disable numpad if possible, restrict typing to hour - minute range.

To Reproduce
Add example code that reproduces the behavior.

export default class App extends Component {

  state = { date: new Date() }

  render = () =>
    <DatePicker
      maximumDate={getMaximumDate()}
      mode="datetime"
      date={this.state.date}
      onDateChange={date => this.setState({ date })}
    />

}

Smartphone (please complete the following information):

  • OS: iOS
  • React Native version: 0.64.2
  • react-native-date-picker version: 4.1.3
@henninghall
Copy link
Owner

Did some investigation but unfortunately this doesn't seem to be possible due to limitations of UIDatePicker. It isn't much written about it but if anyone finds a way to solve this, please let me know.

@iGroza
Copy link

iGroza commented Feb 17, 2022

@henninghall hi, I fixed this issue, by handling UIControlEventEditingDidBegin event.

DatePicker.m

- (instancetype)initWithFrame:(CGRect)frame
{
    if ((self = [super initWithFrame:frame])) {
        [self addTarget:self action:@selector(handleDatePickerTap) forControlEvents:UIControlEventEditingDidBegin];
        // ^^^^ added this line to initWithFrame

...

- (void)handleDatePickerTap  {
    [self resignFirstResponder];
}

@henninghall
Copy link
Owner

Oh that's great! Do you mind creating a PR?

@henninghall
Copy link
Owner

Thanks for the PR @iGroza! Just for my understanding. Could it be reasons for keeping this feature for some use cases? (we could create a prop) or is this just broken for everyone you mean?

I though that it is probably a reason for the feature to be introduced? 🤔

@gabimoncha
Copy link
Author

I agree to have it as a prop. Apple thinks it's a feature, while some designers / PMs think it's a bug :P

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

Successfully merging a pull request may close this issue.

3 participants