Skip to content

RN 0.62.0 Compatibility (cause duplicate symbols about multiple copy of CocoaAsyncSocket) #94

Open

Description

@vergil-zhao

Hi,

The version of tradle/react-native-udp has been updated to 3.1.0 but it's still using ^2.1.0 after run ./node_modules/.bin/rn-nodeify --hack --install --yarn.

The same problem is also with react-native-tcp. Since it has been deprecated, it will cause the duplicate symbol issue as well (like #93). I guess it should be replaced by any active module like react-native-tcp-socket (by @Rapsssito).

The older versions of react-native-udp and react-native-tcp both contain a copy of CocoaAsyncSocket or CocoaAsyncUdpSocket which are already introduced by RN per se. New versions are using them as pod dependency to solve the problem.

After I changed them manually, the iOS project can be compiled without errors.

BUT, it will cause runtime issues, like:

Unable to resolve module `stream` from `node_modules/cipher-base/index.js`: stream could not be found within the project.
Unable to resolve module `crypto` from `node_modules/sjcl/sjcl.js`: crypto could not be found within the project.
...

Any idea about this?

Solution

Add this to metro.config.js

resolver: {
    extraNodeModules: {
        crypto: require.resolve('crypto-browserify'),
        stream: require.resolve('stream-browserify'),
        ...
    },
},

Also, any alternative lib can be added this way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions