我正在为Android开发,并且正在使用Zeroconf。在过去的两天里,我一直试图转移到世博SDK 34,并已经完成了大部分的问题。但是,我遇到了以下错误:
TypeError: TypeError: null不是一个对象(计算'RNZeroconf.scan') -node_modules/react-native-zeroconf/dist/index.js:1:4265扫描
在Expo SDK 32上运行时,我没有这个错误。相关代码位:
import Zeroconf from 'react-native-zeroconf'
componentDidMount(){
this.zeroconf = new Zeroconf()
this.startDockScan()
}
startDockScan=()=>{
this.zeroconf.scan('http','tcp','local.'); //this is where the error traces back to
}发布于 2019-08-08 00:59:22
如果没有弹出Expo,就不能使用这个模块。
因为您必须将此模块link到Android和iOS文件夹。
Expo,然后是link模块。React Native创建一个项目,然后执行它。应用Android的第一种方法
1. Expo eject
2. react-native link react-native-zeroconf第二种应用Android的方法
1. react-native init yourproject
2. cd yourproject && yarn add react-native-zeroconf && react-native link react-native-zeroconf
3. and run react-native如果你什么都不想要,你必须找到另一个模块。
https://stackoverflow.com/questions/57403253
复制相似问题