Authored by 于良

react native 版本升级 0.30.0 review by 盖剑秋

... ... @@ -17,7 +17,7 @@ const Platform = require('Platform');
const PointPropType = require('PointPropType');
const RCTScrollViewManager = require('NativeModules').ScrollViewManager;
const React = require('React');
const ReactNative = require('ReactNative');
const ReactNative = require('react/lib/ReactNative');
const ScrollResponder = require('ScrollResponder');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
... ... @@ -489,7 +489,6 @@ const ScrollView = React.createClass({
!this.props.horizontal;
const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
const props = {
...this.props,
alwaysBounceHorizontal,
... ... @@ -568,6 +567,7 @@ const ScrollView = React.createClass({
const styles = StyleSheet.create({
baseVertical: {
flex: 1,
flexDirection: 'column',
},
baseHorizontal: {
flex: 1,
... ...
... ... @@ -195,27 +195,6 @@ class NavBar extends React.Component {
this.renderTitle = this.renderTitle.bind(this);
}
componentDidMount() {
if (Platform.OS === 'android') {
BackAndroid.addEventListener('hardwareBackPress', this.onBackAndroid);
}
}
componentWillUnmount() {
if (Platform.OS === 'android') {
BackAndroid.removeEventListener('hardwareBackPress', this.onBackAndroid);
}
}
onBackAndroid = () => {
let sceneKey = this.props.navigationState.sceneKey;
if (CONFIG.sceneKey.root === sceneKey) {
Actions.pop();
return true;
}
return false;
}
renderBackButton() {
const state = this.props.navigationState;
const childState = state.children[state.index];
... ...
'use strict';
/******************************
*
* 注意每次更新 react-native-router-flux 版本,
* 都要检查此方法是否需要更新!!!!!!!!!
*
*******************************/
export function shouldShowTabBar(navigationState) {
let key = navigationState.key;
let index = key.substring(0, 1);
return index == 1;
let index = getSceneIndex(navigationState);
return index == 1; // 只有从home的下一个scene返回至home时才需要显示tab bar
}
export function shouldHideTabBar(navigationState) {
let key = navigationState.key;
let index = key.substring(0, 1);
return index != 0;
let index = getSceneIndex(navigationState);
return index !== 0; // 非home的scene都需要隐藏tab bar
}
function getSceneIndex(navigationState) {
let {initial, key, parent, name, clone} = navigationState;
let index = 0;
if (initial) {
// 如果是initial是ture的scene,则key的格式是`${position}_${name}`
// 0_Home
index = key.substring(0, 1);
} else {
// 如果是initial是false
// 如果clone是true,则key的格式是`${parent}_${name}_${position}_${name}`
// root_Section_10_Section
// 如果clone是false,则key的格式是`${name}_${position}_${name}`
// Posting_11_Posting
let prefix = clone ? `${parent}_${name}_` : `${name}_`;
let start = prefix.length;
let stop = key.lastIndexOf('_');
index = key.substring(start, stop);
}
console.log(key);
console.log(index);
return index;
}
... ...
... ... @@ -13,18 +13,17 @@
"moment": "^2.13.0",
"object-assign": "^4.1.0",
"query-string": "^4.2.2",
"react": "15.1.0",
"react": "^15.2.1",
"react-immutable-proptypes": "^1.7.1",
"react-native": "^0.28.0",
"react-native": "^0.30.0",
"react-native-device-info": "^0.9.3",
"react-native-fabric": "^0.2.2",
"react-native-progress": "^3.0.1",
"react-native-fabric": "0.2.2",
"react-native-router-flux": "^3.30.2",
"react-native-progress": "^3.0.1",
"react-native-router-flux": "^3.32.0",
"react-native-scrollable-mixin": "^1.0.1",
"react-native-scrollable-tab-view": "^0.5.1",
"react-native-scrollable-tab-view": "^0.5.3",
"react-native-simple-store": "^1.0.1",
"react-native-swiper": "^1.4.5",
"react-native-swiper": "^1.4.7",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
... ...