Source

externalCode/newReplyScreen.js

export const API_NAME = "newReplyScreenHooksApi";

/**
 * @typedef {Object} NewReplyKeyboardOptionsButtonsProps
 * @property {NavigationService} navigation
 * @property {Boolean} richTextEnabled Returns `true` if the rich text button should be displayed
 * @property {Boolean} photosEnabled Returns `true` if the photo button should be displayed
 * @property {Boolean} videosEnabled Returns `true` if the video button should be displayed
 * @property {Boolean} docsEnabled Returns `true` if the document button should be displayed
 * @property {Boolean} gifsEnabled Returns `true` if the gif button should be displayed
 * @property {React.ComponentType} RichTextButton Renders the rich text button
 * @property {React.ComponentType} PhotoButton Renders the photo button
 * @property {React.ComponentType} VideoButton Renders the video button
 * @property {React.ComponentType} DocButton Renders the document button
 * @property {React.ComponentType} GifButton Renders the gif button
 * @property {Function} renderMoreOptions Renders additional buttons depending on which screen the KeyboardOptions component is
 *
 */

/**
 * @class
 * New Reply Screen Hooks.
 * Instance name: newReplyScreenHooksApi
 
   You can use this hook to personalize reply screens such as hiding the tags input when users reply in a discussion.
 * @example
 * externalCodeSetup.newReplyScreenHooksApi.METHOD_NAME
 */
export class NewReplyScreenHooksApi {
	/**
	 * hides BB media upload view
	 * @private
	 */
	isMediaHidden = false;
	/**
	 * @ignore
	 * Reason for ignore: Function is not being used in NewReplyScreen.js
	 * Hide media upload buttons
	 * @method
	 * @example
	 * externalCodeSetup.newReplyScreenHooksApi.hideMediaOptions()
	 */
	hideMediaOptions = () => {
		this.isMediaHidden = true;
	};

	/**
	 * hides tags input
	 * @private
	 */
	areTagsHidden = false;
	/**
	 * Use this to hide the tags input component when replying in a discussion
	 * @method
	 * @example
	 * externalCodeSetup.newReplyScreenHooksApi.hideTags()
	 */
	hideTags = () => (this.areTagsHidden = true);

	isNotifyViaEmailHidden = false;

	/**
	 * Hides the component that the users can enable to notify them of follow-up replies via email.
	 * @method
	 * @example
	 * externalCodeSetup.newReplyScreenHooksApi.hideNotifyViaEmail();
	 */
	hideNotifyViaEmail = () => {
		this.isNotifyViaEmailHidden = true;
	};

	KeyboardOptionsButtons = null;

	/**
	 * You can use this hook to customize the keyboard options buttons such as the RichTextButton and PhotoButton components.
	 * For example, you can add your own component together with the default keyboard options buttons.
	 * @method
	 * @param {NewReplyKeyboardOptionsButtonsProps} KeyboardOptionsButtons
	 *
	 * @example
	 *
	 * externalCodeSetup.newReplyScreenHooksApi.setKeyboardOptionsButtons(
	 *     ({
	 *         navigation,
	 *         richTextEnabled,
	 *         photosEnabled,
	 *         videosEnabled,
	 *         docsEnabled,
	 *         gifsEnabled,
	 *         RichTextButton,
	 *         PhotoButton,
	 *         VideoButton,
	 *         DocButton,
	 *         GifButton,
	 *         renderMoreOptions
	 *     }) => {
	 *         return (
	 *             <>
	 *                 {richTextEnabled && <RichTextButton />}
	 *                 {photosEnabled && <PhotoButton />}
	 *                 {videosEnabled && <VideoButton />}
	 *                 {docsEnabled && <DocButton />}
	 *                 {gifsEnabled && <GifButton />}
	 *                 {renderMoreOptions()}
	 *             </>
	 *         );
	 *     }
	 * );
	 *
	 */
	setKeyboardOptionsButtons = KeyboardOptionsButtons => {
		this.KeyboardOptionsButtons = KeyboardOptionsButtons;
	};
}