Source

containers/Custom/ProfileScreen.ts

import {compose} from "recompose";
import withActiveCallBacks from "../../navigators/react-navigation-addons/withActiveCallBacks";
import {withNavigation} from "../../components/hocs/withNavigation";
import Profile from "../ProfileScreen";
import PropTypes from "prop-types";
import withLoadProfile from "../../components/hocs/withLoadProfile";

/**
 * You can use this component to display your Profile screen in your custom screen.
 *
 * @component
 * @example
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import ProfileScreen from "@src/containers/Custom/ProfileScreen";
 *
 * const MyCustomScreen = (props) => (<ProfileScreen userId={3} searchTerm="Steve" {...props} />)
 *
 * export default MyCustomScreen;
 *
 * //In custom_code/index.js...
 *
 * import MyCustomScreen from "./components/MyCustomScreen";
 * export const applyCustomCode = externalCodeSetup => {
 *
 *  externalCodeSetup.navigationApi.addNavigationRoute(
 *    "book",
 *    "BookScreen",
 *    MyCustomScreen,
 *    "All"
 *  );
 *  externalCodeSetup.navigationApi.addNavigationRoute(
 *    "book",
 *    "BookScreen",
 *    MyCustomScreen,
 *    "Main"
 *  );
 *
 * }
 */

const ProfileScreen = compose(
	withNavigation,
	withActiveCallBacks
)(Profile);

ProfileScreen.propTypes = {
	/**
	 * You can use this to display a specific user's profile by assigning their userId as this props's value
	 * {Number}
	 */
	userId: PropTypes.number,
	/**
	 * If the user is not yet available in the app state, the component will attempt to load a list of users.
	 * You can use this field to search for the specific user you want to load instead of loading a list of users.
	 * {String}
	 */
	searchTerm: PropTypes.string,
	/**
	 * Use `true` to hide the screen title container when scrolling
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool,
	/**
	 * Use this to display your own loading component while the screen is loading
	 * {ReactComponent}
	 */
	LoadingComponent: PropTypes.elementType
};

export default withLoadProfile(ProfileScreen);