Class

AddActivityScreenApi

AddActivityScreenApi()

Add Activity Screen Hooks. Instance name: addActivityScreenApi

The AddActivityScreenApi() can be used to customize the components on the CreatePost Screen such as when creating a new activity post or adding a comment in an activity post.

Constructor

# new AddActivityScreenApi()

Example
externalCodeSetup.addActivityScreenApi.METHOD_NAME

Methods

# setKeyboardOptionsButtons(KeyboardOptionsButtons)

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.

Parameters:
Name Type Description
KeyboardOptionsButtons KeyboardOptionsButtonsProps
Example
import React from "react";
import IconButton from "@src/components/IconButton";
import MyCustomScreen from "./screens/MyCustomScreen";
export const applyCustomCode = externalCodeSetup => {
    externalCodeSetup.addActivityScreenApi.setKeyboardOptionsButtons(
        ({
            navigation,
            richTextEnabled,
            photosEnabled,
            videosEnabled,
            docsEnabled,
            gifsEnabled,
            RichTextButton,
            PhotoButton,
            VideoButton,
            DocButton,
            GifButton,
            renderMoreOptions
        }) => {
            const state = navigation.state;
            const params = state.params;

            //Only show the RichTextButton if adding a comment to an activity post
            if (
                state.routeName === "ActivitiesCreatePostScreen" &&
                params.isComment &&
                richTextEnabled
            ) {
                return <RichTextButton />;
            }

            //Add a custom icon button
            return (
                <>
                    {richTextEnabled && <RichTextButton />}
                    {photosEnabled && <PhotoButton />}
                    {videosEnabled && <VideoButton />}
                    {docsEnabled && <DocButton />}
                    {gifsEnabled && <GifButton />}
                    <IconButton
                        icon={require("@src/assets/img/arrow-right.png")}
                        tintColor="#aaa"
                        style={{
                            marginTop: 6,
                            marginRight: 10
                        }}
                        pressHandler={() => navigation.navigate("book")}
                    />
                    {renderMoreOptions()}
                </>
            );
        }
    );

    externalCodeSetup.navigationApi.addNavigationRoute(
        "book",
        "BookScreen",
        MyCustomScreen,
        "All"
    );
    externalCodeSetup.navigationApi.addNavigationRoute(
        "book",
        "BookScreen",
        MyCustomScreen,
        "Main"
    );
};