preview icon on/off, fix autosave draft issue

This commit is contained in:
feruz 2020-01-27 06:12:19 +02:00
parent bf68f5dbc3
commit 21e21adeb4
2 changed files with 4 additions and 3 deletions

View File

@ -197,8 +197,8 @@ class BasicHeaderView extends Component {
size={25}
onPress={() => handleOnPressPreviewButton()}
iconStyle={styles.rightIcon}
iconType="MaterialIcons"
name={isPreviewActive ? 'remove-red-eye' : 'remove-red-eye'}
iconType="MaterialCommunityIcons"
name={isPreviewActive ? 'eye-off' : 'eye'}
/>
{!isLoading ? (
<TextButton

View File

@ -118,9 +118,10 @@ export const setDraftPost = async (fields, username) => {
body: fields.body,
};
if (draft.some(e => e.username === username)) {
if (draft && draft.some(e => e.username === username)) {
draft = draft.map(item => (item.username === username ? { ...item, ...data } : item));
} else {
draft = [];
draft.push(data);
}
await setItemToStorage(DRAFT_SCHEMA, draft);