currentlyFocusedField被弃用,使用FocusedInput错误显示在React Native中实现更



大家下午好!我得到currentFocusedField使用FocusedInput后,我改变了createKeyboardAwareNavigator.js文件在反应导航node_modules。我搜索了我的项目目录currentFocusedField的其他实例,没有。我错过了一个步骤重建node_modules后的变化?

import React from 'react';
import { TextInput } from 'react-native';
export default (Navigator, navigatorConfig) =>
class KeyboardAwareNavigator extends React.Component {
static router = Navigator.router;
static navigationOptions = Navigator.navigationOptions;
_previouslyFocusedTextInput = null;
_handleGestureBegin = () => {
this._previouslyFocusedTextInput = TextInput.State.currentlyFocusedInput();
if (this._previouslyFocusedTextInput) {
TextInput.State.blurTextInput(this._previouslyFocusedTextInput);
}
this.props.onGestureBegin && this.props.onGestureBegin();
};
_handleGestureCanceled = () => {
if (this._previouslyFocusedTextInput) {
TextInput.State.focusTextInput(this._previouslyFocusedTextInput);
}
this.props.onGestureCanceled && this.props.onGestureCanceled();
};
_handleGestureEnd = () => {
this._previouslyFocusedTextInput = null;
this.props.onGestureFinish && this.props.onGestureFinish();
};
_handleTransitionStart = (transitionProps, prevTransitionProps) => {
// TODO: We should not even have received the transition start event
// in the case where the index did not change, I believe. We
// should revisit this after 2.0 release.
if (transitionProps.index !== prevTransitionProps.index) {
const currentField = TextInput.State.currentlyFocusedInput();
if (currentField) {
TextInput.State.blurTextInput(currentField);
}
}
const onTransitionStart =
this.props.onTransitionStart || navigatorConfig.onTransitionStart;
onTransitionStart &&
onTransitionStart(transitionProps, prevTransitionProps);
};
render() {
return (
<Navigator
{...this.props}
onGestureBegin={this._handleGestureBegin}
onGestureCanceled={this._handleGestureCanceled}
onGestureEnd={this._handleGestureEnd}
onTransitionStart={this._handleTransitionStart}
/>
);
}
};

问题是VSCode有一个奇怪的过滤器,没有显示我正在搜索的函数的所有实例,但是一旦我改变了过滤器并改变了所有的实例,它就工作了。

相关内容

  • 没有找到相关文章

最新更新