react-native: Short lived TextView causing error "Trying to set local data for view with unknown tag: 4" on Android in RN 0.50.3

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.3.0 Yarn: 1.1.0 npm: 5.4.2 Watchman: 4.9.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.3 => 0.50.3

Steps to Reproduce

Create a view with a TextInput, make sure this view is showing when app is loaded but hidden quickly after (due to asynchronous event). 2. Let this app load in the android emulator 3. Once in a while you get error “Trying to set local data for view with unknown tag: 4”

Expected Behavior

I expect removing the TextInput shortly after app loading to work every time on Android without any errors

Actual Behavior

There seems to be a race condition when starting up the app causing the error screenshot_1510671656

Reproducible Demo

Run this demo in the simulator. I have not been able to reproduce this on a device

https://github.com/FranklyDev/react-native-0_50_3-android-bug-testcase

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 32
  • Comments: 31 (1 by maintainers)

Commits related to this issue

Most upvoted comments

In RN 0.53 . The issue still exists. Happens one in case of 10 attempts.

working with RN 0.50.4 and experiencing the same issue.

@wangghon I am wondering when will ‘0.51.0’ be available officially on NPM?

Having this issue on 50.4 using windows, error occured on both emulator and actual device

@yaohongkok I am waiting for the release as well. Hope it can be released soon.

we are using react version 0.50.4 version and facing the same issue and we can not update the react version because we are using Salesforce sdk in which 0.50.4 react version is used.

Is there any resolution for same version to fix this issue?

If not using redux, how we could fix it? I tried conditionally rendering TextInput with timeout, without success - once inserting the TextInput(after 3 sec) it again fails:

render() {

    let render = this.state.shouldRender ?
    <TextInput
      style={styles.search_text}
      placeholder="Type here to search!"
      onChangeText={(text) => this._onTextChanged(text)}
    /> :
    <View/>

    return <View style={styles.main_view}>
       <View style={styles.search_holder}>
         {render}
       </View>
       <View style={{flex:1}}>
         <ListView
           dataSource={this.state.dataSource}
           renderRow={this._renderListRow.bind(this)}/>
       </View>
     </View>
  }

  componentDidMount(){
    setTimeout(() => {

      this.setState({
        shouldRender: true
      })

    }, 3000)

  }

More importantly - I’m not hiding or manipulating the TextView in any manner. The exception is thrown 100% on Android 4.4 real device.