Skip to main content

LMCreatePostMedia

The LMCreatePostMedia component handles the media section of the post creation screen. It allows users to attach various media types (images, videos, documents, polls, and links) to their posts and provides functionality for previewing, managing, and removing attachments.

GitHub File:

LMFeedPostContent

Overview

LMCreatePostMedia provides the following functionality:

  • Displays previews of attached media (images, videos, polls, and documents).
  • Allows users to add more attachments to their post.
  • Supports conditional rendering based on the attachment types.
  • Provides cancel functionality for each attachment type.

Styling Customisations

These styling customisations can be applied by calling the setCreatePostStyles on the STYLES class

PropertyTypeDescription
textLMTextPropsProps for the text shown on the button.
iconLMIconPropsProps for the icon displayed on the button.
onTap(value?: any) => voidCallback function invoked on button tap.
placement"start" | "end"Placement of the button in the layout.
buttonStyleViewStyleStyle for the button container.
isClickablebooleanDetermines if the button is clickable.

Example Usage

To use this component, make sure to wrap it within a CreatePost context provider. Here’s an example:

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

const CustomCreatePostScreen = () => {

// to customise ui
useEffect(() => {
STYLES.setPostListStyles({
media: {
image: {
height: 10,
width: 10,
},
},
});
}, []);

return (
<CreatePost>
<LMCreatePostMedia />
{/* Additional CreatePost components */}
</CreatePost>
);
};

export default CustomCreatePostScreen;