Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vergil-zhao opened this issue Jun 30, 2020 · 0 comments

Comments

@vergil-zhao
Copy link

vergil-zhao commented Jun 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant