Skip to content

Commit 758642f

Browse files
authored
Fix/text field value change (#1426)
* Push Wizard missed generated types * Sync state value with prop value when it changes
1 parent 660bc2e commit 758642f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

generatedTypes/components/wizard/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface State {
99
* @description: Wizard Component: a wizard presents a series of steps in prescribed order
1010
* that the user needs to complete in order to accomplish a goal (e.g. purchase a product).
1111
*
12-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/WizardScreen.js
12+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/WizardScreen.tsx
1313
* @notes: Use Wizard with nested Wizard.Step(s) to achieve the desired result.
1414
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Wizard/Wizard.gif?raw=true
1515
* @image: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Wizard/WizardPresets.png?raw=true

src/incubator/TextField/useFieldState.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ export default function useFieldState({
3939
}
4040
}, []);
4141

42+
useEffect(() => {
43+
if (props.value !== value) {
44+
setValue(props.value);
45+
}
46+
/* On purpose listen only to props.value change */
47+
}, [props.value]);
48+
4249
useDidUpdate(() => {
4350
onChangeValidity?.(isValid);
4451
}, [isValid]);

0 commit comments

Comments
 (0)