diff --git a/src/containers/profileEditContainer.js b/src/containers/profileEditContainer.js index 4e49d8dea..353411702 100644 --- a/src/containers/profileEditContainer.js +++ b/src/containers/profileEditContainer.js @@ -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)=>)); const IMAGE_PICKER_AVATAR_OPTIONS = { includeBase64: true, diff --git a/src/screens/profileEdit/screen/profileEditScreen.js b/src/screens/profileEdit/screen/profileEditScreen.js index 5b5df2897..2750e0f2d 100644 --- a/src/screens/profileEdit/screen/profileEditScreen.js +++ b/src/screens/profileEdit/screen/profileEditScreen.js @@ -33,11 +33,11 @@ class ProfileEditScreen extends PureComponent { }; render() { - const { intl } = this.props; + const { intl, route } = this.props; const { selectedUploadAction } = this.state; return ( - + {({ currentAccount, isDarkTheme,