9 Config Plugins
Tommy Nguyen редактировал(а) эту страницу 2024-08-01 19:57:26 +02:00

This page applies to:

Android iOS macOS visionOS Windows
>=2.0.0 >=2.0.0 >=3.9.0

Support for Expo's Config Plugins was added in version 2.0. You can find the full documentation here: https://docs.expo.dev/config-plugins/introduction/

Usage

In order to use a config plugin in react-native-test-app, there are two things you need to do:

  1. Add @expo/config-plugins as a dev dependency:
    • Yarn: yarn add @expo/config-plugins --dev
    • npm: npm add @expo/config-plugins --save-dev
  2. Add the config plugins you want to use in your app.json under plugins. In the example below, we're adding the config plugin for Reanimated that comes bundled react-native-test-app:
           "presentationStyle": "modal"
         }
       ],
    +  "plugins": [
    +    "react-native-test-app/plugins/reanimated.js"
    +  ],
       "resources": {
         "android": [
           "dist/res",
    

Bundled Plugins

The following plugins are included in the package:

Default Mods

As of writing, most of the mods that come with @expo/config-plugins work out-of-box, with the sole exception being the Expo specific mods.ios.expoPlist. Additionally, the following react-native-test-app specific mods have been defined:

  • mods.ios.bridgeDelegate — Modify ios/ReactTestApp/BridgeDelegate.mm as a string (dangerous)
  • mods.ios.sceneDelegate — Modify ios/ReactTestApp/SceneDelegate.swift as a string (dangerous)

macOS Support

As of 3.9.0, config plugins should also work on macOS. Instead of importing mods from @expo/config-plugins, import them from react-native-test-app/plugins/macos. See plugins/macos.js for currently available mods.