Skip to content

Commit 23c0c43

Browse files
authored
feat: Remove disable confirm (#370)
Since we can't precisely know when/if the user started spinning the component (on IOS) to picker a date, we can't disable the "Confirm" button without bugs popping up continously. This PR removes the logic that disables the "Confirm" button until the component has stopped spinning.
1 parent 4da925b commit 23c0c43

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/DateTimePickerModal.ios.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ export class DateTimePickerModal extends React.PureComponent {
6969

7070
state = {
7171
currentDate: this.props.date,
72-
isPickerVisible: this.props.isVisible,
73-
isPickerSpinning: false
72+
isPickerVisible: this.props.isVisible
7473
};
7574

7675
didPressConfirm = false;
@@ -129,12 +128,7 @@ export class DateTimePickerModal extends React.PureComponent {
129128
if (this.props.onChange) {
130129
this.props.onChange(date);
131130
}
132-
this.setState({ currentDate: date, isPickerSpinning: false });
133-
};
134-
135-
handleUserTouchInit = () => {
136-
this.setState({ isPickerSpinning: true });
137-
return false;
131+
this.setState({ currentDate: date });
138132
};
139133

140134
render() {
@@ -190,16 +184,13 @@ export class DateTimePickerModal extends React.PureComponent {
190184
]}
191185
>
192186
<HeaderComponent label={titleIOS || headerTextIOS} />
193-
<View onStartShouldSetResponderCapture={this.handleUserTouchInit}>
194-
<PickerComponent
195-
{...otherProps}
196-
value={this.state.currentDate}
197-
onChange={this.handleChange}
198-
/>
199-
</View>
187+
<PickerComponent
188+
{...otherProps}
189+
value={this.state.currentDate}
190+
onChange={this.handleChange}
191+
/>
200192
<ConfirmButtonComponent
201193
isDarkModeEnabled={isDarkModeEnabled}
202-
isDisabled={this.state.isPickerSpinning}
203194
onPress={this.handleConfirm}
204195
label={confirmTextIOS}
205196
/>
@@ -256,7 +247,6 @@ export const headerStyles = StyleSheet.create({
256247

257248
export const ConfirmButton = ({
258249
isDarkModeEnabled,
259-
isDisabled,
260250
onPress,
261251
label,
262252
style = confirmButtonStyles
@@ -269,7 +259,6 @@ export const ConfirmButton = ({
269259
style={style.button}
270260
underlayColor={underlayColor}
271261
onPress={onPress}
272-
disabled={isDisabled}
273262
>
274263
<Text style={style.text}>{label}</Text>
275264
</TouchableHighlight>

0 commit comments

Comments
 (0)