Authored by 于良

Merge branch 'local' into develop

... ... @@ -153,6 +153,12 @@ export default class Home extends React.Component {
this.triggerPullToRefresh();
}
componentWillReceiveProps(nextProps) {
if (nextProps.scrollToTop) {
this.listView.scrollTo({x: 0, y: 0, animated: false, });
}
}
triggerPullToRefresh() {
InteractionManager.runAfterInteractions(() => {
this.listView && this.listView.getScrollResponder().startPullToRefresh();
... ...
... ... @@ -12,6 +12,7 @@ import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import UploadProgress from '../home/UploadProgress';
import SuperMan from '../home/SuperMan';
import TimerMixin from 'react-timer-mixin';
import {Actions} from 'react-native-router-flux';
const {
View,
... ... @@ -161,8 +162,14 @@ export default class Section extends React.Component {
});
}
componentWillReceiveProps(nextProps) {
if (nextProps.scrollToTop) {
this.listView.scrollTo({x: 0, y: 0, animated: false, });
}
}
componentWillUnmount() {
this.timer && clearTimeout(this.timer);
}
_renderRow(rowData, sectionID, rowID, highlightRow) {
... ...
... ... @@ -101,7 +101,7 @@ export default class Setting extends React.Component {
this.props.signEdited(text);
}}
onKeyPress={(event) => {
if (this.signLength >= 50) {
if (this.signLength >= 40) {
Alert.alert('抱歉','超出40字符最长限制');
}
}}
... ...
... ... @@ -233,6 +233,13 @@ class HomeContainer extends React.Component {
let containerStyle = parseInt(this.props.app.container) === 1 ? null : {marginBottom: 64};
let scrollToTop = false;
if (this.props.route.scene && this.props.route.scene.sceneKey == 'Posting') {
if (this.props.posting.canSubmit) {
scrollToTop = true;
}
}
return (
<View style={[styles.container, containerStyle]}>
<Home
... ... @@ -268,6 +275,7 @@ class HomeContainer extends React.Component {
onUploadDelete={this._onUploadDelete}
onSaveingTheWorld={this._onSaveingTheWorld}
ptrError={error}
scrollToTop={scrollToTop}
/>
</View>
);
... ...
... ... @@ -210,6 +210,13 @@ class SectionContainer extends React.Component {
let noticeData = notice.open === 'Y' ? Immutable.fromJS([notice.list]) : List();
let {profile} = this.props.user;
let scrollToTop = false;
if (this.props.route.scene && this.props.route.scene.sceneKey == 'Posting') {
if (this.props.posting.canSubmit) {
scrollToTop = true;
}
}
return (
<View style={styles.container}>
<Section
... ... @@ -235,6 +242,7 @@ class SectionContainer extends React.Component {
isLoadingMore={isLoadingMore}
onEndReached={this._onEndReached}
onSaveingTheWorld={this._onSaveingTheWorld}
scrollToTop={scrollToTop}
/>
</View>
);
... ...
... ... @@ -84,7 +84,7 @@ export function postingEventLogOut() {
export function startEditPost(postingState) {
return (dispatch, getState) => {
let {posting, user} = getState();
if (posting.postState.isPosting) {
if (posting.postState.isPosting || posting.postState.showProcess) {
Alert.alert('抱歉','您有正在发送的帖子,请耐心等待~');
return;
}
... ...