fixed editor bugs

This commit is contained in:
u-e 2019-05-17 21:23:04 +03:00
parent dbd667fd65
commit 303b8b81c7
3 changed files with 19 additions and 12 deletions

View File

@ -48,6 +48,7 @@ class PostDisplayContainer extends Component {
_handleOnReplyPress = () => { _handleOnReplyPress = () => {
const { post, navigation } = this.props; const { post, navigation } = this.props;
navigation.navigate({ navigation.navigate({
routeName: ROUTES.SCREENS.EDITOR, routeName: ROUTES.SCREENS.EDITOR,
params: { params: {
@ -60,14 +61,20 @@ class PostDisplayContainer extends Component {
_handleOnEditPress = () => { _handleOnEditPress = () => {
const { post, navigation } = this.props; const { post, navigation } = this.props;
if (post) {
const isReply = post.parent_author;
navigation.navigate({ navigation.navigate({
routeName: ROUTES.SCREENS.EDITOR, routeName: ROUTES.SCREENS.EDITOR,
params: { params: {
isEdit: true, isEdit: true,
isReply,
post, post,
fetchPost: this._fetchPost, fetchPost: this._fetchPost,
}, },
}); });
}
}; };
_fetchPost = async () => { _fetchPost = async () => {

View File

@ -274,9 +274,9 @@ class EditorContainer extends Component {
}; };
_saveCurrentDraft = async (fields) => { _saveCurrentDraft = async (fields) => {
const { draftId, isReply } = this.state; const { draftId, isReply, isEdit } = this.state;
if (!draftId) { if (!draftId && !isEdit) {
const { currentAccount } = this.props; const { currentAccount } = this.props;
const username = currentAccount && currentAccount.name ? currentAccount.name : ''; const username = currentAccount && currentAccount.name ? currentAccount.name : '';
@ -408,8 +408,8 @@ class EditorContainer extends Component {
0, 0,
) )
.then(() => { .then(() => {
this._handleSubmitSuccess();
AsyncStorage.setItem('temp-reply', ''); AsyncStorage.setItem('temp-reply', '');
this._handleSubmitSuccess();
}) })
.catch((error) => { .catch((error) => {
this._handleSubmitFailure(error); this._handleSubmitFailure(error);

View File

@ -53,11 +53,11 @@ export default EStyleSheet.create({
}, },
postTabBar: { postTabBar: {
backgroundColor: '$primaryBackgroundColor', backgroundColor: '$primaryBackgroundColor',
flex: 1,
}, },
commentsTabBar: { commentsTabBar: {
backgroundColor: '$primaryBackgroundColor', backgroundColor: '$primaryBackgroundColor',
paddingHorizontal: 16, paddingHorizontal: 16,
paddingVertical: 5, paddingVertical: 5,
}, },
tabBarTitle: {},
}); });