Coder Social home page Coder Social logo

Getting error "Event node is of an invalid type" when using event with react-native-gesture-handler. about react-native-reanimated HOT 3 CLOSED

software-mansion avatar software-mansion commented on May 22, 2024
Getting error "Event node is of an invalid type" when using event with react-native-gesture-handler.

from react-native-reanimated.

Comments (3)

DylanVann avatar DylanVann commented on May 22, 2024

A bit more info. Seems like when it re-renders dropNode is called in REANodesManager.m even though the node isn't actually being unmounted.

It drops the node then tries to call attachEvent with the eventNodeID that was just dropped.

from react-native-reanimated.

DylanVann avatar DylanVann commented on May 22, 2024

Idk if it'll be helpful but here's what I've noticed so far:

In AnimatedComponent, this error is started in componentDidUpdate:

      if (this._component !== this._prevComponent || prevProps !== this.props) {
        this._detachNativeEvents();
        this._attachNativeEvents();
      }

calls into AnimatedEvent to detach, which detaches them and removes them from _nodes:

  detachEvent(viewRef, eventName) {
    const viewTag = findNodeHandle(viewRef);
    ReanimatedModule.detachEvent(viewTag, eventName, this.__nodeID);
    this.__detach();
  }

_attachNativeEvents calls:

  attachEvent(viewRef, eventName) {
    this.__attach();
    const viewTag = findNodeHandle(viewRef);
    ReanimatedModule.attachEvent(viewTag, eventName, this.__nodeID);
  }

__attach calls __nativeInitialize:

  __nativeInitialize() {
    if (this.__nodeConfig) {
      ReanimatedModule.createNode(this.__nodeID, this.__nodeConfig);
      this.__nodeConfig = undefined;
    }
  }

Since the native event was already initialised createNode is not called and an error occurs when attachEvent is called because the node doesn't exist in _nodes.

from react-native-reanimated.

kmagiera avatar kmagiera commented on May 22, 2024

Thanks for reporting will get to it soon

from react-native-reanimated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.