更新 index.js

This commit is contained in:
lvwang2002 2024-03-28 16:58:13 +00:00
parent 7aca6da05f
commit 9f6cc8f15b
1 changed files with 4 additions and 3 deletions

View File

@ -2,11 +2,12 @@
* Created by lvbingru on 12/16/15. * Created by lvbingru on 12/16/15.
*/ */
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import ReactNative, { import ReactNative, {
InteractionManager, View, Text, ScrollView, Platform, Animated, UIManager, NativeModules, Dimensions, InteractionManager, View, Text, ScrollView, Platform, Animated, UIManager, NativeModules, Dimensions,
Keyboard, Keyboard,
} from 'react-native'; } from 'react-native';
import PropTypes from 'prop-types';
import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState'; import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState';
const ViewPlugins = NativeModules.InputScrollViewPlugin; const ViewPlugins = NativeModules.InputScrollViewPlugin;
const dismissKeyboard = Keyboard.dismiss; const dismissKeyboard = Keyboard.dismiss;
@ -47,7 +48,7 @@ export default class InputScrollView extends Component {
if (!this.scrollViewRef) { if (!this.scrollViewRef) {
return; return;
} }
const currentlyFocusedTextInput = TextInputState.currentlyFocusedField(); const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
if (currentlyFocusedTextInput != null) { if (currentlyFocusedTextInput != null) {
ViewPlugins && ViewPlugins.isSubview( ViewPlugins && ViewPlugins.isSubview(
currentlyFocusedTextInput, currentlyFocusedTextInput,
@ -76,7 +77,7 @@ export default class InputScrollView extends Component {
style={{ flex: 1 }} style={{ flex: 1 }}
onStartShouldSetResponderCapture={e => { onStartShouldSetResponderCapture={e => {
if (tapToDismiss === true) { if (tapToDismiss === true) {
const currentlyFocusedTextInput = TextInputState.currentlyFocusedField(); const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
if (e.target != currentlyFocusedTextInput) { if (e.target != currentlyFocusedTextInput) {
if (ViewPlugins && ViewPlugins.isTextInput) { if (ViewPlugins && ViewPlugins.isTextInput) {
ViewPlugins.isTextInput( ViewPlugins.isTextInput(