Skip to content

Commit 2d98263

Browse files
author
ziyu.zhang
committed
github上架
Change-Id: Ia219858a144037f1391da0b4034b82f508646895
1 parent eb2e148 commit 2d98263

95 files changed

Lines changed: 18798 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1200 additions & 0 deletions
Large diffs are not rendered by default.

example/App.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
import React from 'react';
3+
import {name as appName} from './app.json';
4+
import { Image,Button,View, Text,AppRegistry } from 'react-native';
5+
import { createStackNavigator } from 'react-navigation';
6+
import { StackNavigator } from 'react-navigation';
7+
import { RootStack } from './view/homeStackNavi.js'
8+
import { RootTab } from './view/homeStackNavi.js'
9+
10+
// 这两句可以调用sdk的代码
11+
// import {NativeModules} from 'react-native';
12+
// NativeModules.TalkingData.trackEvent3("tab1 select","a",{"a":"b"});
13+
14+
15+
function getActiveRouteName(navigationState) {
16+
if (!navigationState) {
17+
return null;
18+
}
19+
const route = navigationState.routes[navigationState.index];
20+
// dive into nested navigators
21+
if (route.routes) {
22+
return getActiveRouteName(route);
23+
}
24+
return route.routeName;
25+
}
26+
27+
28+
//创建MainTab类 返回RootStack对象
29+
30+
31+
export default class MainTab extends React.Component {
32+
render() {
33+
// return <Text>asdf</Text>
34+
// return <RootStack />;
35+
return <RootTab
36+
onNavigationStateChange={(prevState, currentState) => {
37+
const currentScreen = getActiveRouteName(currentState);
38+
const prevScreen = getActiveRouteName(prevState);
39+
40+
if (prevScreen !== currentScreen) {
41+
// the line below uses the Google Analytics tracker
42+
// change the tracker here to use other Mobile analytics SDK.
43+
// alert('页面变化\n'+ prevScreen +' end \n'+ currentScreen + ' start ');
44+
45+
}
46+
}}
47+
48+
/>;
49+
}
50+
}
51+
52+
//注册 App
53+
AppRegistry.registerComponent(appName, () => MainTab);

0 commit comments

Comments
 (0)