Skip to content

@libp2p/tcp No Longer Supported in React Native #2969

@palmtown

Description

@palmtown
  • Version:
    "@libp2p/tcp": "^10.0.19",
    "libp2p": "^2.6.2",
    "react-native-tcp-socket": "^6.2.0",

  • Platform:
    64-bit (Windows)

  • Subsystem:
    @libp2p/tcp

Severity:

Medium

Description:

In React Native 0.77.0, the following errors occur, making the TCP transport unusable. Previously, @libp2p/tcp appeared to work, as referenced in the repository: https://github.com/ipfs-shipyard/js-libp2p-react-native.

  1. Adding tcp() to the transports key in the createLibp2p functions generates the below error in Exhibit 1 below.
  2. Commit dd7b329, which introduced the code in Exhibit 2, causes react-native to fail as it defaults to the tcp.browser.js code.

Exhibit 1
TypeError: The listener must be a function at addListener (http://10.0.2.2:8081/node_modules\react-native-tcp-socket\node_modules\eventemitter3\index.bundle//&platform=android&lazy=true&app=com.reactnativep2p&modulesOnly=true&sourcePaths=url-server&dev=true&minify=false&runModule=true&shallow=true:61:26)

Exhibit 2
"browser": { "./dist/src/tcp.js": "./dist/src/tcp.browser.js" },

Steps to reproduce the error:

Create a react-native project, and add tcp() to the list of transports

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions