Coder Social home page Coder Social logo

majiedo / react-native-emojis-picker Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 0.0 1.55 MB

Simple, customizable emojis picker for React Native ๐Ÿ‘Œ๐Ÿ‘Œ

Home Page: https://www.npmjs.com/package/react-native-emojis-picker

License: MIT License

TypeScript 100.00%
emoji-picker emojis react react-native reanimated3

react-native-emojis-picker's Introduction

react-native-emojis-picker

It's built with TypeScript and uses Reanimated 2 for smooth animations

light theme dark theme

Installation

npm install react-native-emojis-picker

Dependencies

This library needs react-native-reanimated to be installed in your project before you can use it:

npm install [email protected]

Add react-native-reanimated/plugin plugin to your babel.config.js.

  module.exports = {
    presets: [
      ... // don't add it here :)
    ],
    plugins: [
      ...
      'react-native-reanimated/plugin',
    ],
  };

Usage

wrap the whole app in EmojiProvider

import { EmojiProvider } from "react-native-emojis-picker";
export default function App() {
  return <EmojiProvider>//rest your app</EmojiProvider>;
}

simple emoji component

import { Button, StyleSheet, Text, View } from "react-native";
import { useState } from "react";
import { EmojiModal } from "react-native-emojis-picker";

export default function EmojiComponent() {
  const [showModal, setShowModal] = useState(false);
  const [emoji, setEmoji] = useState("");
  return (
    <View style={styles.container}>
      <Text style={{ fontSize: 100 }}>{emoji}</Text>
      <Button
        title="Show Emojis Modal ๐Ÿ˜"
        onPress={() => {
          setShowModal(true);
        }}
      />
      {showModal && (
        <EmojiModal
          onPressOutside={() => setShowModal(false)}
          onEmojiSelected={(emoji) => {
            setShowModal(false);
            setEmoji(emoji);
          }}
        />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});

now import the component we just created into App.tsx

import { EmojiProvider } from "react-native-emojis-picker";
import EmojiComponent from "./components/emoji";
export default function App() {
  return (
    <EmojiProvider>
      <EmojiComponent />
    </EmojiProvider>
  );
}

EmojiModal Props

Property Type Default description
intensityBlur number 20 the intensity of the backgroud blur
columns number 10 number of columns
onEmojiSelected function undefined function fire when emoji selected and return the selected emoji
onPressOutside function undefined function fire when the user press outside the modal
position "top" or "bottom" or "center" "center" position of the modal
autoFocusSearch boolean false auto focus the search textbox
darkMode boolean false theme of the modal
categories Key[] All categories only categories these are shown in the modal such as ( "Smileys & Emotion" "Activities" "Animals & Nature" "Flags" "Food & Drink" "Objects" "People & Body" "Symbols" "Travel & Places")

Author

Majed Al-Otaibi, [email protected]

License

react-native-emojis-picker is available under the MIT license. See the LICENSE file for more info

react-native-emojis-picker's People

Contributors

majiedo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.