0

我有两种原生反应形式。其中一个工作完美,另一个(在另一个组件中)有一个错误。获得焦点时,表单中的TextInputs 会保持模糊。

我制作的视频(见下面的 gif)显示,每当我点击输入时,它都会获得焦点,然后立即模糊。

输入代码(现在带有调试):

<TextInput value={group.name}
    blurOnSubmit={false}
    onBlur={() => console.log('I blur')}
    onFocus={() => console.log('I focus')}
    autoFocus={true} style={styles.textInput} />

每次我单击输入时,它都会聚焦和模糊

4

3 回答 3

1

我找到了答案......我很困惑为什么它是答案,但我们开始吧:

显然,当您渲染组件TextInput内部并在选项卡上进行设置时,将无法在 TextInputs 中键入内容。我不知道为什么。我有这个是为了在构建我的视图时不必每次都单击选项卡。我想我会以不同的方式设置默认值:)TabBarIOSselected={true}true

于 2016-01-07T19:46:28.410 回答
0

我刚刚遇到了同样的问题。就我而言,问题是我的 TextInput 是<TouchableWithoutFeedback onPress={Keyboard.dismiss}>. 一起删除这个组件解决了这个问题。

于 2021-03-25T19:28:57.277 回答
-1

**安装

  1. 安装反应导航

    npm 安装反应导航

  2. 安装依赖项

    expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

  3. 安装 React 导航堆栈

    npm install react-navigation-stack @react-native-community/masked-view

于 2020-06-21T09:20:10.063 回答