Skip to main content

LMCreatePostAttachmentSelection

The LMCreatePostAttachmentSelection component provides users with multiple options for adding attachments (photos, videos, files, and polls) to a new post. This component is highly customizable and integrates with CreatePostContext for managing various post creation options.

LMFeedPostContent

Overview

LMCreatePostAttachmentSelection includes:

  • Configurable buttons for adding images, videos, files, and polls.
  • Dynamic styling and customization through context.
  • Integration with analytics to track attachment selection events.

Callbacks

The component supports callback through context values, which are configured within the CreatePost component.

PropertyTypeDescription
handleDocumentPropfunctionOptional custom callback for handling document attachments.
handlePollPropfunctionOptional custom callback for handling poll creation.
handleGalleryPropfunctionOptional custom callback for handling image and video selection.

Customization with Styles

The component supports customization through context styles, which are configured within the CreatePost component.

PropertyTypeDescription
attachmentOptionsStyleobjectStyles for customizing the layout and appearance of the attachment options container.

Example Usage

To use this component, make sure it's placed within a provider that supplies CreatePostContext and CreatePostCustomisableMethodsContext. Here’s an example of integrating LMCreatePostAttachmentSelection in a CreatePost screen:

import React, { useEffect } from "react";
import { View } from "react-native";
import {
LMCreatePostAttachmentSelection,
CreatePostProvider,
STYLES,
} from "@likeminds.community/feed-rn-core";

const CreatePostScreen = () => {
// to customise ui
useEffect(() => {
STYLES.setCreatePostStyles({
attachmentOptionsStyle: {
photoAttachmentView: {
borderRadius: 10,
},
},
});
}, []);
return (
<View style={{ flex: 1 }}>
{/* Other create post components */}
<LMCreatePostAttachmentSelection />
</View>
);
};

export default CreatePostScreen;