import {mapProps, compose} from "recompose";
import GlobalPhotosFilter from "../../components/Photos/GlobalPhotosFilter";
import withActiveCallBacks from "../../navigators/react-navigation-addons/withActiveCallBacks";
import {withNavigation} from "../../components/hocs/withNavigation";
import PropTypes from "prop-types";
const buildFilterProps = props => ({
navigation: props.navigation,
showSearch: true,
...props
});
/**
* You can use this component to display your Photos screen in your custom screen.
*
* @component
* @example <caption> Use photos screen without the filters in the "book" navigation route </caption>
*
* //In custom_code/components/MyCustomScreen.js...
*
* import React from 'react';
* import PhotosScreen from "@src/containers/Custom/PhotosScreen";
*
* const MyCustomScreen = (props) => (<PhotosScreen {...props} screenTitle="My Photos" hideFilters={true} hideNavigationHeader={true}/>)
*
*
* 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 PhotosScreen = compose(
withNavigation,
withActiveCallBacks,
mapProps(buildFilterProps)
)(GlobalPhotosFilter);
PhotosScreen.propTypes = {
/**
* Define header height
* {Number}
*/
headerHeight: PropTypes.number,
/**
* Use `true` to hide filters in the screen
* {Boolean}
*/
hideFilters: PropTypes.bool,
/**
* Use `true` to hide the screen title container
* {Boolean}
*/
hideNavigationHeader: PropTypes.bool,
/**
* Use `true` to hide title of the screen
* {Boolean}
*/
hideTitle: PropTypes.bool,
/**
* List screen title
*/
screenTitle: PropTypes.string,
/**
* Adjust the duration of the Search animation.
* A higher value means a longer duration of the animation.
* {Number}
*/
searchFocusedAnimationDuration: PropTypes.number,
/**
* Amount of space which the header moves up when Search input is focused.
* A greater value means that the header will move higher.
* {Number}
*/
searchFocusedListTopSpace: PropTypes.number,
/**
* Use `false` to hide search box
* {Boolean}
*/
showSearch: PropTypes.bool
};
export default PhotosScreen;
Source