Code Reference

Plugins

Expo · Reference cheat sheet

Plugins

Expo · Reference cheat sheet


📋 Overview

Config plugins are JS functions that modify native projects during prebuild. They let managed/CNG apps add permissions, activities, Podfile changes, and Gradle tweaks without maintaining permanent ios/ / android/ forks.

🔧 Core concepts

  • Declarationplugins array in app.config.
  • With options["expo-camera", \{ cameraPermission: "..." \}].
  • Autolinking — many expo-* packages ship a plugin; still list them when options are required.
  • Custom pluginsplugins/withMyNativeChange.js using @expo/config-plugins mods.
  • Apply — changes take effect on next prebuild / EAS Build, not in Expo Go unless the feature is already in the client.

💡 Examples

// app.config.ts
export default {
  expo: {
    plugins: [
      [
        "expo-camera",
        {
          cameraPermission: "Allow MyApp to take photos",
          microphonePermission: "Allow MyApp to record audio",
          recordAudioAndroid: true,
        },
      ],
      "expo-secure-store",
      ["./plugins/withAndroidQueries", { packages: ["com.android.vending"] }],
    ],
  },
};
// plugins/withAndroidQueries.js
const { withAndroidManifest } = require("@expo/config-plugins");

function withAndroidQueries(config, { packages = [] }) {
  return withAndroidManifest(config, (cfg) => {
    const manifest = cfg.modResults.manifest;
    // mutate queries / intents as needed
    void packages;
    return cfg;
  });
}

module.exports = withAndroidQueries;

⚠️ Pitfalls

  • Expecting plugin native changes inside Expo Go — need a dev client or store build.
  • Forgetting to rebuild after adding a plugin.
  • Hand-editing ios//android/ then losing changes on --clean prebuild.

On this page