fixed editor bugs

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

View File

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

View File

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

View File

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