/* @flow */
import { connect } from 'react-redux';

import React, { PureComponent } from 'react';

import type { Auth, Dispatch, GlobalState, Orientation, User, PresenceState } from '../types';
import { getAuth, getSession, getAccountDetailsUserFromEmail, getPresence } from '../selectors';
import { Screen } from '../common';
import AccountDetails from './AccountDetails';
import { connectPreserveOnBackOption } from '../utils/redux';

type Props = {
  auth: Auth,
  user: User,
  orientation: Orientation,
  dispatch: Dispatch,
  presence: PresenceState,
};

class AccountDetailsScreen extends PureComponent<Props> {
  props: Props;

  render() {
    const { auth, dispatch, orientation, user, presence } = this.props;
    const title = {
      text: '{_}',
      values: {
        // This causes the name not to get translated.
        _: user.full_name || ' ',
      },
    };

    return (
      <Screen title={title}>
        <AccountDetails
          auth={auth}
          dispatch={dispatch}
          user={user}
          presence={presence[user.email]}
          orientation={orientation}
        />
      </Screen>
    );
  }
}

export default connect(
  (state: GlobalState, props: Object) => ({
    auth: getAuth(state),
    user: getAccountDetailsUserFromEmail(props.navigation.state.params.email)(state),
    orientation: getSession(state).orientation,
    presence: getPresence(state),
  }),
  null,
  null,
  connectPreserveOnBackOption,
)(AccountDetailsScreen);

@@ -370,70 +370,8 @@
 ls';
-%0Aimport %7B connectPreserveOnBackOption %7D from '../utils/redux';
 %0A%0Aty
@@ -1095,19 +1095,16 @@
 connect(
-%0A  
 (state: 
@@ -1137,18 +1137,16 @@
 ) =%3E (%7B%0A
-  
   auth: 
@@ -1161,18 +1161,16 @@
 state),%0A
-  
   user: 
@@ -1247,18 +1247,16 @@
 ate),%0A  
- 
- 
 orientat
@@ -1291,18 +1291,16 @@
 tation,%0A
-  
   presen
@@ -1327,61 +1327,10 @@
 e),%0A
-  %7D),%0A  null,%0A  null,%0A  connectPreserveOnBackOption,%0A
+%7D)
 )(Ac

Drop "onBack" hack which prevented renders.