Source

containers/Custom/SettingsScreen.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 Settings from "../SettingsScreen";

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

/**
 * You can use this component to display your settings screen in your custom screen.
 *
 * @component
 * @example
 *
 * //In custom_code/components/MyCustomScreen.js...
 *
 * import React from 'react';
 * import { View } from 'react-native';
 * import FastImage from "react-native-fast-image";
 * import {DEVICE_WIDTH} from "@src/styles/global";
 * import SettingsScreen from "@src/containers/Custom/SettingsScreen";
 *
 * const MyCustomScreen = (props) => {
 *
 *  return (
 *    <View style={{ flex: 1 }}>
 *      <View style={{ marginTop: 50, alignSelf: "center" }}>
 *        <FastImage style={{ width: DEVICE_WIDTH, height: 110, marginBottom: 10 }} source={{ uri: "https://link-to-image.png" }} />
 *      </View>
 *      <SettingsScreen {...props} hideNavigationHeader={false} screenTitle="App Settings"/>
 *     </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 SettingsScreen = compose(
	withNavigation,
	withActiveCallBacks,
	mapProps(buildFilterProps)
)(Settings);

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

export default SettingsScreen;