1.1.9 • Published 3 years ago

react-native-comments v1.1.9

Weekly downloads
51
License
MIT
Repository
github
Last release
3 years ago

React native comments

Screenshot

React native comments is a presentational component for rendering Facebook like comments with likes, reporting, replying, pagination, etc. The pagination and actions are proxied which means you need to have your own pagination and data storage solution and implement action logic (liking, reporting etc).

Getting started

Tested with RN 0.63.4

$ npm install react-native-comments --save

If you don't have the dependency react-native-vector-icons, please make sure you install it properly for your app:

Implementation notes

You should add a scroll to end of comments on a successful save action

Do not update comments if the user is not expecting update. Updating comments could close some modals the user was potentially viewing

Edit, Delete and Report are available on long press on comment container.

Properties

NameTypeDescriptionMust returnPassed params
dataarrayArray of comments to render. One item = one complete comment with children
fa5fa5ProstringSelect Fontawesome5 or FontAwesome5Pro if your app is already using them
viewingUserNamestringWhat is the username of the current user. used to check editability
initialDisplayCountnumberHow many comments to render at first
editMinuteLimitnumberTime limit for editing new comments. None for limitless
usernameTapActionfuncFunction to call when username and image are taped on commentusername
childPropNamestringThe property name where we can find array of children for particular comment
isChildfuncFunction to call to check is it a child or parent commentbool
keyExtractorfuncFunction to call when component needs to extract comment key (comment unique id)number (unique)
parentIdExtractorfuncFunction to call when component needs to extract parent comment key (comment unique id)number (unique)
usernameExtractorfuncFunction to call to get the username of the comment creatorstring
editTimeExtractorfuncFunction to call to get time of last comment updateTimestamp
createdTimeExtractorfuncFunction to call to get comment creation timeTimestamp
bodyExtractorfuncFunction to call to get body of the commentString
imageExtractorfuncFunction to call to get image url of comment creatorstring
likeExtractorfuncFunction to call to check has the user liked the commentbool
reportedExtractorfuncFunction to call to check has the user reported the commentbool
likesExtractorfuncFunction to call to get array users that liked the commentarray { image: string, name:string, user_id: number, tap : function}
childrenCountExtractorfuncFunction to call to get number of total children on the commentnumber
replyActionfuncFunction to call when user taps reply
saveActionfuncFunction to call in order to save comment. Should save comment and update data prop
editActionfuncFunction to call when user taps edit. Should save comment and update data prop
reportActionfuncFunction to call when user taps report. Should update data prop
likeActionfuncFunction to call when user taps like. Should update data prop
paginateActionfuncFunction to call when user taps show more or show previous.Should update data prop with new comments either prepended or appended to main comments or one comments children

Usage

Check the included example app files

Author

  • Tino Tokić
  • Email: ttokic1985@gmail.com

License

MIT

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago