Authored by 盖剑秋

Fix UI bugs. reviewed by redding.

@@ -249,6 +249,7 @@ export default class SubjectPost extends Component { @@ -249,6 +249,7 @@ export default class SubjectPost extends Component {
249 autoCapitalize={'none'} 249 autoCapitalize={'none'}
250 autoCorrect={false} 250 autoCorrect={false}
251 autoFocus={true} 251 autoFocus={true}
  252 + maxLength={1000}
252 onChangeText={ 253 onChangeText={
253 (text)=>{ 254 (text)=>{
254 this.replyContent = text; 255 this.replyContent = text;
@@ -259,6 +260,11 @@ export default class SubjectPost extends Component { @@ -259,6 +260,11 @@ export default class SubjectPost extends Component {
259 } 260 }
260 } 261 }
261 } 262 }
  263 + onKeyPress={(event)=>{
  264 + if (this.replyContent >= 1000) {
  265 + NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
  266 + }
  267 + }}
262 /> 268 />
263 <Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text> 269 <Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text>
264 </View> 270 </View>
@@ -288,6 +294,7 @@ export default class SubjectPost extends Component { @@ -288,6 +294,7 @@ export default class SubjectPost extends Component {
288 autoCapitalize={'none'} 294 autoCapitalize={'none'}
289 autoCorrect={false} 295 autoCorrect={false}
290 autoFocus={true} 296 autoFocus={true}
  297 + maxLength={1000}
291 onChangeText={ 298 onChangeText={
292 (text)=>{ 299 (text)=>{
293 this.replyContent = text; 300 this.replyContent = text;
@@ -298,6 +305,11 @@ export default class SubjectPost extends Component { @@ -298,6 +305,11 @@ export default class SubjectPost extends Component {
298 } 305 }
299 } 306 }
300 } 307 }
  308 + onKeyPress={(event)=>{
  309 + if (this.replyContent >= 1000) {
  310 + NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
  311 + }
  312 + }}
301 /> 313 />
302 <Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text> 314 <Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text>
303 </View> 315 </View>
@@ -313,7 +325,7 @@ export default class SubjectPost extends Component { @@ -313,7 +325,7 @@ export default class SubjectPost extends Component {
313 } 325 }
314 326
315 commitComment() { 327 commitComment() {
316 - if (this.replyContent.length == 0) { 328 + if (this.replyContent.length == 0 && !this.props.assets.length) {
317 Alert.alert('抱歉','请先输入内容'); 329 Alert.alert('抱歉','请先输入内容');
318 return; 330 return;
319 } 331 }
@@ -356,6 +368,7 @@ export default class SubjectPost extends Component { @@ -356,6 +368,7 @@ export default class SubjectPost extends Component {
356 replyTo, 368 replyTo,
357 } 369 }
358 this.props.commentWithParams(params, fakeComment); 370 this.props.commentWithParams(params, fakeComment);
  371 + this.replyContent = '';
359 this.blurAll(); 372 this.blurAll();
360 } 373 }
361 renderRow(rowData, sectionId) { 374 renderRow(rowData, sectionId) {
@@ -104,7 +104,7 @@ class SubjectPostContainer extends Component { @@ -104,7 +104,7 @@ class SubjectPostContainer extends Component {
104 104
105 onEndReached() { 105 onEndReached() {
106 let item = this.props.subject.items.get(this.sid); 106 let item = this.props.subject.items.get(this.sid);
107 - if (item.currentPage>=item.totalPages) { 107 + if (item.commentReachEnd) {
108 return; 108 return;
109 } 109 }
110 this.props.actions.requestPostComments(this.sid, item.id, item.lastedTime); 110 this.props.actions.requestPostComments(this.sid, item.id, item.lastedTime);
@@ -422,6 +422,7 @@ export function assetsSelected(sid,assets) { @@ -422,6 +422,7 @@ export function assetsSelected(sid,assets) {
422 422
423 export function commentWithParams(sid,params, newList) { 423 export function commentWithParams(sid,params, newList) {
424 return (dispatch, getState) => { 424 return (dispatch, getState) => {
  425 + NativeModules.YH_CommunityAssetsPicker.resetState();
425 dispatch(startComment(sid)); 426 dispatch(startComment(sid));
426 let {subject} = getState(); 427 let {subject} = getState();
427 let item = subject.items.get(sid); 428 let item = subject.items.get(sid);