Authored by 盖剑秋

Fix UI bugs. reviewed by redding.

... ... @@ -249,6 +249,7 @@ export default class SubjectPost extends Component {
autoCapitalize={'none'}
autoCorrect={false}
autoFocus={true}
maxLength={1000}
onChangeText={
(text)=>{
this.replyContent = text;
... ... @@ -259,6 +260,11 @@ export default class SubjectPost extends Component {
}
}
}
onKeyPress={(event)=>{
if (this.replyContent >= 1000) {
NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
}
}}
/>
<Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text>
</View>
... ... @@ -288,6 +294,7 @@ export default class SubjectPost extends Component {
autoCapitalize={'none'}
autoCorrect={false}
autoFocus={true}
maxLength={1000}
onChangeText={
(text)=>{
this.replyContent = text;
... ... @@ -298,6 +305,11 @@ export default class SubjectPost extends Component {
}
}
}
onKeyPress={(event)=>{
if (this.replyContent >= 1000) {
NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
}
}}
/>
<Text style={[styles.submitText, {color:this.state.replyTextColor}]} onPress={this.commitComment}>发送</Text>
</View>
... ... @@ -313,7 +325,7 @@ export default class SubjectPost extends Component {
}
commitComment() {
if (this.replyContent.length == 0) {
if (this.replyContent.length == 0 && !this.props.assets.length) {
Alert.alert('抱歉','请先输入内容');
return;
}
... ... @@ -356,6 +368,7 @@ export default class SubjectPost extends Component {
replyTo,
}
this.props.commentWithParams(params, fakeComment);
this.replyContent = '';
this.blurAll();
}
renderRow(rowData, sectionId) {
... ...
... ... @@ -104,7 +104,7 @@ class SubjectPostContainer extends Component {
onEndReached() {
let item = this.props.subject.items.get(this.sid);
if (item.currentPage>=item.totalPages) {
if (item.commentReachEnd) {
return;
}
this.props.actions.requestPostComments(this.sid, item.id, item.lastedTime);
... ...
... ... @@ -422,6 +422,7 @@ export function assetsSelected(sid,assets) {
export function commentWithParams(sid,params, newList) {
return (dispatch, getState) => {
NativeModules.YH_CommunityAssetsPicker.resetState();
dispatch(startComment(sid));
let {subject} = getState();
let item = subject.items.get(sid);
... ...