enhanced process

This commit is contained in:
Ugur Erdal 2018-12-01 14:22:04 +03:00
parent 8af537aff4
commit fa8875e3e7
3 changed files with 13 additions and 8 deletions

View File

@ -70,7 +70,7 @@ class BasicHeaderView extends Component {
isModalHeader,
handleOnPressClose,
isHasSearch,
isPostSending,
isLoading,
handleOnSaveButtonPress,
isDraftSaving,
isDraftSaved,
@ -169,7 +169,7 @@ class BasicHeaderView extends Component {
iconStyle={styles.rightIcon}
name={isPreviewActive ? 'ios-eye' : 'ios-eye-off'}
/>
{!isPostSending ? (
{!isLoading ? (
<TextButton
textStyle={[
styles.textButton,

View File

@ -38,6 +38,7 @@ class EditorContainer extends Component {
isCameraOrPickerOpen: false,
autoFocusText: false,
uploadedImage: null,
isUploading: false,
};
}
@ -81,8 +82,8 @@ class EditorContainer extends Component {
_handleOpenImagePicker = () => {
ImagePicker.openPicker({
width: 1500,
height: 800,
width: 300,
height: 400,
cropping: true,
// writeTempFile: true,
// includeBase64: true,
@ -112,7 +113,7 @@ class EditorContainer extends Component {
};
_handleMediaOnSelected = (media) => {
this.setState({ isCameraOrPickerOpen: false }, () => {
this.setState({ isCameraOrPickerOpen: false, isUploading: true }, () => {
this._uploadImage(media);
});
// For new image api
@ -137,11 +138,12 @@ class EditorContainer extends Component {
uploadImage(file)
.then((res) => {
if (res.data) {
this.setState({ uploadedImage: res.data });
this.setState({ uploadedImage: res.data, isUploading: false });
}
})
.catch((error) => {
alert(error);
this.setState({ isUploading: false });
});
};
@ -229,6 +231,7 @@ class EditorContainer extends Component {
autoFocusText,
uploadedImage,
isPostSending,
isUploading,
} = this.state;
return (
@ -247,6 +250,7 @@ class EditorContainer extends Component {
isLoggedIn={isLoggedIn}
isOpenCamera={isOpenCamera}
uploadedImage={uploadedImage}
isUploading={isUploading}
/>
);
}

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { View } from 'react-native';
import { View, ActivityIndicator, Text } from 'react-native';
import { injectIntl } from 'react-intl';
// Utils
@ -131,6 +131,7 @@ class EditorScreen extends Component {
isLoggedIn,
isPostSending,
uploadedImage,
isUploading,
} = this.props;
return (
@ -144,7 +145,7 @@ class EditorScreen extends Component {
isFormValid={isFormValid}
isHasIcons
isLoggedIn={isLoggedIn}
isPostSending={isPostSending}
isLoading={isPostSending || isUploading}
isPreviewActive={isPreviewActive}
quickTitle={wordsCount > 0 && `${wordsCount} words`}
/>