Socket
Book a DemoInstallSign in
Socket

@deepaktiwari09/rnpostcards

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepaktiwari09/rnpostcards

simple card

latest
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

React Native Post Card

A brief description of what this project does and who it's for

Demo

Alt Text

Usage/Examples

import { PostCard, UserData, AuthorData } from '@deepaktiwari09/Postcard'

export default function App() {
  const [authorData, setauthorData] = useState<AuthorPostPropType[]>(AuthorData);
  return (
    <ScrollView>
      {authorData.map((authorData, index) => {
        return (
          <PostCard
            key={index}
            CardmarginStyle={{ top: 10, bottom: 10, left: 10, right: 10 }}
            AuthorData={authorData}
            UserData={UserData}
            onLikeClicked={(currentuserId, postId, authorId) => {
              setauthorData(AuthorData.map((item, index) => {
                if (item.authorId === authorId && item.authorPostId === postId) {
                  item.authorPostLikeCount += 1;
                  return item;
                }
                else {
                  return item;
                }

              }))
            }}
            onRepostClicked={(currentuserId, postId, authorId) => {
              setauthorData(AuthorData.map((item, index) => {
                if (item.authorId === authorId && item.authorPostId === postId) {
                  item.authorPostRepostCount += 1;
                  return item;
                }
                else {
                  return item;
                }

              }))
            }}
            onCommentLikeClicked={() => { }}
            onNewCommentDone={(comment, currentuserId, postId, autherId) => {
              setauthorData(AuthorData.map((item, index) => {
                if (item.authorId === autherId && item.authorPostId === postId) {
                  item.authorPostComment.unshift({
                    CommentId: item.authorPostComment.length,
                    CommentLikeCount: 0,
                    CommentDescription: comment,
                    CommentDate: new Date().toLocaleString(),
                    CommentUserImage: UserData.currentUserImage,
                    CommenterUserName: UserData.currentUserName,
                  })
                  return item;
                }
                else {
                  return item;
                }

              }))
            }}

          />
        )
      }
      )}
    </ScrollView>
  );
}

FAQs

Package last updated on 01 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts