Unable to find node on an unmounted component error
See original GitHub issue=== Open the issue
Description
Screenshots
Steps To Reproduce
- Install the libraries listed below
- Follow the jest expo guideline
- Create two files below
- 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
- React: 16.13.1
- React Native: “react-native”: “https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz”,
- React Native Gesture Handler: 1.8.0
- Ubuntu 20
- expo 40.0.0
- jest-expo: 40.0.1
- @testing-library/react-native: “7.1.0”
- react-test-renderer: 17.0.1 === Open the issue
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:13 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was facing the same issue, so I’ve updated
react-test-renderer
to version 17.0.2 and worked.Any update on it @jakub-gonet , @iaurg ? I’m experiencing the exact same problem. Upgrading
react-test-renderer
to version17.0.2
didn’t worked. 😕My package version: