import {compose} from "recompose";
import ForumsSingleScreenEnh from "../ForumsSingleScreen";
import withActiveCallBacks from "../../navigators/react-navigation-addons/withActiveCallBacks";
import {withNavigation} from "../../components/hocs/withNavigation";
import PropTypes from "prop-types";
import withLoadForum from "../../components/hocs/withLoadForum";
/**
* You can use this component to display your Forum single screen in your custom screen.
* @component
* @example <caption> Use ForumsSingleScreen in custom navigation route "book" </caption>
* //In custom_code/components/MyCustomScreen.js
* import React from 'react';
* import { View, Text } from 'react-native';
* import ForumsSingleScreen from "@src/containers/Custom/ForumsSingleScreen";
*
* const MyCustomScreen = (props) => {
*
* if (! props.isFocused)
* return null;
*
* return (
* <View style={{ flex: 1 }}>
*
* <View style={{ marginTop: 50, alignSelf: "center" }}>
* <Text>
* My App Title
* </Text>
*
* </View>
*
* <View style={{ flex: 1, marginBottom: 80 }}>
* <ForumsSingleScreen forumId={198} />
* </View>
* </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"
* );
* }
*
*/
const ForumsSingleScreen = compose(
withNavigation,
withActiveCallBacks
)(
//@ts-expect-error
ForumsSingleScreenEnh
);
export default withLoadForum(ForumsSingleScreen);
ForumsSingleScreen.propTypes = {
/**
* The id of the forum to display
* {Number}
*/
forumId: PropTypes.number.isRequired,
/**
* If the forum is not yet available in the app state, the component will attempt to a list of forums.
* You can use this field to search for the specific forum you want to load instead of loading a list of forums.
* {String}
*/
searchTerm: PropTypes.string,
/**
* Use this to display your own loading component while the screen is loading
* {ReactComponent}
*/
LoadingComponent: PropTypes.elementType
};
Source