'React-Native app is not working on expo web environment (undefined is not an object (evaluating 'Sockets.createSocket'))

  • I try to work with react-native-udp lib, have installed it and at emulator everything is ok.

  • After starting this app at web with yarn web, I've got an error https://github.com/tradle/react-native-udp/issues/209. I fixed it in the forked version by removing common js export in source code.

  • Have got a new error: UdpSocket.js:47 Uncaught TypeError: Cannot read properties of undefined (reading 'createSocket') at new UdpSocket (UdpSocket.js:47:1)

Question: Any way to fix it? As I know I can put some mocked lib in web environment for expo web, any other ways, anybody know how to do it? I just want to keep web working since it's much more easy to test styles and view intermediate result, I don't that any library to broke this experience



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source