问题描述
它将与headlessjs选项一起在react-native-background-fetch中使用背景。
我还在Redux中存储频道。
这是我的index.js:
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import BackgroundFetch from "react-native-background-fetch";
import {store,persistor} from './src/store/index';
let MyHeadlesstask = async (event) => {
const state = store.getState();
let taskId = event.taskId;
console.log('[BackgroundFetch Headlesstask] start: ',taskId);
await console.log(state)
}
BackgroundFetch.registerHeadlesstask(MyHeadlesstask);
AppRegistry.registerComponent(appName,() => App);
这是输出:
[BackgroundFetch Headlesstask] start: react-native-background-fetch
// this is comes from index.js
[Fri Aug 21 2020 12:10:56.397] LOG {"_persist": {"rehydrated": false,"version": -1},"channelReducer": {"channels": [],"inputValue": ""}}
//this is comes from my reducer
[Fri Aug 21 2020 12:10:56.398] LOG reducerd {"err": undefined,"key": "root","payload": {"_persist": {"rehydrated": true,"channelReducer": {"channels": [Array],"inputValue": "cowsep"}},"type": "persist/REHYdratE"}
我需要获取持久性数据,意思是inputValue = cowsep
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)