-
Notifications
You must be signed in to change notification settings - Fork 400
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: Data picker "Confirm" button isn't clickable in some special case #357
Comments
Hey @LowerShotower , could you please provide a minimal reproducible example/repo? |
Hello @mmazzarolo , I've tested it, and yep, I have the same problem with example/repo |
Want to clarify if it was not clear. I tap on the date, and after that, I can't click on Confirm. It doesn't react for some reason |
I had opened PR that should fix this. |
@LowerShotower thanks for reporting. I can't test it now, but I'm wondering if it's a race condition caused by this check, that is made to disable the confirm button until it stops spinning 🤔 |
@mmazzarolo I had tested that, this is not the case, at least not for me. |
Thanks @fstojanac |
Yes, After I tap on the selected date, I can't click on the Confirm button, but I still can click on the Cancel button. Also, if I at first scroll dates and after that click on the selected date, the Confirm button also doesn't work. And if I select a date just by scrolling the wheel, all works fine. It happens on the real devices either |
The version of datetime-picker: "react-native-modal-datetime-picker": "^7.6.1", |
tested with react-native-modal-datetime-picker 8.1.3. still doesn't work |
Mind trying the following and report if it's working? // Define a custom confirm button component (so that it should always be enabled)
const CustomConfirmButton = ({ onPress }) => {
return (
<TouchableHighlight onPress={onPress}>
<Text>I should work</Text>
</TouchableHighlight>
);
};
// And pass it to the `react-native-modal-datetime-picker` component
<DateTimePickerModal
isVisible={isDatePickerVisible}
mode="date"
onConfirm={handleConfirm}
onCancel={hideDatePicker}
customConfirmButtonIOS={CustomConfirmButton} // here
/> If it's working, then the problem is in the "disabling" logic. |
Experiencing the same issue. The CustomConfirmButton works in my case. |
Thanks for reporting @cameronbell . I guess we have to remove the disabling logic (or make it an opt-in? doesn't make much sense though). |
I've also noticed some new activity in the |
I'm also having this issue. I implemented custom Confirm and Cancel buttons, it works, but sometimes those lock up as well. But if I remove all the styling, then it always works. const ConfirmButtonWrapper = styled.TouchableHighlight`
height: 57px;
border-top-width: ${StyleSheet.hairlineWidth}px;
background-color: transparent;
justify-content: center;
`;
const ConfirmButtonText = styled.Text`
color: ${p => p.theme.colors.primary};
text-align: center;
font-size: 20px;
`;
const CancelButtonWrapper = styled.TouchableHighlight`
height: 57px;
background-color: ${p => (p.theme.dark ? '#0E0E0E' : '#fff')};
justify-content: center;
border-radius: 13px;
margin-bottom: ${isIphoneX() ? 20 : 0}px;
`;
const CancelButtonText = styled(ConfirmButtonText)`
font-weight: 600;
`;
const ConfirmButton: ConfirmButtonComponent = ({ onPress, label }) => {
const theme = useTheme();
return (
<ConfirmButtonWrapper
onPress={onPress}
underlayColor={theme.dark ? '#444' : '#ebebeb'}>
<ConfirmButtonText>{label}</ConfirmButtonText>
</ConfirmButtonWrapper>
);
};
const CancelButton: CancelButtonComponent = ({ onPress, label }) => {
const theme = useTheme();
return (
<CancelButtonWrapper
onPress={onPress}
underlayColor={theme.dark ? '#444' : '#ebebeb'}>
<CancelButtonText>{label}</CancelButtonText>
</CancelButtonWrapper>
);
};
const DatePicker: React.FunctionComponent<DateTimePickerProps> = props => {
return (
<DateTimePickerModal
{...props}
customConfirmButtonIOS={ConfirmButton}
customCancelButtonIOS={CancelButton}
/>
);
};
export default DatePicker; |
Hey all, anyone willing to try #370 ? |
@mmazzarolo I think this is a good way to solve it. It's pretty unlikely that the user taps on confirm before the spinner stops spinning |
@sallar I hope so! The reason why we added that feature (ages ago) was specifically because users were pressing "Confirm" before it stopped spinning, lol. |
I am getting same error. I had upgraded to latest version. But same issue :( is there any solve way? |
@livefuture009 could you please try the PR I posted above?
Let me know if it works for you, so that I can publish it officially |
Thanks @mmazzarolo for the package! |
You should always use the default import 👍 |
Hi @mmazzarolo, I'm trying the PR but having some issues. After running yarn add, my package.json has changed to Thanks! |
@tannguyen16 I just released |
@mmazzarolo |
As above, I wrote @fstojanac' code on my code and it worked properly. |
@samslow I merged that PR as well since it seems to solve the issue for your use cases. |
@mmazzarolo I assume we're back to that old bug of getting the wrong datetime if the user taps confirm too fast... So it sounds like in order to resolve a UI issue we exposed a functionality issue again. |
@SudoPlz I think what you're mentioning is the issue that happens when you pick a date while scrolling the component -- which is a different issue from this one, right? |
Yep definitely different issues, but "fixing" this one, brought back that old bug, right? |
@SudoPlz Yeah, what I mean is: AFAIK, there's no way to solve this issue correctly without introducing other small UX bugs (the spinner fix also had other issue that were reported before this one) -- because, unfortunately, this buggy behaviour is something that happens at the native level. So, instead of patching it here and causing other issues, I prefer to keep it as it is instead of adding patches on top of other patches. |
Got it, that makes sense. Is there an issue open on the community picker right now? Do you know? They're probably not even aware of that super old bug. |
No idea 🤷 Maybe we can also add this info in the FAQs of the component? Let me know if you find a related issue. |
Yeah we should definitely add that to the FAQ. I'm currently trying to resolve the issue on the native side. |
@mmazzarolo ok I worked around the issue using a native method addition. Leaving it here in case someone wants to convert those 2 patches into the corresponding 2 PRs and fix that for everyone. |
@SudoPlz Amazing 🙌 |
I'm facing the same issue differently. I'm using a date picker in the Flatlist renderitem component. |
-Open Calendar and push on selected data or try to select another day (important point that you should not swipe dates, only click on dates)
-Try to Click on Confirm button => it will not react
Here is the link on video example
https://drive.google.com/file/d/1U96zmdoO2H-wtswY9YCoZzGz0BBbyavU/view
The text was updated successfully, but these errors were encountered: