Skip to main content

Lesson 6 of 10

Expo Modules & Config Plugins

Expo Config Plugins let you modify native iOS and Android project files (Info.plist, AndroidManifest.xml, build.gradle) from JavaScript - without ejecting to a bare workflow. This is the key to adding native dependencies while staying in managed Expo.

20 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Using Config Plugins

Using Config Plugins
// app.config.ts - the JavaScript alternative to app.json (supports logic)
import { ExpoConfig, ConfigContext } from 'expo/config';

export default ({ config }: ConfigContext): ExpoConfig => ({
  ...config,
  name: 'MyApp',
  slug: 'my-app',
  version: '1.0.0',
  ios: {
    bundleIdentifier: 'com.mycompany.myapp',
    // NSPhotoLibraryUsageDescription goes via plugin, not here
  },
  android: {
    package: 'com.mycompany.myapp',
    permissions: ['ACCESS_FINE_LOCATION', 'CAMERA'],
  },
  plugins: [
    // expo-camera adds camera permission strings automatically
    ['expo-camera', { cameraPermission: 'Allow $(PRODUCT_NAME) to access your camera.' }],

    // expo-location
    ['expo-location', {
      locationAlwaysAndWhenInUsePermission: '$(PRODUCT_NAME) uses location to show nearby places.',
    }],

    // expo-notifications (Push)
    ['expo-notifications', {
      icon: './assets/notification-icon.png',
      color: '#229c6b',
      sounds: ['./assets/notification.wav'],
    }],

    // Custom plugin - add a native build flag
    ['./plugins/withCustomFlag.js'],
  ],
});

// ---- Writing a custom Config Plugin ----
// plugins/withCustomFlag.js
const { withAndroidManifest } = require('@expo/config-plugins');

module.exports = function withCustomFlag(config) {
  return withAndroidManifest(config, async (config) => {
    const manifest = config.modResults;

    // Add a meta-data element to AndroidManifest.xml
    manifest.manifest.application[0]['meta-data'] = [
      ...(manifest.manifest.application[0]['meta-data'] ?? []),
      { $: { 'android:name': 'com.example.FLAG', 'android:value': 'true' } },
    ];

    return config;
  });
};

Tip

Tip

Practice Expo Modules Config Plugins in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

Modifying native AndroidManifest and Info.plist continuously with config plugins

Practice Task

Note

Practice Task - (1) Write a working example of Expo Modules Config Plugins from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.

Quick Quiz

Common Mistake

Warning

A common mistake with Expo Modules Config Plugins is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready react native code.

Topics in This Module

0/10 done