Authored by 于良

限定导航栏标题长度和行数 review by yewanwan

1 'use strict'; 1 'use strict';
2 2
3 import React from 'react'; 3 import React from 'react';
4 -import {AppRegistry, Platform, StyleSheet} from 'react-native'; 4 +import {AppRegistry, Platform, StyleSheet, Dimensions} from 'react-native';
5 5
6 import { 6 import {
7 Provider, 7 Provider,
@@ -353,5 +353,7 @@ let styles = StyleSheet.create({ @@ -353,5 +353,7 @@ let styles = StyleSheet.create({
353 }, 353 },
354 navTitle: { 354 navTitle: {
355 color: 'white', 355 color: 'white',
  356 + marginLeft: 60,
  357 + marginRight: 60,
356 }, 358 },
357 }); 359 });
@@ -128,8 +128,9 @@ const styles = StyleSheet.create({ @@ -128,8 +128,9 @@ const styles = StyleSheet.create({
128 }, 128 },
129 userInfoTitle: { 129 userInfoTitle: {
130 position: 'absolute', 130 position: 'absolute',
131 - left: 0, 131 + left: 60,
132 right: 0, 132 right: 0,
  133 + width: Dimensions.get('window').width - 120,
133 bottom: 33, 134 bottom: 33,
134 fontSize: 14, 135 fontSize: 14,
135 textAlign: 'center', 136 textAlign: 'center',
@@ -383,6 +384,7 @@ class NavBar extends React.Component { @@ -383,6 +384,7 @@ class NavBar extends React.Component {
383 return ( 384 return (
384 <Animated.Text 385 <Animated.Text
385 key={childState.key} 386 key={childState.key}
  387 + numberOfLines={1}
386 style={[ 388 style={[
387 styles.title, 389 styles.title,
388 this.props.titleStyle, 390 this.props.titleStyle,
@@ -415,7 +417,7 @@ class NavBar extends React.Component { @@ -415,7 +417,7 @@ class NavBar extends React.Component {
415 const shopName = this.props.getShopName ? this.props.getShopName(childState) : ''; 417 const shopName = this.props.getShopName ? this.props.getShopName(childState) : '';
416 return ( 418 return (
417 <View style={styles.userInfoContainer} > 419 <View style={styles.userInfoContainer} >
418 - <Text style={styles.userInfoTitle}>{shopName}</Text> 420 + <Text style={styles.userInfoTitle} numberOfLines={1}>{shopName}</Text>
419 <TouchableOpacity 421 <TouchableOpacity
420 onPress={() => {Actions.Logout();}} 422 onPress={() => {Actions.Logout();}}
421 style={styles.whiteArrow} 423 style={styles.whiteArrow}