Source

containers/Custom/NotificationsScreen.ts

import {mapProps, compose} from "recompose";
import NotificationsScreenConnected from "../NotificationsScreen";

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

const buildFilterProps = props => ({
	navigation: props.navigation,
	...props
});

/**
 * You can use this component to display your Notifications screen in your custom screen.
 *
 * @component
 * @example <caption> Show read notifications only </caption>
 *
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import NotificationsScreen from "@src/containers/Custom/NotificationsScreen";
 *
 * const filters = ["read"]
 *
 * const MyCustomScreen = (props) => (
 *  <NotificationsScreen {...props} screenTitle="My Notifications" selectedFilter="read" notificationFilters={filters}/>
 * )
 *
 *
 * 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"
 *  );
 * }
 *
 */

export const NotificationsScreen = compose(
	withNavigation,
	withActiveCallBacks,
	mapProps(buildFilterProps)
)(NotificationsScreenConnected);

NotificationsScreen.propTypes = {
	/**
	 * List screen title. Default comes from translation files in BuddyBoss site
	 * {String}
	 */
	screenTitle: PropTypes.string,
	/**
	 * The amount by which the scroll view content is inset from the edges of the scroll view.
	 * {Number}
	 */
	contentInsetTop: PropTypes.number,
	/**
	 * Used to manually set the starting scroll offset.
	 * {Number}
	 */
	contentOffsetY: PropTypes.number,
	/**
	 * Use `unread` or `read` and assign it in an array to assign filters
	 * {Array}
	 */
	notificationFilters: PropTypes.array,
	/**
	 * Use `unread` or `read` to initialize selected filter
	 * {String}
	 */
	selectedFilter: PropTypes.string,
	/**
	 * Use `true` to hide the screen title container
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool,
	/**
	 * Use `true` to hide the scroll header
	 * {Boolean}
	 */
	hideScrollHeader: PropTypes.bool
};

export default NotificationsScreen;