npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vokhuyet/react-native-messy

v0.2.10

Published

chat ui

Downloads

133

Readme

react-native-messy

Chat ui for React Native

Dependency

Installation

npm install @vokhuyet/react-native-messy

or

yarn add @vokhuyet/react-native-messy

Usage

import { Messy } from '@vokhuyet/react-native-messy';

// ...
    const [list, setList] = useState([]);

    <Messy
       messages={list}
        loading={isLoading}
        BaseModule={{
          Cache: CacheDimension,
          Image: ChatListImage,
          Text: AppText,
        }}
        renderLoading={renderLoading}
        renderMessageSystem={ChatListMessageSystem}
        listProps={{
          onEndReached,
          ListHeaderComponent: ChatListHeader,
          onPress: () => {
              //hide all bottom sheet modal inlcuding: emoji picker,...
              dismissAll();
              //hide keyboard
              Keyboard.dismiss();
          },
        }}
        messageProps={{
          hideOwnerAvatar: true,
          hidePartnerAvatar: false,
          onPress: onPressMessage,
          onLongPress: onLongPressMessage,
        }}
        user={{id: account?.user?.id}}
        footerProps={{
          hideEmoji: false;
          hideFooterAction: false;
          Send: <Image source={require('NewSendIcon.png')} />
          onSend,
          ExtraLeft: <ChatListExtraLeft />,
          ExtraActionLeft: <ChatListExtraActionLeft />,
        }}
    />

Default Element

MessyFooterActionLibraryDefault

  • props
  onPress?: () => Promise<void> | void;  // use your own onPress handler
  handlePermission?: () => Promise<boolean>; // insert check permisson before use our internal handle select image
  style?: ImageStyle;
  source?: ImageSourcePropType;

MessyFooterActionCameraDefault

  • props
  onPress?: () => Promise<void> | void;  // use your own onPress handler
  handlePermission?: () => Promise<boolean>; // insert check permisson before use our internal handle select image
  style?: ImageStyle;
  source?: ImageSourcePropType;

Default Function

setMessyFooterInputText

Use as global function to set Message Input text

Object Type

TMessyMessageLocation

name: string;
image: ImageProps['source'];
latitude: string;
longitude: string;

TMessyMessage

  id?: string | number | null;
  text?: string;
  image?: ImageSourcePropType;
  video?: { uri: string };
  audio?: {uri: string}; // not implemented, you can implement by yourself
  location?: TMessyMessageLocation;
  user?: TUser;
  type?: 'system' | 'message';
  createdTime?: Date | number | string;
  status?: 'sending' | 'sent' | 'seen';
  seenBy?: TUser[];
  local?: Asset;
  clientId?: string; // used for display message in List before receiving response from Server
  category?: string; // used for display multiple type of system message

TColor

background: string;
primary: string;
accent: string;
placeholder: string;
shadow: string;
success: string;
message_left: {
  background: string;
  text: string;
  link: string;
  email: string;
  phone: string;
  audio: string;
}
message_right: {
  background: string;
  text: string;
  link: string;
  email: string;
  phone: string;
  audio: string;
}
input: {
  text: string; //text color in TextInput
}

TUser

  id: string | number | null | undefined;
  userName?: string | null;
  avatar?: ImageSource;

TMessyFooterProps

  hideEmoji?: boolean;
  hideFooterAction?: boolean;
  Send?: React.ReactNode;
  Emoji?: React.ReactNode; // button for click to open emoji picker
  onSend?: (message?: TMessyMessage) => Promise<void> | void;
  inputProps?: TextInputProps;
  ExtraLeft?: React.ReactNode;
  ExtraActionLeft?: React.ReactNode;
  renderFooter?: FC<TMessyFooterProps>;
  renderFooterAction?: FC<TMessyFooterProps>;

TMessageProps

  hideOwnerAvatar: boolean;
  hidePartnerAvatar: boolean;
  onPress?: (message: TMessyMessageProps) => Promise<void> | void;
  onLongPress?: (message: TMessyMessageProps) => Promise<void> | void;

TBaseModule

  Image?: FC<ImageProps>;
  Text?: FC<TextProps>;
  Video?: FC;
  Cache: {
    get: (key: string) => any;
    set: (key: string, value: any) => void;
  };

Props

  • useInBottomSheet(boolean): default false
  • loading(boolean): loading status
  • messages(TMessyMessage[]): list of messages
  • user(TUser): sender information;
  • theme: (TColor): custom theme for message;
  • footerProps(TMessyFooterProps): Custom props for Element below list messages;
  • listProps(TListProps): custom flatlist props and onPress event;
  • messageProps(TMessageProps);
  • parsedShape(ParseShape[]): Custom parse patterns for react-native-parsed-text ;
  • showDateTime(boolean): show created time of message;
  • renderLoading(FC<{}>): component when loading list message;
  • renderMessageSystem(FC<{ data?: TMessyMessage }>): custom system message;
  • renderMessage((data: TMessyMessageProps) => JSX.Element): custom whole message item view;
  • renderAvatarFC<{ user?: TUser }>: custom ;
  • renderMessageText((data: TMessyMessageProps) => JSX.Element): custom text message;
  • renderMessageAudio(data: TMessyMessageProps) => JSX.Element;
  • renderMessageImage(data: TMessyMessageProps) => JSX.Element;
  • renderMessageVideo(data: TMessyMessageProps) => JSX.Element;
  • renderMessageDateTime((data: TMessyMessage) => JSX.Element): custom datetime value in message item
  • renderMessageLocation: (data: TMessyMessageProps) => JSX.Element;
  • renderMessageOther(data: TMessyMessageProps) => JSX.Element: Customize other message types that the library does not yet support
  • BaseModule(TBaseModule);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library