skip to Main Content

I’m using Expo SDK 51.

Dependencies (cleaned)

"dependencies": {
"@react-native-async-storage/async-storage": "1.23.1",
"@react-navigation/bottom-tabs": "^6.5.7",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"expo": "^51.0.8",
"expo-application": "~5.9.1",
"expo-av": "~14.0.5",
"expo-constants": "~16.0.1",
"expo-device": "~6.0.2",
"expo-font": "~12.0.5",

}

App.json

"plugins": [
  "expo-localization",
  [
    "expo-image-picker",
    {
      "photosPermission": "The app accesses your photos to let you upload an image."
    }
  ],
  "expo-font",
    {
      "fonts": 
      [
        "./assets/fonts/Chivo-Regular.ttf",
        "./assets/fonts/Chivo-Bold.ttf",
        "./assets/fonts/Chivo-Italic.ttf", 
        "./assets/fonts/Chivo-Bold-Italic.ttf"
      ]
    },
  "expo-secure-store"
],

I’m getting the following error when I do npx expo start: PluginError: Plugin is an unexpected type: object

This is when copying the example from the documentation edited to have my paths. I was now importing them in runtime, but wanted to make use of the new feature.

2

Answers


  1. The solution for this is to wrap the plugin in an array.

    "plugins": [
      [
        "expo-font",
        {
          "fonts": ["./assets/fonts/nunito-sans.ttf"]
        }
      ]
    ]
    
    Login or Signup to reply.
  2. You can solve this the same way you did with "expo-image-picker"

    The solution is

    "plugins": [
      "expo-localization",
      [
        "expo-image-picker",
        {
          "photosPermission": "The app accesses your photos to let you upload an image."
        }
      ],
      [
        "expo-font",
          {
            "fonts": 
            [
              "./assets/fonts/Chivo-Regular.ttf",
              "./assets/fonts/Chivo-Bold.ttf",
              "./assets/fonts/Chivo-Italic.ttf", 
              "./assets/fonts/Chivo-Bold-Italic.ttf"
            ]
        },
      ],
      "expo-secure-store"
    ],
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search