Source

containers/Custom/BlockScreen.ts

import {compose} from "recompose";
import Block from "../BlockScreen";
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 Block screen in your custom screen.
 * @component
 * @example
 *
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import BlockScreen from "@src/containers/Custom/BlockScreen";
 *
 * const MyCustomScreen = (props) => {
 *
 *  if (!props.isFocused)
 *    return null;
 *
 *  return (
 *    <BlockScreen pageId={33}
 *      screenTitle="Home Screen"
 *      contentInsetTop={0}
 *      contentOffsetY={0}
 *      hideNavigationHeader={true}
 *      {...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"
 *  );
 *
 * }
 */

export const BlockScreen = compose(
	withNavigation,
	withActiveCallBacks
)(Block);

BlockScreen.propTypes = {
	/**
	 * Id of the app page to be used in the block screen
	 * {Number}
	 */
	pageId: PropTypes.number,
	/**
	 * List screen title
	 * {String}
	 */
	screenTitle: PropTypes.string,
	/**
	 * Use `true` to hide title of the screen
	 * {Boolean}
	 */
	hideTitle: PropTypes.bool,
	/**
	 * Use `true` to hide the screen title container
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool,
	/**
	 * 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
};

export default BlockScreen;