iOS disable keyboard input for mode="time"
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, objective-c, react-native
调研方向
The proposed change targets ios/RNDateTimePicker.m; read its event registration and date picker responder handling first. The report says to resign the picker’s first responder when editing begins, preventing keyboard input in mode="time"; verify the behavior with the reported modal date picker and ensure normal time selection still works.
由索引模型根据 Issue 内容生成。
描述
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @react-native-community/[email protected] for the project I'm working on.
This disables the keyboard input on the mode="time" which many of our users thought is a bug :-/ and this doesn't play well with the https://github.com/mmazzarolo/react-native-modal-datetime-picker
Here is the diff that solved my problem:
diff --git a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
index 9c73c8e..efaa23f 100644
--- a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
+++ b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePicker.m
@@ -26,9 +26,9 @@
#ifndef RCT_NEW_ARCH_ENABLED
// somehow, with Fabric, the callbacks are executed here as well as in RNDateTimePickerComponentView
// so do not register it with Fabric, to avoid potential problems
- [self addTarget:self action:@selector(didChange)
- forControlEvents:UIControlEventValueChanged];
+ [self addTarget:self action:@selector(didChange) forControlEvents:UIControlEventValueChanged];
[self addTarget:self action:@selector(onDismiss:) forControlEvents:UIControlEventEditingDidEnd];
+ [self addTarget:self action:@selector(handleDatePickerTap) forControlEvents:UIControlEventEditingDidBegin];
#endif
_reactMinuteInterval = 1;
@@ -52,6 +52,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
}
}
+- (void)handleDatePickerTap
+{
+ [self resignFirstResponder];
+}
+
- (void)setDatePickerMode:(UIDatePickerMode)datePickerMode
{
[super setDatePickerMode:datePickerMode];
This issue body was partially generated by patch-package.
- 主要语言
- JavaScript
- 星标
- 2.9k
- 派生
- 459
- 平均合并
- 4 天 16 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-native-datetimepicker/datetimepicker 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 3/5 1-2 天 新手友好度 58/100
react-native-datetimepicker/datetimepicker#1070 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 55/100
react-native-datetimepicker/datetimepicker#1047 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
react-native-datetimepicker/datetimepicker#1046 · 1 条评论 ·
查看 react-native-datetimepicker/datetimepicker 的全部 Issue
相似的 Issue
-
Administration: required plugin configuration field stays invalid after restoring its saved value未关闭needs-triage Platform(Default)
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
nearform/ag-grid-url-sync#314 · 1 个 reaction ·
维护者通常 1 天内回复
-
chore
难度 2/5 1-3 小时 新手友好度 74/100
idean3885/claude-ops-agent#910 ·
维护者通常 1 天内回复
-
S: triage
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
oskarrough/agent-ide#29 · 1 条评论 ·
维护者通常 1 天内回复