GithubHelp home page GithubHelp logo

reyalpsirc / react-native-giphy-keyboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from logirix/react-native-giphy-keyboard

0.0 0.0 0.0 363 KB

React Native implementation of the Giphy SDK for iOS and Android

Kotlin 19.00% JavaScript 26.31% Java 8.79% Swift 16.40% Ruby 11.91% C 0.35% Objective-C 15.21% Starlark 2.02%

react-native-giphy-keyboard's Introduction

react-native-giphy-keyboard

This module implements the iOS and Android SDKs from Giphy for a simple usage. No more fumbling around with the Giphy API!

Getting started

Install the package with:

npm install react-native-giphy-keyboard

or

yarn add react-native-giphy-keyboard

iOS

Add use_frameworks! to your Podfile under target 'PROJECT_NAME' do, then run pod install on your ios directory.

Note: for pure Objective-C projects, add an empty swift file to your project and choose Create the Bridging Header when prompted by Xcode. This allows static libraries to be linked.

Add your Giphy API key by adding this to your Info.plist:

<key>GiphyApiKey</key>
<string>YOUR_API_KEY_HERE</string>

Android

Open your project build.gradle and add the following:

buildscript {
    ext {
        kotlin_version = "1.3.61"
        ...
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        ...
    }
    ...
}

allprojects {
  repositories {
    maven {
        url "http://giphy.bintray.com/giphy-sdk"
    }
    ...
  }
  ...
}

Then go to your android/app/src/main/res/values/strings.xml and add the following key:

<string name="giphy_api_key" translatable="false">YOUR_API_KEY_HERE</string>

Verification Mode

When you're ready to get a production key from Giphy, enable verification mode by doing the following:

iOS

Add the following to your Info.plist and build the app.

<key>GiphyVerificationMode</key>
<true/>

Android

Add the following to your android/app/src/main/res/values/strings.xml and build the app.

<bool name="giphy_verification_mode">true</bool>

Now follow the instructions on the Giphy Developers dashboard.

Note

Remember to remove these when the verification is finished. You DON'T want this enabled when you ship to production.

API

Open Giphy

import * as GiphyKeyboard from 'react-native-giphy-keyboard';

GiphyKeyboard.openGiphy({
  rendition: 'fixedWidth',
  fileType: 'gif',
  mediaTypes: ['gifs', 'stickers'],
  theme: 'dark',
});

Dismiss Giphy

import * as GiphyKeyboard from 'react-native-giphy-keyboard';

GiphyKeyboard.dismiss();

Listener

import * as GiphyKeyboard from 'react-native-giphy-keyboard';

useEffect(() => {
  const removeListener = GiphyKeyboard.addMediaSelectedListener(media => {
    const { url, aspectRatio } = media;
  });

  return () => {
    removeListener();
  };
}, []);

Example project

Feel free to clone this repo and run the example/ project.

Run npm install or yarn install in the example/ directory.

Run pod install in the example/ios/ directory.

Build the app in XCode.

react-native-giphy-keyboard's People

Contributors

filipef101 avatar gustash 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.