MCPcopy
hub / github.com/halilb/react-native-textinput-effects / componentDidUpdate

Method componentDidUpdate

lib/BaseInput.js:47–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 }
46
47 componentDidUpdate() {
48 const newValue = this.props.value;
49 if (this.props.hasOwnProperty("value") && newValue !== this.state.value) {
50 this.setState({
51 value: newValue,
52 });
53
54 // animate input if it's active state has changed with the new value
55 // and input is not focused currently.
56 const isFocused = this.inputRef().isFocused();
57 if (!isFocused) {
58 const isActive = Boolean(newValue);
59 if (isActive !== this.isActive) {
60 this._toggle(isActive);
61 }
62 }
63 }
64 }
65
66 _onLayout(event) {
67 this.setState({

Callers

nothing calls this directly

Calls 3

inputRefMethod · 0.95
_toggleMethod · 0.95
isFocusedMethod · 0.80

Tested by

no test coverage detected