Source

containers/Custom/CoursesCertificateScreen.ts

import {mapProps, compose} from "recompose";
import withLearndashLabels from "../../components/hocs/withLearnDashTranslations";

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

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

/**
 * You can use this component to display your Course Certificate screen in your custom screen.
 * @component
 * @example
 *
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import { View } from 'react-native';
 *
 * import {useScreenProps} from "@src/navigators/v5/ScreenPropsProvider";
 * import CoursesCertificateScreen from "@src/containers/Custom/CoursesCertificateScreen";
 * const MyCustomScreen = (props) => {
 *
 *   const {auth} = useScreenProps(["auth"]);
 *
 *  const title = `Certificates of ${auth.user.user_nicename}`
 *
 *  return (
 *   <View style={{ flex: 1 }}>
 *     <CoursesCertificateScreen {...props} screenTitle={title}/>
 *   </View>)
 * }
 *
 * export default MyCustomScreen;
 *
 * //In custom_code/index.js...
 *
 * import MyCustomScreen from "./components/MyCustomScreen";
 *
 * export const applyCustomCode = externalCodeSetup => {
 *  //Replace the course certificates screen
 *  externalCodeSetup.navigationApi.replaceScreenComponent("course_certificates", MyCustomScreen);
 * }
 */

export const CoursesCertificateScreen = compose(
	withLearndashLabels,
	withNavigation,
	withActiveCallBacks,
	mapProps(buildFilterProps)
)(EnhancedCertificates);

const pt = PropTypes;
CoursesCertificateScreen.propTypes = {
	/**
	 * List screen title. Default comes from translation files in BuddyBoss site
	 * {String}
	 */
	screenTitle: PropTypes.string,
	/**
	 * Use `true` to hide the screen title container when scrolling
	 * {Boolean}
	 */
	hideNavigationHeader: PropTypes.bool
};

export default CoursesCertificateScreen;