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.

Unable to find node on an unmounted component error

See original GitHub issue

=== Open the issue

Description

Screenshots

image

Steps To Reproduce

  1. Install the libraries listed below
  2. Follow the jest expo guideline
  3. Create two files below
  4. Run jest

Expected behavior

To render TouchableOpacity. TouchableOpacity from react-native renders just fine.

Actual behavior

Throws error provided in Screenshots section.

Minimal code example

Test file:

import React from 'react';
import { cleanup, render } from '@testing-library/react-native';
import { Gesture } from '../Gesture';

describe('HeaderRightButton filter', () => {
  afterEach(() => {
    jest.clearAllMocks();
    cleanup();
  });

  it('should render', () => {
    const { getByTestId } = render(<Gesture/>);
  });
});

Component file:

import React, { FC } from 'react';
import { View, Text } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';

export const Gesture: FC = () => {
  return (
    <View>
      <TouchableOpacity
        onPress={() => console.log('@1')}
      >
        <Text>asdf</Text>
      </TouchableOpacity>
    </View>
  );
};

Package versions

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
iaurgcommented, May 3, 2021

I was facing the same issue, so I’ve updated react-test-renderer to version 17.0.2 and worked.

5reactions
GautierArcincommented, Jul 20, 2021

Any update on it @jakub-gonet , @iaurg ? I’m experiencing the exact same problem. Upgrading react-test-renderer to version 17.0.2 didn’t worked. 😕

My package version:

React: 17.0.2
React Native: "react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
React Native Gesture Handler: 1.10.3
Ubuntu 20
expo 41.0.1
jest-expo: 42.0.0
@testing-library/react-native: "7.2.0"
react-test-renderer: 17.0.2
Read more comments on GitHub >

github_iconTop Results From Across the Web

React 16: Error: Unable to find node on an unmounted ...
Based on the error message, I believe the error is happening when calling ReactDOM.findDOMNode(this) in the handleClickOutside(event) method.
Read more >
Bug: Uncaught Error: Unable to find node on an unmounted ...
Hi, I used react-sortable-tree package im my react project in component named Tree: import React, { Component } from "react"; import axios ...
Read more >
Unable to find node on an unmounted component. react版本 ...
今天在给项目升级react版本的时候遇到了1.Unable to find node on an unmounted component. 这样一个bug 差资料发现是react和react-dom版.
Read more >
Why am I getting "Unable to find node on an unmounted ...
Why am I getting "Unable to find node on an unmounted component" error when trying to run a component from Material UI? :...
Read more >
Unable to find node on an unmounted component. - CSDN博客
背景:使用react-sortable-tree在升级react 17.0.1是报错,错误信息:react-dom.development.js:24281 Uncaught Error: Unable to find node on an ...
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