Ai
1 Star 1 Fork 0

hfqf123/react-native-alliosn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.js 2.68 KB
一键复制 编辑 原始数据 按行查看 历史
huangfqf 提交于 2023-02-09 12:03 +08:00 . init
import React, { Component } from 'react';
import { AppRegistry, NativeModules, NativeAppEventEmitter,AsyncStorage,DeviceEventEmitter,Platform} from 'react-native';
import {AppNavigator,AppNavigator2} from './app/Navigation';
var Oc2RnManager = NativeModules.Oc2RnManager
import DeviceInfo from 'react-native-device-info';
import { NetworkInfo } from 'react-native-network-info';
import IMEI from 'react-native-imei';
import {SCREEN_WIDTH,SYSTEM,COLOR,KEYS,HTTP} from './app/util/config'
import Device from './app/util/DeviceUtil';
export default class CoreApp extends Component {
constructor(props){
super(props);
this.state = {
isneedlogin: false,
}
}
componentWillMount () {}
render() {
return true ?
(
<AppNavigator
ref={'index'}
onNavigationStateChange={(prevState, currentState,event) => {
const getCurrentRouteName = (navigationState) => {
if (!navigationState) return null;
const route = navigationState.routes[navigationState.index];
if (route.routes) return getCurrentRouteName(route);
return route.routeName;
};
let currentRoute = getCurrentRouteName(currentState);
const prevScreen = getCurrentRouteName(prevState);
console.log('onNavigationStateChange'+currentRoute+'&'+prevScreen+'&'+JSON.stringify(event));
if(currentRoute != prevScreen &&event.params == undefined ) {
console.log('RELOAD0_TAB'+currentRoute);
DeviceEventEmitter.emit(currentRoute,currentRoute);
}
}}
/>
): (
<AppNavigator2
onNavigationStateChange={(prevState, currentState,event) => {
const getCurrentRouteName = (navigationState) => {
if (!navigationState) return null;
const route = navigationState.routes[navigationState.index];
if (route.routes) return getCurrentRouteName(route);
return route.routeName;
};
let currentRoute = getCurrentRouteName(currentState);
const prevScreen = getCurrentRouteName(prevState);
console.log('onNavigationStateChange'+currentRoute+prevScreen+JSON.stringify(event));
// if(currentRoute != prevScreen &&event.params == undefined ) {
// DeviceEventEmitter.emit('RELOAD_TAB',currentRoute);
// }
}}
/>
)
}
}
AppRegistry.registerComponent('CoreApp', () => CoreApp);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hfqf1234/react-native-alliosn.git
git@gitee.com:hfqf1234/react-native-alliosn.git
hfqf1234
react-native-alliosn
react-native-alliosn
master

搜索帮助