点这里,这篇文章写的不错,我就是记录一下
class MyTextInput extends Component { shouldComponentUpdate(nextProps){ return Platform.OS !== 'ios' || (this.props.value === nextProps.value && (nextProps.defaultValue == undefined || nextProps.defaultValue == '' )) || (this.props.defaultValue === nextProps.defaultValue && (nextProps.value == undefined || nextProps.value == '' )); } render() { return <TextInput {...this.props} />; } };