Skip to content

Latest commit

 

History

History
124 lines (91 loc) · 4.22 KB

getting-started.md

File metadata and controls

124 lines (91 loc) · 4.22 KB

Getting Started

Requirements

  • Android:
    • Giphy SDK only supports projects that have been upgraded to androidx
    • Requires minSdkVersion 21
    • A Giphy Android SDK key from the Giphy Developer Portal. Please remember, you should use a separate key for every platform (Android, iOS, Web) you add our SDKs to.
  • iOS:
    • iOS 13.0 or later
    • Xcode 12 and later
    • A Giphy iOS SDK key from the Giphy Developer Portal. Please remember, you should use a separate key for every platform (Android, iOS, Web) you add our SDKs to.

Installation

🚨 Expo: This package is not available in the Expo Go app. Learn how you can use it with custom dev clients.

yarn add @giphy/react-native-sdk

or using npm

npm install @giphy/react-native-sdk --save

Go to your ios folder and run:

pod install

New architecture setup (Fabric)

This library supports new architecture! In order to use the new architecture some extra steps are needed.

iOS

Install pods with this flag inside ios folder:

RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

Android

Set newArchEnabled to true inside android/gradle.properties and then run:

yarn android

If you have issues with running android build you can try to generate codegen before the build using this command:

cd android && ./gradlew generateCodegenArtifactsFromSchema

Troubleshooting

Why do I get iOS linker errors

This StackOverflow thread may be helpful if you experience issues linking your iOS project.

GIFs Are Not Playing on Android

If you encounter an issue where GIFs appear as static images instead of animating, this may be due to a dependency conflict between React Native and the Fresco library used by our SDK.

By default, our SDK references our Android SDK, which uses Fresco version 2.5.0. However, as of React Native 0.73.0, the default Fresco version is 3.1.3.

Developers using our SDK with React Native versions from 0.73 up to but not including 0.76 can resolve this conflict by adding the following block to the android/build.gradle file in the :app module, right before the dependencies section:

configurations.all {
    resolutionStrategy {
        forcedModules = ['com.giphy.sdk:ui:2.3.13']
    }
}

For React Native 0.76.0 and above, where Fresco defaults to version 3.2.0, use the following configuration to ensure compatibility. Please check the exact version of Fresco used by the specific React Native version you are working with, as this may vary. Add this block to the same android/build.gradle(:app) file right before dependencies:

configurations.configureEach {
    resolutionStrategy {
        forcedModules = [
            'com.facebook.fresco:fresco:3.2.0',
            'com.facebook.fresco:animated-gif:3.2.0',
            'com.facebook.fresco:animated-base:3.2.0',
            'com.facebook.fresco:animated-drawable:3.2.0',
            'com.facebook.fresco:animated-webp:3.2.0',
            'com.facebook.fresco:webpsupport:3.2.0',
            'com.facebook.fresco:imagepipeline-okhttp3:3.2.0',
            'com.facebook.fresco:middleware:3.2.0',
            'com.facebook.fresco:nativeimagetranscoder:3.2.0'
        ]
    }
}

Feel free to open an issue here in this repo if you run into any problems.

Basic Usage

We offer two solutions for the SDK user interface - pre-built templates which handle the entirety of the GIPHY experience, and a Grid-Only implementation which allows for endless customization.

See customization to determine what's best for you.