React Native - ошибка ввода текста на модальном - PullRequest
0 голосов
/ 21 сентября 2019

, поэтому я новичок в React Native.

У меня проблема с фокусировкой ввода текста на модальном.Это случайный случай.

в этом случае у меня есть представление, содержащее код, подобный:

<View style={[styles.container, { backgroundColor: this.props.property.theme.colors.background }]}>
        <FlatList
          overScrollMode="never"
          style={{ backgroundColor: this.props.property.theme.colors.background }}
          keyExtractor={(item, index) => `${index}`}
          data={this.props.property.dashboard.list}
          renderItem={({ item, index }) => (
            <WithdrawSummaryItem
              item={item}
            />
          )}
        />
        <Button
          containerStyle={styles.signUpButton}
          text={Languages.LendingWithdraw}
          onPress={() => this._handlePress()}
        />

        <Modal onClosed={this.closeModal} ref={(modal) => (this.modal = modal)} style={[styles.modal, styles.modal4]} position={"center"}>
          <WithdrawInfo property={this.props.property} />
          <TouchableOpacity style={styles.iconZoom} onPress={this.closeModal}>
            <Icon
              style={styles.textClose}
              name="close"
              size={22}
              color={this.props.property.theme.colors.text}
              backgroundColor="transparent"
            />
          </TouchableOpacity>
        </Modal>
  </View>

расположение TextInput находится в элементе WithdrawInfo, который имеет:

<View style={{ height: Platform.OS === "ios" ? 480 : 430 }}>
    <View style={styles.labelView}>
        <Text style={styles.label}>Bank Information</Text>
    </View>
    <View style={{ padding: 5 }}>
        {this._renderAttribute(
        Languages.LendingBankAccountName,
        accountName.toUpperCase()
        )}
        {this._renderAttribute(
        Languages.LendingBankAccountNumber,
        accountNumber
        )}
        {this._renderAttribute(
        Languages.LendingBankName,
        bank.toUpperCase()
        )}

        <View style={[styles.row, {paddingTop: 10}]}>
            <TextInput
                ref={(comp) => (this.nominal = comp)}
                keyboardType='numeric'
                style={[
                styles.couponInput,
                { backgroundColor: "white" },
                ]}
                underlineColorAndroid="transparent"
                autoCapitalize="none"
                onChangeText={this.onNominalEditHandle}
                value={nominal}
            />

            <Button
                text={"Submit"}
                style={{
                backgroundColor: Color.primary,
                borderRadius: 5,
                elevation: Platform.OS === "ios" ? 1 : 0,
                width: 100,
                height: 40,
                textAlign: "center"
                }}
                onPress={() => this.onSubmitWithdrawHandle()}
            />

        </View>
        {isLoading ? <Spinner mode="overlay" /> : null}
    </View>
</View>

Проблема возникает, когда я меняю данные FlatList на другие prop.Допустим, у меня есть 2 prop, панель инструментов и вывод.

, когда я изменяю его на вывод, TextInput работает отлично, но когда я превращаю его в панель управления, фокусировка TextInput не работает.

Снятие и панель управления имеют какой-то формат ответа.

Может, я что-то здесь упустил?

Спасибо за совет!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...