Skip to content
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

Fix - [TS migration] Migrate 'TimePicker' component to TypeScript #37422

Merged
merged 15 commits into from
Mar 25, 2024
Merged
Prev Previous commit
Next Next commit
addressed comments
  • Loading branch information
FitseTLT committed Mar 23, 2024

Verified

This commit was signed with the committer’s verified signature.
neo1973 Markus Härer
commit a129954cac8a4a9ba921d5a4db398cee9605892c
5 changes: 2 additions & 3 deletions src/components/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import CONST from '@src/CONST';
import setCursorPosition from './setCursorPosition';

type MinHrRefs = {hourRef: TextInput | null; minuteRef: TextInput | null};
type MinuteHourRefs = {hourRef: TextInput | null; minuteRef: TextInput | null};

type TimePickerProps = {
/** Default value for the inputs */
@@ -103,7 +103,7 @@ function clearSelectedValue(value: string, selection: {start: number; end: numbe
setSelection({start: newCursorPosition, end: newCursorPosition});
}

function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: TimePickerProps, ref: ForwardedRef<MinHrRefs>) {
function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: TimePickerProps, ref: ForwardedRef<MinuteHourRefs>) {
const {numberFormat, translate} = useLocalize();
const {isExtraSmallScreenHeight} = useWindowDimensions();
const styles = useThemeStyles();
@@ -368,7 +368,6 @@ function TimePicker({defaultValue = '', onSubmit, onInputChange = () => {}}: Tim
if (isMinuteFocused && selectionMinute.start === 0) {
// Check e to be truthy to avoid crashing on Android (e is undefined there)
e?.preventDefault();

focusHourInputOnLastCharacter();
}
},