balthazar/react-native-zeroconf

[Important] Zeroconf.scan is null

Closed this issue · 3 comments

Hi,

I have an error with the module, I created a project react with expo, I installed the module, I imported the module and when I do

const zeroconf = new Zeroconf(); zeroconf.scan(4000, 4400);

I get this error

TypeError: null is not an object (evaluating 'RNZeroconf.scan')

  • node_modules/react-native-zeroconf/dist/index.js:1:4265 in scan
  • src/component/MyHeader.js:11:28 in TestZeroConf
  • src/component/MyHeader.js:19:16 in MyHeader
  • node_modules/react-proxy/modules/createClassProxy.js:98:23 in
  • node_modules/react-proxy/modules/createClassProxy.js:96:6 in instantiate
  • ... 20 more stack frames from framework internals****

... ?

I get this error too. Building for android.

zeroconf.scan('http', 'tcp', 'local.');

react-native version: 0.59.10
Android SDK 28

Hi @AmityTek, I realised you have to eject expo for your project to include zeroconf module. I also had to create a new up to date react-native project to get the dependencies right.

I hope that helps you.