mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-25 22:33:52 +03:00
profile edit migrate to useNavigation
This commit is contained in:
parent
5c582768a9
commit
ca4d95c4cf
@ -1,16 +1,16 @@
|
||||
import { Component } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { Alert } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import ImagePicker from 'react-native-image-crop-picker';
|
||||
import get from 'lodash/get';
|
||||
import { withNavigation } from '@react-navigation/compat';
|
||||
|
||||
import { uploadImage } from '../providers/ecency/ecency';
|
||||
|
||||
import { profileUpdate, signImage } from '../providers/hive/dhive';
|
||||
import { updateCurrentAccount } from '../redux/actions/accountAction';
|
||||
import { setAvatarCacheStamp } from '../redux/actions/uiAction';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
|
||||
// import ROUTES from '../constants/routeNames';
|
||||
|
||||
@ -145,7 +145,7 @@ class ProfileEditContainer extends Component {
|
||||
};
|
||||
|
||||
_handleOnSubmit = async () => {
|
||||
const { currentAccount, pinCode, dispatch, navigation, intl } = this.props;
|
||||
const { currentAccount, pinCode, dispatch, navigation, intl, route} = this.props;
|
||||
const { name, location, website, about, coverUrl, avatarUrl, pinned } = this.state;
|
||||
|
||||
this.setState({ isLoading: true });
|
||||
@ -171,7 +171,7 @@ class ProfileEditContainer extends Component {
|
||||
dispatch(updateCurrentAccount(_currentAccount));
|
||||
dispatch(setAvatarCacheStamp(new Date().getTime()));
|
||||
this.setState({ isLoading: false });
|
||||
navigation.state.params.fetchUser();
|
||||
route.params.fetchUser();
|
||||
navigation.goBack();
|
||||
} catch (err) {
|
||||
Alert.alert(
|
||||
@ -227,7 +227,12 @@ const mapStateToProps = (state) => ({
|
||||
pinCode: state.application.pin,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(injectIntl(withNavigation(ProfileEditContainer)));
|
||||
const mapHooksToProps = (props) => ({
|
||||
...props,
|
||||
navigation:useNavigation()
|
||||
})
|
||||
|
||||
export default connect(mapStateToProps)(injectIntl((props)=><ProfileEditContainer {...mapHooksToProps(props)}/>));
|
||||
|
||||
const IMAGE_PICKER_AVATAR_OPTIONS = {
|
||||
includeBase64: true,
|
||||
|
@ -33,11 +33,11 @@ class ProfileEditScreen extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { intl } = this.props;
|
||||
const { intl, route } = this.props;
|
||||
const { selectedUploadAction } = this.state;
|
||||
|
||||
return (
|
||||
<ProfileEditContainer>
|
||||
<ProfileEditContainer route={route}>
|
||||
{({
|
||||
currentAccount,
|
||||
isDarkTheme,
|
||||
|
Loading…
Reference in New Issue
Block a user