From b51bd41cb07635aa0c87c889a26e1c33ee6d2f08 Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Sun, 23 Nov 2025 13:46:52 -0500 Subject: [PATCH 1/3] fix(ios): internal picker state persisting with recycling --- ios/RNDateTimePicker.h | 2 ++ ios/RNDateTimePicker.m | 7 +++++++ ios/fabric/RNDateTimePickerComponentView.mm | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ios/RNDateTimePicker.h b/ios/RNDateTimePicker.h index 00dd45dc..db55cfdb 100644 --- a/ios/RNDateTimePicker.h +++ b/ios/RNDateTimePicker.h @@ -9,4 +9,6 @@ @interface RNDateTimePicker : UIDatePicker +- (void)reset; + @end diff --git a/ios/RNDateTimePicker.m b/ios/RNDateTimePicker.m index 9c73c8ef..debc7b0b 100644 --- a/ios/RNDateTimePicker.m +++ b/ios/RNDateTimePicker.m @@ -72,4 +72,11 @@ - (void)setDate:(NSDate *)date { } } +- (void)reset +{ + self.minimumDate = nil; + self.maximumDate = nil; + self.date = [NSDate date]; +} + @end diff --git a/ios/fabric/RNDateTimePickerComponentView.mm b/ios/fabric/RNDateTimePickerComponentView.mm index 3afc9c09..889af20f 100644 --- a/ios/fabric/RNDateTimePickerComponentView.mm +++ b/ios/fabric/RNDateTimePickerComponentView.mm @@ -40,9 +40,9 @@ @interface RNDateTimePickerComponentView () @end @implementation RNDateTimePickerComponentView { - UIDatePicker *_picker; + RNDateTimePicker *_picker; // Dummy picker to apply prop changes and calculate/update the size before the actual picker gets updated - UIDatePicker *_dummyPicker; + RNDateTimePicker *_dummyPicker; RNDateTimePickerShadowNode::ConcreteState::Shared _state; } @@ -119,6 +119,8 @@ - (void)prepareForRecycle { [super prepareForRecycle]; _state.reset(); + [_picker reset]; + [_dummyPicker reset]; } -(void)updateTextColorForPicker:(UIDatePicker *)picker color:(UIColor *)color From 53c735d54b722171dbfb04db703c2f8ca56b63e2 Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Mon, 24 Nov 2025 16:45:19 -0500 Subject: [PATCH 2/3] Revert "fix(ios): internal picker state persisting with recycling" This reverts commit b51bd41cb07635aa0c87c889a26e1c33ee6d2f08. --- ios/RNDateTimePicker.h | 2 -- ios/RNDateTimePicker.m | 7 ------- ios/fabric/RNDateTimePickerComponentView.mm | 6 ++---- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ios/RNDateTimePicker.h b/ios/RNDateTimePicker.h index db55cfdb..00dd45dc 100644 --- a/ios/RNDateTimePicker.h +++ b/ios/RNDateTimePicker.h @@ -9,6 +9,4 @@ @interface RNDateTimePicker : UIDatePicker -- (void)reset; - @end diff --git a/ios/RNDateTimePicker.m b/ios/RNDateTimePicker.m index debc7b0b..9c73c8ef 100644 --- a/ios/RNDateTimePicker.m +++ b/ios/RNDateTimePicker.m @@ -72,11 +72,4 @@ - (void)setDate:(NSDate *)date { } } -- (void)reset -{ - self.minimumDate = nil; - self.maximumDate = nil; - self.date = [NSDate date]; -} - @end diff --git a/ios/fabric/RNDateTimePickerComponentView.mm b/ios/fabric/RNDateTimePickerComponentView.mm index 889af20f..3afc9c09 100644 --- a/ios/fabric/RNDateTimePickerComponentView.mm +++ b/ios/fabric/RNDateTimePickerComponentView.mm @@ -40,9 +40,9 @@ @interface RNDateTimePickerComponentView () @end @implementation RNDateTimePickerComponentView { - RNDateTimePicker *_picker; + UIDatePicker *_picker; // Dummy picker to apply prop changes and calculate/update the size before the actual picker gets updated - RNDateTimePicker *_dummyPicker; + UIDatePicker *_dummyPicker; RNDateTimePickerShadowNode::ConcreteState::Shared _state; } @@ -119,8 +119,6 @@ - (void)prepareForRecycle { [super prepareForRecycle]; _state.reset(); - [_picker reset]; - [_dummyPicker reset]; } -(void)updateTextColorForPicker:(UIDatePicker *)picker color:(UIColor *)color From b8446a72d89df02fae3d3821bb62973fc8cee052 Mon Sep 17 00:00:00 2001 From: Wes Johnson Date: Mon, 24 Nov 2025 17:56:34 -0500 Subject: [PATCH 3/3] feedback: no recycling instead --- ios/fabric/RNDateTimePickerComponentView.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ios/fabric/RNDateTimePickerComponentView.mm b/ios/fabric/RNDateTimePickerComponentView.mm index 3afc9c09..ec9d7cdc 100644 --- a/ios/fabric/RNDateTimePickerComponentView.mm +++ b/ios/fabric/RNDateTimePickerComponentView.mm @@ -115,10 +115,9 @@ + (ComponentDescriptorProvider)componentDescriptorProvider return concreteComponentDescriptorProvider(); } -- (void)prepareForRecycle ++ (BOOL)shouldBeRecycled { - [super prepareForRecycle]; - _state.reset(); + return NO; } -(void)updateTextColorForPicker:(UIDatePicker *)picker color:(UIColor *)color