当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 21

Dora/ReactNative-Weixin
暂停

forked from 一天前/ReactNative-Weixin
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
App.js 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
一天前 提交于 2020-03-20 10:29 . 优化和修复若干 BU
/*
* 文件名: App.js
* 作者: liushun
* 描述: App 入口
* 修改人:
* 修改时间:
* 修改内容:
* */
import React, {Component} from 'react';
import AppNav from './App/Container/AppContainer'
import { Provider } from 'react-redux'
import configureStore from './App/Redux'
import socket from 'socket.io-client'
import {PersistGate} from 'redux-persist/integration/react'
import {AddRoomMessage, AddRoomUnReadMsg} from './App/Redux/actionCreators'
import Toast from "react-native-root-toast";
import {getFriendList} from "./App/Service/action";
import config from './App/Config'
const io = socket(config.baseURL);
global.io = io
const {store, persistor} = configureStore();
export default class App extends Component<Props> {
render() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<AppNav/>
</PersistGate>
</Provider>
);
}
}
if(__DEV__) {
import('./App/Config/ReactotronConfig.js').then(() => console.log('Reactotron Configured'))
}
io.on('connect', (socket)=>{
console.tron.log('socket connect');
})
io.on('message',(obj)=>{
store.dispatch(AddRoomMessage(obj))
store.dispatch(AddRoomUnReadMsg(obj))
})
io.on('addFriend',()=>{
const user = (store.getState().UserReducer.get('user')).toJS();
store.dispatch(getFriendList(user.id))
})
io.on('disconnect', (socket)=>{
console.tron.log("socket disconnect");
Toast.show('未连接到服务器',{
duration: Toast.durations.SHORT,
position: Toast.positions.TOP
})
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/florida0723/ReactNative-Weixin.git
[email protected]:florida0723/ReactNative-Weixin.git
florida0723
ReactNative-Weixin
ReactNative-Weixin
master

搜索帮助