question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tabs component throws "Cannot read property 'scrollTo' of null" after redux state change

See original GitHub issue

node, npm, react-native, react and native-base version, expo version if used, xcode version

On Android and iOS, react-native: 0.60.5 native-base: ^2.13.8

Issue Description

I am rendering a <Tabs> object within a <View> with three <Tab> child objects. When redux updates state and this component renders, the error in the title is thrown. If you cancel it in debug, it goes away and no damage seems to be done, but when the app is compiled to a staging or production build, the error causes a general error popup and crashes the app to the login screen. If I comment out the <Tabs> component, the error is not thrown.

What I have tried:

I systematically commented out all child components of the <Tabs> object, but if the base <Tabs> element is still there, the error is thrown. Putting another component, like a <Container> with a <View> inside does not throw the error. Wrapping the <Tabs> in a <Container> also did not help. I tried placing a delay on the render. I tried splitting the render with props flags to eliminate lifecycle race conditions. I have tried moving the <Tabs> out of the function and into the main render() method, but the same error occurs.

Snippets

This is the function that is called from render() that creates the tabs

renderMainContent = () => (
    <Container>
    <Tabs
      style={{ flex: 1 }}
      initialPage={0}
      prerenderingSiblingsNumber={1}
      locked={Platform.OS !== 'ios'}
      renderTabBar={() => (
        <NGDefaultTabBar
          textStyle={{ fontFamily: 'Proxima Nova' }}
          backgroundColor="black"
          activeTextColor="white"
          inactiveTextColor="#CECECE"
          underlineStyle={{ backgroundColor: '#C6612F' }}
        />
      )}
    >
      <Tab heading="SCHEDULE">
        <View style={[styles.tabView, { paddingHorizontal: 0 }]}>
          <DetailSchedule
            data={this.props.schedule || []}
            active={this.props.navigation.state.params.user.active}
            shiftTypes={this.props.shiftTypes}
            handleRefresh={this.handleRefresh}
            refreshing={this.props.staffProfileRefreshing}
          />
        </View>
      </Tab>
      <Tab heading="PROFILE">
        <View style={styles.tabView}>
          <DetailProfile data={this.props.profile} />
        </View>
      </Tab>
      <Tab heading="CREDENTIALS">
        <View style={styles.tabView}>
          <DetailCredential data={this.props.credentials || []} />
        </View>
      </Tab>
    </Tabs>
    </Container>
  );

The exact error as seen from the console:

ExceptionsManager.js:86 Cannot read property 'scrollTo' of null
  | handleException | @ | ExceptionsManager.js:86
  | handleError | @ | setUpErrorHandling.js:23
  | reportFatalError | @ | error-guard.js:42
  | __guard | @ | MessageQueue.js:345
  | callFunctionReturnFlushedQueue | @ | MessageQueue.js:105
  | (anonymous) | @ | debuggerWorker.js:80

As you can see, it’s not very verbose, but it does not trace back to any of the components we have written for this app, it appears to originate from inside the render lifecycle of react-native itself.

Please help! If you have any insight into what might be causing this issue, you’d be saving me big time.

Is the bug present in both iOS and Android?

Yes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
revathskumarcommented, Dec 10, 2019

@sankhadeeproy007 When we can expect a release with this fix?

4reactions
modiharsh04commented, Oct 18, 2019

I had the same problem with 2.13.8 and fixed it by downgrading to 2.13.6 as @domoniquecarter35 pointed out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve TypeError: Cannot read ... - Stack Overflow
I am working on react native application and using "Native Base" tabs structure. It throws me an error and this occurs continuously after...
Read more >
React/Redux Render Error: 'TypeError: Cannot read property ...
Trying to access a property of null throws 'Uncaught TypeError: Cannot read property [propertyName] of null'. Instead of the status value ...
Read more >
uncaught typeerror: cannot read properties of null ... - You.com
Am getting "TypeError: Cannot read properties of null (reading 'useMemo') error Redux in my react redux application. I made a very simple react...
Read more >
FAQs | React Hook Form - Simple React forms validation
React Hook Form doesn't control your entire form and inputs, which is the reason why React wouldn't recognize the actual input that has...
Read more >
How to resolve TypeError: Cannot read property 'scrollTo' of ...
Coding example for the question How to resolve TypeError: Cannot read property 'scrollTo' of null(occurs because of native base tabs react native)?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found