Source

containers/Custom/Profile/ProfileActivitiesScreen.ts

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

/**
 * You can use this component to display the Profile Activites Screen in your custom screen.
 * @component
 * @example <caption> Replace a screen from the menu tab to show only a specific user's activities </caption>
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import ProfileActivitiesScreen from '@src/containers/Custom/Profile/ProfileActivitiesScreen';
 * const MyCustomScreen = (props) => {
 *
 *  if (!props.isFocused)
 *    return null;
 *
 *  return <ProfileActivitiesScreen
 *      userId={2}
 *      screenTitle="Timeline of Tony"
 *      searchTerm={"Tony"}
 *      hideBackButton={true}
 *      // hideNewActivityButton={false}
 *      // hideNavigationHeader={false}
 *      // headerHeight={80}
 *      {...props}
 *    />
 *
 * }
 *
 * export default MyCustomScreen;
 *
 * //In custom_code/index.js...
 *
 * ...
 *
 * import MyCustomScreen from "./components/MyCustomScreen";
 * export const applyCustomCode = externalCodeSetup => {
 *   externalCodeSetup.navigationApi.replaceScreenComponent("blog", MyCustomScreen);
 * }
 *
 */
const ProfileActivitiesScreen = compose(
	withNavigation,
	withActiveCallBacks
)(ProfileActivities);

export default withLoadProfile(ProfileActivitiesScreen);

ProfileActivitiesScreen.propTypes = {
	/**
	 * You can use this to display a specific user's profile activities by assigning their userId as this props's value
	 * {Number}
	 */
	userId: PropTypes.number,
	/**
	 * List screen title
	 * {String}
	 */
	screenTitle: PropTypes.string,
	/**
	 * 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 back button.
	 * By default, the button will use react-navigation's goBack() function.
	 * This can be changed using the `setBackButtonRenderer` hook.
	 * {Boolean}
	 */
	hideBackButton: PropTypes.bool,
	/**
	 * Use `true` to hide the new activity button
	 * {Boolean}
	 */
	hideNewActivityButton: PropTypes.bool,
	/**
	 * Use `true` to hide the screen title container when scrolling
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool,
	/**
	 * Define header height
	 * {Number}
	 */
	headerHeight: PropTypes.number,
	/**
	 * Use this to display your own loading component while the screen is loading
	 * {ReactComponent}
	 */
	LoadingComponent: PropTypes.elementType
};