The Material Time Picker component crashes on Android during app background/foreground cycle
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- android, javascript, react-native
- Bereich
- mobile
Rechercherichtung
Start by tracing the Android Material time picker flow in RNMaterialTimePicker.kt and MaterialTimePickerModule.kt, especially the show call in the stack trace and how opening is scheduled. Reproduce the background/foreground interruption on Android with the provided steps. Done means returning to the app after interrupting the dialog no longer crashes.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug report
Summary
Using the Material Design time picker in my Android app causes a crash when the user switches to another app or locks the device while the time picker dialog is opening or open, and then go back to my app.
Expected Behavior:
The app should resume gracefully without crashing, even if the time picker dialog was interrupted or not fully shown.
Actual Behavior:
The app crashes when returning from background after attempting to open the time picker.
Steps to reproduce
- I open a screen with the time picker
- I tap a button that opens the time picker
- I press the home button before the picker fully appears
- When I return to my app, it crashes
Code -
const DateTimePicker: React.FC<DateTimePickerProps> = ({
testID,
value,
mode,
display,
onChange,
style,
minimumDate,
maximumDate,
is24Hour = false,
androidProps = {},
}) => {
const {title, positiveButton, negativeButton} = androidProps;
return (
<View style={styles.container}>
<DateTimeSelector
testID={testID}
value={value}
mode={mode}
display={display}
design="material"
onChange={onChange}
title={title}
positiveButton={positiveButton}
negativeButton={negativeButton}
style={style}
minimumDate={minimumDate}
maximumDate={maximumDate}
is24Hour={is24Hour}
/>
</View>
);
};
now I'm using above component as in our app screen ->
<DateTimePicker
testID={'DATE_TIME_PICKER'}
value={get.selectedDate}
mode="time"
display={get.isAndroid ? 'clock' : 'spinner'}
maximumDate={get.maximumDate}
onChange={set.handleTimeChange}
is24Hour={get.is24HourFormat}
style={styles.dateTimePicker}
androidProps={{
title: t('selectTime'),
positiveButton: {label: t('Button.ok')},
negativeButton: {label: t('Button.cancel')},
}}
/>
Error
androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:341)
androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:306)
androidx.fragment.app.DialogFragment.show (DialogFragment.java:507)
com.reactcommunity.rndatetimepicker.RNMaterialTimePicker.show (RNMaterialTimePicker.kt:109)
com.reactcommunity.rndatetimepicker.RNMaterialTimePicker.open (RNMaterialTimePicker.kt:29)
com.reactcommunity.rndatetimepicker.MaterialTimePickerModule.open$lambda$0 (MaterialTimePickerModule.kt:46)
com.reactcommunity.rndatetimepicker.MaterialTimePickerModule.$r8$lambda$Fd7Bz8i6zmNahyMJIHFgC8wqsHw
com.reactcommunity.rndatetimepicker.MaterialTimePickerModule$$ExternalSyntheticLambda0.run (D8$$SyntheticClass)
android.os.Handler.handleCallback (Handler.java:958)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loopOnce (Looper.java:230)
android.os.Looper.loop (Looper.java:319)
Environment
- @react-native-community/datetimepicker: 8.4.1
- React Native: v0.76.6
- Android: 14
- Vorherrschende Sprache
- JavaScript
- Sterne
- 2.9k
- Forks
- 459
- Ø Merge
- 4 T. 16 Std.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus react-native-datetimepicker/datetimepicker
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
react-native-datetimepicker/datetimepicker#1070 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
-
DateTimePickerAndroid.open() throws "Cannot read property" error on RN 0.78.3 new architectureOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
react-native-datetimepicker/datetimepicker#1047 · 6 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
react-native-datetimepicker/datetimepicker#1046 · 1 Kommentar ·
Alle Issues in react-native-datetimepicker/datetimepicker
Ähnliche Issues
-
Administration: required plugin configuration field stays invalid after restoring its saved valueOffenneeds-triage Platform(Default)
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
nearform/ag-grid-url-sync#314 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
chore
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
idean3885/claude-ops-agent#910 ·
Maintainer antworten meist innerhalb von 1 Tag
-
S: triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
oskarrough/agent-ide#29 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag