Skip to content

Commit 385fa17

Browse files
committed
remove useCallback
1 parent 194faa3 commit 385fa17

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

src/pages/Debug/DynamicDebugDetailsConstantPickerPage.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@ function DynamicDebugDetailsConstantPickerPage({
2828
const {translate} = useLocalize();
2929
const styles = useThemeStyles();
3030
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.DETAILS_CONSTANT_PICKER.path);
31-
const onSubmit = useCallback(
32-
(item: {text?: string; keyForList?: string}) => {
33-
const value = item.text === fieldValue ? '' : (item.text ?? '');
34-
Navigation.goBack(appendParam(backPath, fieldName, value), {compareParams: false});
35-
},
36-
[backPath, fieldName, fieldValue],
37-
);
31+
const onSubmit = (item: {text?: string; keyForList?: string}) => {
32+
const value = item.text === fieldValue ? '' : (item.text ?? '');
33+
Navigation.goBack(appendParam(backPath, fieldName ?? '', value), {compareParams: false});
34+
};
3835

3936
const renderPicker = useCallback(() => {
4037
if (([TRANSACTION_FORM_INPUT_IDS.CURRENCY, TRANSACTION_FORM_INPUT_IDS.MODIFIED_CURRENCY, TRANSACTION_FORM_INPUT_IDS.ORIGINAL_CURRENCY] as string[]).includes(fieldName)) {

src/pages/Debug/DynamicDebugDetailsDateTimePickerPage.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {format} from 'date-fns';
2-
import React, {useCallback, useState} from 'react';
2+
import React, {useState} from 'react';
33
import {View} from 'react-native';
44
import DatePicker from '@components/DatePicker';
55
import HeaderWithBackButton from '@components/HeaderWithBackButton';
@@ -30,13 +30,10 @@ function DynamicDebugDetailsDateTimePickerPage({
3030
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.DETAILS_DATE_TIME_PICKER.path);
3131
const [date, setDate] = useState(() => DateUtils.extractDate(fieldValue));
3232

33-
const handleSubmit = useCallback(
34-
(time: string) => {
35-
const formattedDateTime = format(new Date(`${date} ${time}`), 'yyyy-MM-dd HH:mm:ss.SSS');
36-
Navigation.goBack(appendParam(backPath, fieldName, formattedDateTime), {compareParams: false});
37-
},
38-
[date, fieldName, backPath],
39-
);
33+
const handleSubmit = (time: string) => {
34+
const formattedDateTime = format(new Date(`${date} ${time}`), 'yyyy-MM-dd HH:mm:ss.SSS');
35+
Navigation.goBack(appendParam(backPath, fieldName ?? '', formattedDateTime), {compareParams: false});
36+
};
4037

4138
return (
4239
<ScreenWrapper testID="DynamicDebugDetailsDateTimePickerPage">

0 commit comments

Comments
 (0)