facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.55k stars 24.37k forks source link

textinput value from state reverts, need to tap text twice for it to save or tap backspace twice to delete iOS #48011

Open tburnt opened 3 days ago

tburnt commented 3 days ago

Description

When I use type in a character or delete a character it flickers and puts back the character or deletes the character

The following is my code //import area import { StyleSheet, View, Text, Image, TouchableOpacity, Appearance, ScrollView, Platform, TextInput as NativeTextInput } from 'react-native';

//constructor in the component constructor(props) { super(props); this.state = { background_color: '#5c5c5c', user_data: [], expandSttGeneralList: false, expandSttList: false, expandSttSellList: false, expandUserGeneralList: false, expandUserList: false, expandUserSellList: false, introductionModal: false, introductionPage1: true, stt_general_buy_rules: [], stt_general_buy_rules_list: <></>,

  stt_buy_rules: [],
  stt_buy_rules_list: <></>,

  stt_sell_rules: [],
  stt_sell_rules_list: <></>,

  user_general_buy_rules: [],
  user_general_buy_rules_list: <></>,

  user_buy_rules: [],
  user_buy_rules_list: <></>,

  user_sell_rules: [],
  user_sell_rules_list: <></>,

  openRuleModal: false,
  openDeleteRuleDialog: false,
  rule_id: 0,
  rule_list_id: 0,
  rule_description: '',
  rule_type: '',
};

this.utilHelper = new UtilityHelper();
this.dbHelper = new DatabaseHelper();
this.rulesModel = new Rules();
this.rulesListModel = new RulesList();
this.willFocusSubscription;
this.systemDarkThemeListener;
this.temp_description = '';
//this.handleTextChange = this.handleTextChange.bind(this);

}

//script callback when textchange iOShandleTextChange(text) {

 this.setState({ rule_description: text }, ()=>{
  console.log(this.state.rule_description);
});

};

//textinput <NativeTextInput numberOfLines={3} maxLength={1000} value={this.state.rule_description} onChangeText={text => this.iOShandleTextChange(text)} style={{ width: '100%', height: 800, padding: 10, fontSize: 15, textAlign: "center" }} />

Pls help this has been frustrating

Steps to reproduce

  1. Add TextInput and recover value from state
  2. Try to edit

React Native Version

0.74.1

Output of npx react-native info

none

Screenshots and Videos

https://github.com/user-attachments/assets/260b5537-96b8-4e65-b737-fe9bbea8191e

react-native-bot commented 3 days ago

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.74.6. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot commented 3 days ago

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

react-native-bot commented 3 days ago

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

tburnt commented 3 days ago

adding the 74.6 patch does not work the textinput acts the same