Authored by 盖剑秋

Fix bugs of 7.18, reviewed by redding.

@@ -12,6 +12,7 @@ import ReactNative, { @@ -12,6 +12,7 @@ import ReactNative, {
12 Image, 12 Image,
13 Alert, 13 Alert,
14 Animated, 14 Animated,
  15 + Keyboard,
15 } from 'react-native'; 16 } from 'react-native';
16 17
17 import { 18 import {
@@ -228,6 +229,11 @@ export default function community(platform) { @@ -228,6 +229,11 @@ export default function community(platform) {
228 } 229 }
229 }} 230 }}
230 rightButtonTextStyle={[styles.barRightButtonText,{color:store.getState().posting.dataValid?'white':'#a0a0a0'}]} 231 rightButtonTextStyle={[styles.barRightButtonText,{color:store.getState().posting.dataValid?'white':'#a0a0a0'}]}
  232 + onBack={()=>{
  233 + let dismissKeyboard = require('dismissKeyboard');
  234 + dismissKeyboard();
  235 + Actions.pop();
  236 + }}
231 /> 237 />
232 238
233 </Scene> 239 </Scene>
@@ -296,8 +302,7 @@ export default function community(platform) { @@ -296,8 +302,7 @@ export default function community(platform) {
296 }, 302 },
297 303
298 homeOnRight(state) { 304 homeOnRight(state) {
299 - Actions.SubjectPost();  
300 - // state.dispatch(startEditPost(state.getPostingState())); 305 + state.dispatch(startEditPost(state.getPostingState()));
301 }, 306 },
302 /* 307 /*
303 * 自定义导航push动画 308 * 自定义导航push动画
@@ -17,6 +17,7 @@ import { @@ -17,6 +17,7 @@ import {
17 Easing, 17 Easing,
18 ScrollView, 18 ScrollView,
19 NativeModules, 19 NativeModules,
  20 + Alert,
20 } from 'react-native' 21 } from 'react-native'
21 22
22 import AssertsPicker from './AssertsPicker'; 23 import AssertsPicker from './AssertsPicker';
@@ -79,6 +80,9 @@ export default class Posting extends Component { @@ -79,6 +80,9 @@ export default class Posting extends Component {
79 } 80 }
80 81
81 showBoardPannel() { 82 showBoardPannel() {
  83 + if (this.props.fromSection) {
  84 + return;
  85 + }
82 this.boardInView= true; 86 this.boardInView= true;
83 87
84 this.setState({boardState:this.boardSelectionHeight,imageState:0}); 88 this.setState({boardState:this.boardSelectionHeight,imageState:0});
@@ -147,6 +151,8 @@ export default class Posting extends Component { @@ -147,6 +151,8 @@ export default class Posting extends Component {
147 maxLength={30} 151 maxLength={30}
148 numberOfLines={1} 152 numberOfLines={1}
149 autoFocus={true} 153 autoFocus={true}
  154 + autoCapitalize={'none'}
  155 + autoCorrect={false}
150 onChangeText={ 156 onChangeText={
151 (text)=>{ 157 (text)=>{
152 this.titleLength = text.length; 158 this.titleLength = text.length;
@@ -155,7 +161,9 @@ export default class Posting extends Component { @@ -155,7 +161,9 @@ export default class Posting extends Component {
155 } 161 }
156 onKeyPress={ 162 onKeyPress={
157 (event)=>{ 163 (event)=>{
  164 +
158 if (this.titleLength>=30) { 165 if (this.titleLength>=30) {
  166 + Alert.alert('抱歉','超出30字符最长限制');
159 console.log('满了'); 167 console.log('满了');
160 } 168 }
161 } 169 }
@@ -177,9 +185,11 @@ export default class Posting extends Component { @@ -177,9 +185,11 @@ export default class Posting extends Component {
177 this.props.contentEdited(text); 185 this.props.contentEdited(text);
178 } 186 }
179 } 187 }
  188 +
180 onKeyPress={ 189 onKeyPress={
181 (event)=>{ 190 (event)=>{
182 if (this.contentLength>=2000) { 191 if (this.contentLength>=2000) {
  192 + Alert.alert('抱歉','超出2000字符最长限制');
183 console.log('满了'); 193 console.log('满了');
184 } 194 }
185 } 195 }
@@ -215,10 +225,11 @@ export default class Posting extends Component { @@ -215,10 +225,11 @@ export default class Posting extends Component {
215 <View style={[styles.boardSelectionContainer,{height:this.state.boardState,}]} opacity={this.state.boardState}> 225 <View style={[styles.boardSelectionContainer,{height:this.state.boardState,}]} opacity={this.state.boardState}>
216 <View style={styles.boardSelectionScroll}> 226 <View style={styles.boardSelectionScroll}>
217 {this.props.boards.map((item,i)=>{ 227 {this.props.boards.map((item,i)=>{
  228 + let bgColor = item.forumName === this.props.selectedBoard?'#cccccc':'white'
218 return( 229 return(
219 <Text 230 <Text
220 key={i} 231 key={i}
221 - style={styles.boardSelectionItem} 232 + style={[styles.boardSelectionItem,{backgroundColor: bgColor}]}
222 onPress={event=>{ 233 onPress={event=>{
223 this.props.onBoardPress(item.forumName,item.forumCode); 234 this.props.onBoardPress(item.forumName,item.forumCode);
224 // this.blurAll(); 235 // this.blurAll();
@@ -249,7 +260,7 @@ const styles = StyleSheet.create({ @@ -249,7 +260,7 @@ const styles = StyleSheet.create({
249 left: 0, 260 left: 0,
250 top:0, 261 top:0,
251 height:44, 262 height:44,
252 - padding:15, 263 + padding:14,
253 color: 'black', 264 color: 'black',
254 fontSize: 15, 265 fontSize: 15,
255 }, 266 },
@@ -64,13 +64,19 @@ class PostingContainer extends Component{ @@ -64,13 +64,19 @@ class PostingContainer extends Component{
64 } 64 }
65 65
66 componentDidMount() { 66 componentDidMount() {
  67 + if (this.props.section.name.length && this.props.section.id>0) {
  68 + this.boardSelectedWithName(this.props.section.name,this.props.section.id);
  69 +
  70 + }else {
  71 + InteractionManager.runAfterInteractions(() => {
  72 + this._onGetBordList();
  73 + });
  74 + }
67 if (shouldHideTabBar(this.props.navigationState)) { 75 if (shouldHideTabBar(this.props.navigationState)) {
68 NativeModules.YH_CommunityHelper.hideTabBar(); 76 NativeModules.YH_CommunityHelper.hideTabBar();
69 } 77 }
70 78
71 - InteractionManager.runAfterInteractions(() => {  
72 - this._onGetBordList();  
73 - }); 79 +
74 } 80 }
75 81
76 _onGetBordList() { 82 _onGetBordList() {
@@ -128,6 +134,7 @@ class PostingContainer extends Component{ @@ -128,6 +134,7 @@ class PostingContainer extends Component{
128 contentEdited={this.contentEdited} 134 contentEdited={this.contentEdited}
129 titleValue={this.props.posting.title} 135 titleValue={this.props.posting.title}
130 contentValue={this.props.posting.content} 136 contentValue={this.props.posting.content}
  137 + fromSection={this.props.section.name.length && this.props.section.id>0}
131 /> 138 />
132 </View> 139 </View>
133 ); 140 );