expo-config-plugins

repository·main·Indexed 20 days ago

https://github.com/expo/config-plugins

A collection of community-maintained Expo Config Plugins used to configure native projects during the npx expo prebuild process. It provides plugins for packages that do not yet ship their own built-in config plugins, including support for Apple settings UI (@config-plugins/apple-settings), iOS iMessage stickers (@config-plugins/ios-stickers), react-native-adjust, react-native-blob-util, react-native-branch, and Android JSC internationalization (@config-plugins/android-jsc-intl).

Tokens
22.2K
Snippets
83
Records
101
Agent score
68%

What's inside expo-config-plugins

  1. Use @config-plugins/android-jsc-intl for JSC Internationalization support

    main

    This config plugin is used to configure the JavaScriptCore (JSC) engine on Android with internationalization support.

    Important Note: React Native uses the Hermes engine by default. If you are looking for a general replacement for Hermes, you should instead use the config plugin in react-native-community/jsc-android-buildscripts.

  2. What are Expo Config Plugins and how to use them

    main

    Expo Config Plugins are used to configure the npx expo prebuild command. They allow you to automate the modification of native project files (like iOS .xcodeproj or Android AndroidManifest.xml) during the prebuild process.

    While many React Native libraries ship their own built-in config plugins, this repository serves as a collection of community-maintained plugins for packages that do not yet have a built-in plugin.

    To use a plugin from this repository, you typically add it to the plugins array in your app.json or app.config.js file.

  3. Alternatives to react-native-pdf for displaying PDFs

    main

    If you want to avoid custom native code or the complexity of react-native-pdf, consider these alternatives:

    1. Use expo-web-browser

    Open the PDF in an in-app browser session.

    2. Use react-native-webview

    Embed the PDF within a contained WebView component.

    3. Use the Share API

    Let users open the PDF in their preferred system PDF viewer app (similar to UIDocumentInteractionController on iOS).

    4. Use DOM Components

    Utilize Expo's DOM Components for a custom web-based experience.

    // Example: Using expo-web-browser
    import * as WebBrowser from "expo-web-browser";
    import { Text } from "react-native";
    
    export default function HomeScreen() {
      return (
        <Text
          onPress={() => {
            WebBrowser.openBrowserAsync(
              "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
            );
          }}
        >
          Open in-app browser
        </Text>
      );
    }
  4. Install @config-plugins/react-native-adjust

    main

    This config plugin automates the configuration of react-native-adjust during the npx expo prebuild process.

    Note: This package cannot be used in the standard Expo Go app because it requires custom native code. You must use a Development Build.

    To install, run:

    npx expo install react-native-adjust @config-plugins/react-native-adjust

    After installation, add the plugin to the plugins array in your app.json or app.config.js.

    {
      "plugins": ["@config-plugins/react-native-adjust"]
    }
  5. Configure @config-plugins/%CONFIG_PLUGIN% in app.json

    main

    After installing the package, add @config-plugins/%CONFIG_PLUGIN% to the plugins array in your app.json or app.config.js.

    If you need to provide configuration options, pass them as an array where the second element is an object containing the plugin's props. Every time you modify these props, you must rebuild your native app (run npx expo prebuild).

    {
      "expo": {
        "plugins": [
          [
            "@config-plugins/%CONFIG_PLUGIN%",
            {
              "foobar": true
            }
          ]
        ]
      }
    }
  6. Install the react-native-blob-util config plugin

    main

    To auto-configure react-native-blob-util during native code generation (npx expo prebuild), install both the library and its corresponding config plugin using npx expo install.

    Important Notes:

    • This plugin is Android-only.
    • This plugin is a requirement for react-native-pdf.
    • This package cannot be used in the Expo Go app because it requires custom native code. You must use a Development Build.
    npx expo install react-native-blob-util @config-plugins/react-native-blob-util
  7. Install @config-plugins/react-native-webrtc

    main

    To use react-native-webrtc with Expo, you must install both the library and its corresponding config plugin. Note that this package requires custom native code and cannot be used in the Expo Go app; you must use Development Builds.

    1. Install the packages using npx expo install.
    2. Add the plugin to your app.json or app.config.js.
    3. Rebuild your native app using npx expo prebuild and your preferred build method.
    npx expo install react-native-webrtc @config-plugins/react-native-webrtc
  8. Install and configure @config-plugins/react-native-branch

    main

    This config plugin auto-configures react-native-branch during the native code generation process (npx expo prebuild).

    Note: This package cannot be used in the standard Expo Go app because it requires custom native code. You must use a Development Client.

    Installation

    Install both the library and the config plugin using npx expo install:

    npx expo install react-native-branch @config-plugins/react-native-branch

    Configuration

    Add @config-plugins/react-native-branch to the plugins array in your app.json or app.config.js.

    Rebuild

    After installation and configuration, you must rebuild your app (e.g., using npx expo run:ios or npx expo run:android) to apply the native changes.

  9. Install and configure @config-plugins/react-native-pdf

    main

    Use this config plugin to auto-configure react-native-pdf when running npx expo prebuild.

    Note: This package requires custom native code and cannot be used in the Expo Go app. You must rebuild your development client after installation.

    1. Install dependencies

    Install the required packages using npx expo install to ensure compatible versions:

    npx expo install react-native-pdf react-native-blob-util @config-plugins/react-native-pdf @config-plugins/react-native-blob-util

    2. Add to app config

    Add the config plugins to the plugins array in your app.json or app.config.js:

    {
      "plugins": [
        "@config-plugins/react-native-blob-util",
        "@config-plugins/react-native-pdf"
      ]
    }

    3. Rebuild

    Rebuild your app to apply the native configuration changes.

  10. Install @config-plugins/react-native-siri-shortcut

    main

    To use Siri Shortcuts in an Expo project, you must install both the base library and the config plugin. Note that this package requires custom native code and cannot be used in the Expo Go app.

    Install the dependencies using npx expo install:

    npx expo install react-native-siri-shortcut @config-plugins/react-native-siri-shortcut

    After installation, you must rebuild your app (e.g., using npx expo run:ios) to generate the necessary native code.