fix: 使用react-native-material-textfield组件使用vaule属性异常 #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes fix: 使用react-native-material-textfield组件使用vaule属性异常 #4
react-native-material-textfield组件vaule属性无法重新设置文本
问题定位:react-native-material-textfield\src\components\field文件下面的index.js
value() {
let { text } = this.state;
let { defaultValue } = this.props;
let value = this.isDefaultVisible()?
defaultValue:
text; ---------日志定位,这个text值没有变化
...
}
重新设置value属性时日志定位text值没有变化
解决方案:
value() {
let { text } = this.state;
let { defaultValue } = this.props;
let value = this.isDefaultVisible()?
defaultValue:
this.props.value;
...
}
修改后value属性可以获取值
Test Plan
展示代码的稳定性。例如:用来复现场景的命令输入和结果输出、测试用例的路径地址,或者附上截图和视频。
测试用例地址:https://github.com/MyAndroidNetZWJ/RNOHDCS/tree/main/react-native-material-dropdown
Checklist