import {compose} from "recompose";
import {withNavigation} from "../../components/hocs/withNavigation";
import BlogSingle from "../BlogSingleScreen";
import PropTypes from "prop-types";
import withActiveCallBacks from "../../navigators/react-navigation-addons/withActiveCallBacks";
import withLoadBlog from "../../components/hocs/withLoadBlog";
/**
* You can use this component to display your Blog single screen in your custom screen.
* @component
* @example <caption> Use BlogSingleScreen in custom navigation route "book" </caption>
* //In custom_code/components/MyCustomScreen.js
*
* import React from 'react';
* import { View, Text } from 'react-native';
* import BlogScreen from "@src/containers/Custom/BlogSingleScreen";
*
* 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 }}>
* <BlogScreen blogId={68} searchTerm="Youtube" />
* </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 BlogSingleScreen = compose(
withNavigation,
withActiveCallBacks
)(BlogSingle);
export default withLoadBlog(BlogSingleScreen);
BlogSingleScreen.propTypes = {
/**
* The id of the blog to display
* {Number}
*/
blogId: PropTypes.number.isRequired,
/**
* If the blog is not yet available in the app state, the component will attempt to a list of blogs.
* You can use this field to search for the specific blog you want to load instead of loading a list of blogs.
* {String}
*/
searchTerm: PropTypes.string,
/**
* Use this to display your own loading component while the screen is loading
* {ReactComponent}
*/
LoadingComponent: PropTypes.elementType
};
Source