Skip to content

Commit

Permalink
Revert "fix: defer change update for number input (#291)"
Browse files Browse the repository at this point in the history
This reverts commit 1f97003.
  • Loading branch information
raychanks authored and Daniel committed Feb 7, 2022
1 parent 04e30b8 commit 2406e4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
10 changes: 2 additions & 8 deletions addons/ondevice-controls/src/PropForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, { memo } from 'react';
import React from 'react';
import { View } from 'react-native';
import deepEqual from 'deep-equal';

import { ArgTypes } from './ControlsPanel';
import PropField from './PropField';

Expand All @@ -27,8 +25,4 @@ const PropForm = ({ args, onFieldChange }: FormProps) => {
);
};

const deepStrictEqual = (a: any, b: any): boolean => {
return deepEqual(a, b, { strict: true });
};

export default memo(PropForm, deepStrictEqual);
export default PropForm;
12 changes: 1 addition & 11 deletions addons/ondevice-controls/src/types/Number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export interface NumberProps {
onChange: (value: number) => void;
}

const replaceComma = (value: number | string): string => {
return typeof value === 'string' ? value.trim().replace(/,/, '.') : value.toString();
};

const NumberType = ({ arg, onChange = (value) => value }: NumberProps) => {
const showError = Number.isNaN(arg.value);
const [numStr, setNumStr] = useState(arg.value.toString());
Expand All @@ -46,7 +42,7 @@ const NumberType = ({ arg, onChange = (value) => value }: NumberProps) => {
<Input
autoCapitalize="none"
underlineColorAndroid="transparent"
value={numStr}
value={arg.value.toString()}
keyboardType="numeric"
onChangeText={handleNormalChangeText}
style={showError && styles.errorBorder}
Expand All @@ -66,12 +62,6 @@ const NumberType = ({ arg, onChange = (value) => value }: NumberProps) => {
);
};

useEffect(() => {
return () => {
onChange(numStrRef.current);
};
}, [onChange]);

return <View style={styles.spacing}>{arg.range ? renderRange() : renderNormal()}</View>;
};

Expand Down

0 comments on commit 2406e4e

Please sign in to comment.