Source

containers/Custom/MyLibraryScreen.ts

// @flow
import {mapProps, compose} from "recompose";

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

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

/**
 * You can use this component to display the MyLibrary screen in your custom screen.
 *
 * @component
 * @example
 *
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import { View } from 'react-native';
 * import MyLibraryScreen from "@src/containers/Custom/MyLibraryScreen";
 *
 * const MyCustomScreen = (props) => {
 *
 *  return (
 *    <View style={{ flex: 1 }}>
 *        <MyLibraryScreen {...props} hideNavigationHeader={false} screenTitle="My Downloaded Courses" showSearch={false}/>
 *    </View>)
 * }
 *
 *
 * 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 MyLibraryScreen = compose(
	withNavigation,
	withActiveCallBacks,
	mapProps(buildFilterProps)
)(LibraryScreen);

MyLibraryScreen.propTypes = {
	/**
	 * List screen title. Default comes from translation files in BuddyBoss site
	 * {String}
	 */
	screenTitle: PropTypes.string,
	/**
	 * Use `false` to hide search box
	 * {Boolean}
	 */
	showSearch: PropTypes.bool,
	/**
	 * Use `true` to hide title of the screen
	 * {Boolean}
	 */
	hideTitle: PropTypes.bool,
	/**
	 * Use `true` to hide the screen title container when scrolling
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool,
	/**
	 * Define header height
	 * {Number}
	 */
	headerHeight: PropTypes.number
};

export default MyLibraryScreen;