React Native Windows: value except only Date as object, onchange not triggered if unselect date
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- javascript, react-native, typescript
Piste de recherche
Start in the Windows picker implementation, datetimepicker.windows.js, and trace how sharedPropsValidation handles value and how onChange is called when the selected date is cleared. The report names utils.js as the validation location; check its tests and the Windows picker tests first. Done means null or undefined can be used as the value and clearing a date fires onChange; the issue has gone 873 days without a comment.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Bug report
Summary
datetimepicker.windows.js
- I want to set
undefinedornullas date value but it is prevented by validation. If i comment that line eveything is working fine. - If unselect the date in the datepicker by clicking on the current selected date, the onChange Event is never fired. So i never know how the state of the picker is.
Reproducible sample code
<DateTimePicker
style={styles.datePicker}
value={null} // NOT POSSIBLE to set NULL
display="calendar"
firstDayOfWeek={1}
onChange={(event: DateTimePickerEvent, date?: Date) => {
// NOT FIRED if unselect the date
}}
onError={(arg: Error) => console.log('GKU Date Error', arg)}/>
Steps to reproduce
--
Describe what you expected to happen:
- Null as initial value should be allows
- Validation for value in utils.js should be removed because it is already checked. And if i remove the init validation (sharedPropsValidation) everything works fine:
export default function RNDateTimePickerQWE(
props: WindowsNativeProps,
): React.Node {
sharedPropsValidation({value: props?.value}); // **REMOVING THIS LINE FIXES THE ISSUE**
const localProps = {
dayOfWeekFormat: props.dayOfWeekFormat,
dateFormat: props.dateFormat,
firstDayOfWeek: props.firstDayOfWeek,
maxDate: props.maximumDate ? props.maximumDate.getTime() : undefined, // time in milliseconds
minDate: props.minimumDate ? props.minimumDate.getTime() : undefined, // time in milliseconds
onChange: props.onChange,
placeholderText: props.placeholderText,
selectedDate: props.value ? props.value.getTime() : undefined, // time in milliseconds
style: [styles.rnDatePicker, props.style],
};
...
Environment info
npx react-native info output:
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 13.63 GB / 31.73 GB
Binaries:
Node:
version: 16.19.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 3.6.0
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 8.19.3
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.18362.0
- 10.0.19041.0
- 10.0.22000.0
- 10.0.22621.0
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio:
- 17.5.33502.453 (Visual Studio Community 2022)
- 16.11.33423.256 (Visual Studio Community 2019)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
react-native-windows:
installed: 0.72.7
wanted: 0.72.7
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
datetimepicker version: 4.5.0
React Native Windows
- Langage dominant
- JavaScript
- Étoiles
- 2.9k
- Forks
- 459
- Merge moyen
- 4 j 16 h
- PR mergées (30 j)
- 5
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de react-native-datetimepicker/datetimepicker
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 58/100
react-native-datetimepicker/datetimepicker#1070 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
-
DateTimePickerAndroid.open() throws "Cannot read property" error on RN 0.78.3 new architectureOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
react-native-datetimepicker/datetimepicker#1047 · 6 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
react-native-datetimepicker/datetimepicker#1046 · 1 commentaire ·
Toutes les issues de react-native-datetimepicker/datetimepicker
Issues similaires
-
bug needs-triage potential-regression
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
aws/aws-sdk-js-v3#8408 ·
Les mainteneurs répondent en général sous 1 jour
-
[v3] KeyBindingManager calls (Add/Remove) are not converted into a case-insensitive accelerator.KeyOuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 4 jours
-
fix(docs): align git__gh troubleshooting with its actual failure pathsPeut-être pris @akhil9tiet l’a pris aujourd’hui. Ouvertebug docs p2
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
vercel/eve#6130 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100