Skip to content

Instantly share code, notes, and snippets.

@ErykDarnowski
Last active April 30, 2023 11:19
Show Gist options
  • Save ErykDarnowski/f65600c0767cca84fd9921dcbae1d00f to your computer and use it in GitHub Desktop.
Save ErykDarnowski/f65600c0767cca84fd9921dcbae1d00f to your computer and use it in GitHub Desktop.
How to get app's package name in Expo app (in React Native). This is a quick and dirty hack for getting the app's package name when testing stuff out and switching between the managed and bare (ejected) workflow. In my case this was heplful when linking the user to the app's notification settings page,
import { expo as appJson } from '../app.json';
// @ts-ignore
const packageName: string = appJson.android.package ?? 'host.exp.exponent';
// ^ Gets the apps package name, however if the `Expo Go` app is used it defaults to it's package name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment