TypeError:null不是对象(评估'_reactNativeSimpleNativeGeofencing.default.initNotification')

时间:2019-08-19 09:01:19

标签: react-native

背景:我打算创建一个地理围栏应用程序,并且正在使用 react-native-simple-native-geofencing 。这是错误所在代码的一部分。

我尝试查找整个“空不是对象”错误,到目前为止,没有任何帮助。

componentDidMount(){
     RNSimpleNativeGeofencing.initNotification(
        {
          channel: {
            title: "Channel Title",
            description: "Channel Description"
          },
          start: {
            notify: true,
            title: "Start Tracking",
            description: "You are now being tracked"
          },
          stop: {
            notify: true,
            title: "Stopped Tracking",
            description: "You are not being tracked any longer"
          },
          enter: {
            notify: true,
            title: "Attention",
            //[value] will be replaced ob geofences' value attribute
            description: "You have entered [value]"
          },
          exit: {
            notify: true,
            title: "Left Zone",
            description: "You have left [value]"
          }
        }
     );

    navigator.geolocation.watchPosition(
      position => {
          this.setState({
              latitude: position.coords.latitude,
              longitude: position.coords.longitude,
            });
      },
      error => console.log(error),
      { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
    );
}

据我了解,这部分是创建通知。当我执行整个代码时,它说 TypeError:null不是一个对象(正在评估'_reactNativeSimpleNativeGeofencing.default.initNotification')

我尝试删除了这部分代码,但事实证明,我遇到的其他函数也遇到相同的问题(它们返回null不是对象)。

0 个答案:

没有答案