devfd/react-native-workers

Using third party native modules

fampinheiro opened this issue · 1 comments

I am trying to implement local discovery on my react native application for that I use react-native-tcp and react-native-udp.

The problem is the only packages available on the worker are

{
  NetInfo: [Getter],
  WorkerSelfManager: [Getter],
  JSCHeapCapture: [Getter],
  AndroidConstants: [Getter],
  IntentAndroid: [Getter],
  AsyncSQLiteDBStorage: [Getter],
  Vibration: [Getter],
  LocationObserver: [Getter],
  Networking: [Getter],
  SourceCode: [Getter],
  ExceptionsManager: [Getter],
  WebSocketModule:
   { ping: { [Function: fn] type: 'remote' },
     sendBinary: { [Function: fn] type: 'remote' },
     connect: { [Function: fn] type: 'remote' },
     send: { [Function: fn] type: 'remote' },
     close: { [Function: fn] type: 'remote' } },
  Timing:
   { deleteTimer: { [Function: fn] type: 'remote' },
     createTimer: { [Function: fn] type: 'remote' } },
  UIManager: { moduleID: 0, takeSnapshot: [Function] } }
}

The packages I have on the getPackages are the following

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new TcpSocketsModule(),
          new UdpSocketsModule(),
          new WorkerPackage(),
          new VectorIconsPackage()
      );
    }
devfd commented

@fampinheiro good catch.

the readme has been updated. tell me if that works for your use-case.

edit: also you need to update to v0.3.1