【发布时间】:2022-01-15 22:15:53
【问题描述】:
我在 @react-native-community/geolocation 的帮助下在我的 React Native 应用程序中实现手表地理定位功能,并且我创建了一个负责启动 地理定位的初始化 saga 函数。观看位置。我想传递一个 redux saga 回调函数,它会更新我的 redux 状态,但它不会触发回调 onGeolocationGet 函数:
function* initialize(): SagaReturnType<any> {
try {
yield effects.call(geolocation.watchPosition, function* onGeolocationGet(data) {
yield effects.put(UserActions.updateCurrentLocation({ ...data.coords }))
})
} catch (err) {
console.error(err)
}
}
提前感谢各位小伙伴!
【问题讨论】:
标签: react-native redux redux-saga saga