diff --git a/.flowconfig b/.flowconfig index 4bea710..f565799 100644 --- a/.flowconfig +++ b/.flowconfig @@ -48,11 +48,11 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy unsafe.enable_getters_and_setters=true [version] -^0.30.0 +^0.32.0 diff --git a/android/app/src/main/java/com/lagouapp/MainApplication.java b/android/app/src/main/java/com/lagouapp/MainApplication.java index 8df203e..4f1c894 100644 --- a/android/app/src/main/java/com/lagouapp/MainApplication.java +++ b/android/app/src/main/java/com/lagouapp/MainApplication.java @@ -3,6 +3,7 @@ import android.app.Application; import com.facebook.react.ReactApplication; +import com.kenny.instabug.InstabugPackage; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; @@ -34,7 +35,8 @@ protected boolean getUseDeveloperSupport() { protected List getPackages() { return Arrays.asList( new FabricPackage(), - new MainReactPackage() + new MainReactPackage(), + new InstabugPackage("dd90b37e48964a4c7324ecb686faf06b", MainApplication.this) ); } }; diff --git a/android/settings.gradle b/android/settings.gradle index bc6f2f0..970a0ff 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,5 +1,7 @@ rootProject.name = 'LagouApp' include ':app' +include ':react-native-instabug' +project(':react-native-instabug').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-instabug/android') include ':react-native-fabric' project(':react-native-fabric').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric/android') diff --git a/package.json b/package.json index 0c38a34..d5186e3 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ }, "dependencies": { "react": "15.3.1", - "react-native": "0.32.0", + "react-native": "0.35.0", "react-native-fabric": "^0.3.0", - "react-native-router-flux": "^3.35.0", - "react-native-swiper": "^1.4.11" + "react-native-instabug": "0.0.4", + "react-native-router-flux": "^3.35.0" } } diff --git a/src/pages/home/header.js b/src/pages/home/header.js index 0967238..c8d0cc8 100644 --- a/src/pages/home/header.js +++ b/src/pages/home/header.js @@ -1,61 +1,29 @@ -import React, { Component } from 'react'; +import React, {Component} from 'react'; import { - Text, - View, - Image, - StyleSheet + Text, + View, + Image, + StyleSheet } from 'react-native'; -import Swiper from 'react-native-swiper'; export default class HomeHeader extends Component { - render() { - return ( - - - - } - activeDot={} - paginationStyle={{ - bottom: -23, left: null, right: 10, - }} loop={true}> - Aussie tourist dies at Bali hotel}> - - - Big lie behind Nine’s new show}> - - - Why Stone split from Garfield}> - - - Learn from Kim K to land that job}> - - - - ) - } + render() { + return ( + This is PageOne! + ) + } } -const styles = StyleSheet.create({ - wrapper: { - }, - - slide: { - flex: 1, - justifyContent: 'center', - backgroundColor: 'transparent' - }, - - text: { - color: '#fff', - fontSize: 30, - fontWeight: 'bold' - }, - - image: { - flex: 1, - } -}) +const styles = { + text: { + color: '#fff', + fontSize: 30, + fontWeight: 'bold' + }, + + image: { + flex: 1, + } +}; diff --git a/src/pages/message/index.js b/src/pages/message/index.js index ec6f4ed..49cbb8b 100644 --- a/src/pages/message/index.js +++ b/src/pages/message/index.js @@ -10,7 +10,7 @@ import {Actions} from 'react-native-router-flux'; export default class MessageIndex extends Component { render() { return ( - + Welcome to Page2 {this.props.title} diff --git a/src/pages/rightButton.js b/src/pages/rightButton.js new file mode 100644 index 0000000..f47100f --- /dev/null +++ b/src/pages/rightButton.js @@ -0,0 +1,8 @@ +export function rightButton() { + return ( + + 收藏 + 分享 + + ); +} diff --git a/src/pages/rootRouter.js b/src/pages/rootRouter.js new file mode 100644 index 0000000..e27c8ef --- /dev/null +++ b/src/pages/rootRouter.js @@ -0,0 +1,94 @@ +import React, {Component} from 'react'; +import { + Text, + View +} from 'react-native'; +import {ActionConst, Router, Scene, Modal, Reducer} from 'react-native-router-flux'; + +// components +import navBarIcon from '../components/navTabIcon'; + +// pages +import HomeIndex from './home/index'; +import MessageIndex from './message/index'; +import MessageDetail from './message/detail'; +import Page3 from './page3'; +import MyIndex from './my/index'; +import {rightButton} from './rightButton' + +const reducerCreate = params => { + //https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js#L43 + const defaultReducer = Reducer(params); + let logData = { + key: null, + timeStamp: null + }; + return (state, action) => { + if (__DEV__) { + console.debug('ACTION:', action); + } + switch (action.type) { + case ActionConst.FOCUS: + logData = { + key: action.scene.name, + timeStamp: +new Date() + }; + break; + case ActionConst.BACK_ACTION: + case ActionConst.PUSH: + //viewStayLogger(logData, action.key); + logData = { + key: action.key, + timeStamp: +new Date() + }; + if (__DEV__) { + console.debug('logData', logData); + } + break; + default: + break; + } + return defaultReducer(state, action); + }; +}; + + +export default class RootRouter extends Component { + constructor(props) { + super(props); + this.state = {}; + } + + render() { + let rightButtonInner = () => { + return ( + + 收藏 + 分享 + + ); + } + + //code getSceneStyle https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js#L52 + //api getSceneStyle https://github.com/aksonov/react-native-router-flux/blob/master/docs/API_CONFIGURATION.md#router + //api getSceneStyle https://github.com/aksonov/react-native-router-flux/blob/master/docs/API_CONFIGURATION.md#scene-styles + return ( + + + + + + + alert("Left button!")} leftTitle="Left" + onRight={() => alert("Right button")} + rightTitle="Right"/> + + + + + ); + } +} diff --git a/src/pages/router.js b/src/pages/router.js deleted file mode 100644 index e06b4e1..0000000 --- a/src/pages/router.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, {Component} from 'react'; -import { - Text, - View -} from 'react-native'; -import {Router, Scene, Modal} from 'react-native-router-flux'; - -// components -import navBarIcon from '../components/navTabIcon'; - -// pages -import HomeIndex from './home/index'; -import MessageIndex from './message/index'; -import MessageDetail from './message/detail'; -import Page3 from './page3'; -import MyIndex from './my/index'; - -export default class Frame extends Component { - render() { - - let rightButton = () => { - return ( - - 收藏 - 分享 - - ); - }; - - return ( - - - - - - - alert("Left button!")} leftTitle="Left" - onRight={() => alert("Right button")} - rightTitle="Right"/> - - - - - ); - } -} diff --git a/src/pages/splash.js b/src/pages/splash.js index 98692ab..8236247 100644 --- a/src/pages/splash.js +++ b/src/pages/splash.js @@ -4,7 +4,7 @@ import { Image } from 'react-native'; -import Router from './router'; +import RootRouter from './rootRouter'; export default class Splash extends Component { constructor(props) { @@ -15,15 +15,15 @@ export default class Splash extends Component { componentDidMount() { this.timer = setTimeout(() => { this._navigateToFrame() - }, 2000); + }, 20); } _navigateToFrame() { let {navigator} = this.props; if (navigator) { navigator.replace({ - name: 'router', - component: Router + name: 'rootRouter', + component: RootRouter }) } }