-
Notifications
You must be signed in to change notification settings - Fork 43
Post rendering
Emee Miano edited this page Mar 21, 2022
·
2 revisions
UIKit provides default renderers for the core data types: text, image, and file. It also provides a way to render your own UI for your custom post.
A single post UI is composed of 1 or more blocks. This allows reusability of block components such as header or footer which can be shared by different kinds of posts.
This is an example of an image post which contains three tableview cells. Top cell represents the header, middle cell contains content and bottom cell is footer cell.
📝 | For now, we only export footer from UIKit - AmityPostEngagementBar . |
---|
First, you need to create your custom renderer.
import { AmityPostContainer, AmityPostEngagementBar } from '@amityco/ui-kit';
function CustomPostRenderer({ className, post }) {
return (
<AmityPostContainer className={className}>
...
<AmityPostEngagementBar postId={post.postId} />
</AmityPostContainer>
);
}
Then, you need to pass your renderer into AmityUiKitProvider
function MyApp() {
return (
<AmityUiKitProvider
postRenderers={{
customPostDataType: CustomPostRenderer,
image: CustomImagePostRenderer,
}}
>
...
</AmityUiKitProvider>
);
}