### IOSIcons Example
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
An example demonstrating how to configure multi-scale iOS icons with paths for 1x, 2x, and 3x resolutions.
```typescript
const iosIcon: IOSIcons = {
"1x": "./assets/icon-1x.png",
"2x": "./assets/icon-2x.png",
"3x": "./assets/icon-3x.png",
};
```
--------------------------------
### Dynamic App Icon Plugin: Complete Example
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
A comprehensive example of configuring dynamic app icons with various naming conventions and appearance modes.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions/icon/plugin",
{
"default": "./assets/icons/app-default.png",
"dark-mode": "./assets/icons/app-dark.png",
"light-mode": "./assets/icons/app-light.png",
"seasonal": {
"light": "./assets/icons/seasonal-light.png",
"dark": "./assets/icons/seasonal-dark.png"
},
"dev": "./assets/icons/app-dev.png"
}
]
]
}
}
```
--------------------------------
### Example iOS Icon Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Demonstrates how to configure iOS quick action icons in `app.json`. This example shows using simple string paths and objects to specify icons for different resolutions.
```json
{
"iosIcons": {
"home": "./assets/home.png",
"compose": {
"1x": "./assets/compose-1x.png",
"2x": "./assets/compose-2x.png",
"3x": "./assets/compose-3x.png"
},
"search": {
"2x": "./assets/search-2x.png",
"3x": "./assets/search-3x.png"
}
}
}
```
--------------------------------
### Example Android Icon Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Illustrates how to configure Android quick action icons in `app.json`. This example shows different ways to specify icons, including simple paths and objects with background colors or images.
```json
{
"androidIcons": {
"compose": {
"foregroundImage": "./assets/compose-icon.png",
"backgroundColor": "#FF6B6B"
},
"search": "./assets/search-icon.png",
"settings": {
"foregroundImage": "./assets/settings-icon.png",
"backgroundColor": "#4A90E2",
"backgroundImage": "./assets/settings-bg.png"
}
}
}
```
--------------------------------
### Configure Dynamic Quick Actions on App Start
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/integration-guide.md
Dynamically configure quick actions when the app starts by checking support and setting items. This is useful for actions that depend on app state.
```typescript
// app/(root)/_layout.tsx
import * as QuickActions from "expo-quick-actions";
import { useEffect } from "react";
import { Slot } from "expo-router";
export default function RootLayout() {
useEffect(() => {
// Check if quick actions are supported
QuickActions.isSupported().then((supported) => {
if (!supported) {
console.log("Quick actions not supported on this device");
return;
}
// Configure the quick actions
QuickActions.setItems([
{
id: "compose",
title: "New Message",
icon: "compose",
params: { href: "/compose" },
},
{
id: "search",
title: "Search",
icon: "search",
params: { href: "/search" },
},
{
id: "profile",
title: "My Profile",
icon: "symbol:person.circle",
params: { href: "/profile" },
},
{
id: "settings",
title: "Settings",
icon: "symbol:gear",
params: { href: "/settings" },
},
]);
});
}, []);
return ;
}
```
--------------------------------
### Example app.json Configuration for Main Plugin
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Illustrates how to configure the main `expo-quick-actions` plugin within the `app.json` file.
```json
{
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": {...},
"iosIcons": {...},
"iosActions": [...]
}
]
]
}
```
--------------------------------
### Example iOS Actions Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Demonstrates how to define iOS quick actions with different icon types: built-in, configured, and SF Symbols.
```json
{
"iosActions": [
{
"id": "search",
"title": "Search",
"icon": "search",
"params": {
"href": "/search"
}
},
{
"id": "compose",
"title": "New Message",
"icon": "compose",
"subtitle": "Send a message",
"params": {
"href": "/compose"
}
},
{
"id": "custom",
"title": "My Icon",
"icon": "shortcut_one",
"params": {
"url": "https://example.com"
}
},
{
"id": "symbol",
"title": "Settings",
"icon": "symbol:gear",
"params": {
"href": "/settings"
}
}
]
}
```
--------------------------------
### Get Initial Action
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Retrieves the initial quick action item that was used to open the app, if any.
```APIDOC
## `initial`
### Description
A static property that returns the initial quick action item that was used to open the app, if any.
### Returns
- `Action | null`: The initial action item or null if none was used.
### Example
```ts
const initialAction = QuickActions.initial;
```
```
--------------------------------
### Install Expo Quick Actions and Rebuild
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
Troubleshoot 'Module not found: expo-quick-actions' by installing the library and cleaning the build. This ensures the library is correctly linked.
```bash
npx expo install expo-quick-actions
npx expo prebuild --clean
```
--------------------------------
### Example getIcon Usage
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Shows how to fetch and log the current app icon name.
```typescript
import * as AppIcon from "expo-quick-actions/icon";
const current = await AppIcon.getIcon();
console.log("Current icon:", current || "default");
```
--------------------------------
### AdaptiveIcon Example
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
An example of how to define an AdaptiveIcon object with a foreground image and background color.
```typescript
const icon: AdaptiveIcon = {
foregroundImage: "./assets/compose-fg.png",
backgroundColor: "#FF6B6B",
};
```
--------------------------------
### Example app.json Configuration for Icon Plugin
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Shows how to configure the `expo-quick-actions/icon/plugin` in `app.json` to define alternate app icons.
```json
{
"plugins": [
[
"expo-quick-actions/icon/plugin",
{
"dark": "./assets/icon-dark.png",
"light": "./assets/icon-light.png"
}
]
]
}
```
--------------------------------
### Import Examples for Expo Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Demonstrates how to import various modules and specific exports from the expo-quick-actions library and its submodules.
```typescript
// Main module
import * as QuickActions from "expo-quick-actions";
import QuickActions, { Action } from "expo-quick-actions";
```
```typescript
// Hooks
import {
useQuickActionCallback,
useQuickAction,
} from "expo-quick-actions/hooks";
```
```typescript
// Router
import {
useQuickActionRouting,
isRouterAction,
RouterAction,
} from "expo-quick-actions/router";
```
```typescript
// Icon
import * as AppIcon from "expo-quick-actions/icon";
import { setIcon, getIcon, isSupported } from "expo-quick-actions/icon";
```
--------------------------------
### Get Initial Quick Action on App Startup
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Retrieves the quick action that launched the app, if any. Available immediately on app startup.
```typescript
import * as QuickActions from "expo-quick-actions";
if (QuickActions.initial) {
console.log("Launched with action:", QuickActions.initial.id);
handleAction(QuickActions.initial);
}
```
--------------------------------
### Install Specific expo-quick-actions Version
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
Manually install a specific version of expo-quick-actions. This is useful if you need to pin to a particular release, for example, version 6.0.2.
```bash
npm install expo-quick-actions@6.0.2
```
--------------------------------
### Install Latest Compatible expo-quick-actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
Install the latest version of expo-quick-actions that is compatible with your Expo project. This command automatically selects the correct version based on your Expo SDK.
```bash
npx expo install expo-quick-actions
```
--------------------------------
### Example setIcon Usage
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Demonstrates changing the app icon to a named icon and then resetting it to the default.
```typescript
import * as AppIcon from "expo-quick-actions/icon";
await AppIcon.setIcon("dark");
await AppIcon.setIcon(null); // Reset to default
```
--------------------------------
### Setup Quick Actions in Layout Component
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Initialize quick actions and set items within your root layout component using `useQuickActionRouting` and `setItems`.
```typescript
import * as QuickActions from "expo-quick-actions";
import { useQuickActionRouting } from "expo-quick-actions/router";
import { useEffect } from "react";
import { Slot } from "expo-router";
export default function RootLayout() {
useQuickActionRouting();
useEffect(() => {
QuickActions.setItems([
{
id: "compose",
title: "Compose",
icon: "compose",
params: { href: "/compose" },
},
]);
}, []);
return ;
}
```
--------------------------------
### Complete Icon Plugin Configuration Example
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
A detailed configuration for the icon plugin, specifying default and platform-specific icons, including seasonal and development variants.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions/icon/plugin",
{
"default": "./assets/icons/app-icon.png",
"dark": "./assets/icons/app-icon-dark.png",
"light": "./assets/icons/app-icon-light.png",
"seasonal": "./assets/icons/app-icon-seasonal.png",
"dev": "./assets/icons/app-icon-dev.png"
}
]
]
}
}
```
--------------------------------
### Example RouterAction Objects
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/router.md
Illustrates how to create `RouterAction` objects for navigating to different routes within an Expo Router application. Includes examples for a search action and a settings action.
```typescript
const searchAction: RouterAction = {
id: "search",
title: "Search",
icon: "search",
params: {
href: "/search",
query: "default query", // Additional param
},
};
const settingsAction: RouterAction = {
id: "settings",
title: "Settings",
subtitle: "App preferences",
icon: "symbol:gear",
params: {
href: "/settings",
},
};
```
--------------------------------
### Basic Setup with Expo Router
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/router.md
Enable automatic routing for quick actions by calling `useQuickActionRouting()` and configuring items with `params.href` in your root layout.
```typescript
// app/(root)/_layout.tsx
import { useQuickActionRouting } from "expo-quick-actions/router";
import { Slot } from "expo-router";
import * as QuickActions from "expo-quick-actions";
import { useEffect } from "react";
export default function RootLayout() {
// Enable automatic routing for quick actions with href
useQuickActionRouting();
useEffect(() => {
// Configure your quick actions
QuickActions.setItems([
{
id: "search",
title: "Search",
icon: "search",
params: { href: "/search" },
},
{
id: "compose",
title: "New Message",
icon: "compose",
params: { href: "/compose" },
},
{
id: "settings",
title: "Settings",
icon: "symbol:gear",
params: { href: "/settings" },
},
]);
}, []);
return ;
}
```
--------------------------------
### Complete Expo Quick Actions Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
A comprehensive example of configuring both Android and iOS actions, including custom icons for each platform.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": {
"shortcut_compose": {
"foregroundImage": "./assets/icons/compose-fg.png",
"backgroundColor": "#EA3323"
},
"shortcut_search": {
"foregroundImage": "./assets/icons/search-fg.png",
"backgroundColor": "#4A90E2",
"backgroundImage": "./assets/icons/search-bg.png"
},
"shortcut_settings": "./assets/icons/settings.png",
"shortcut_remote": "https://example.com/icon.png"
},
"iosIcons": {
"shortcut_compose": "./assets/icons/compose.png",
"shortcut_search": {
"1x": "./assets/icons/search-1x.png",
"2x": "./assets/icons/search-2x.png",
"3x": "./assets/icons/search-3x.png"
}
},
"iosActions": [
{
"id": "compose",
"title": "New Message",
"icon": "shortcut_compose",
"params": {
"href": "/compose"
}
},
{
"id": "search",
"title": "Search",
"icon": "shortcut_shortcut_search",
"params": {
"href": "/search"
}
},
{
"id": "settings",
"title": "Settings",
"subtitle": "App Preferences",
"icon": "symbol:gear",
"params": {
"href": "/settings"
}
}
]
}
]
]
}
}
```
--------------------------------
### Example useQuickActionRouting Usage
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Demonstrates integrating the `useQuickActionRouting` hook into a sub-layout component to enable automatic routing.
```typescript
import { useQuickActionRouting } from "expo-quick-actions/router";
export default function Layout() {
useQuickActionRouting();
return ;
}
```
--------------------------------
### Get Initial Quick Action
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Retrieve the initial quick action item that was used to launch the app, if any.
```tsx
const initialAction = QuickActions.initial;
```
--------------------------------
### Example RouterAction Usage
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Demonstrates how to define and use a RouterAction with a specific app route type.
```typescript
type AppRoute = "/search" | "/compose" | "/settings";
const action: RouterAction = {
id: "search",
title: "Search",
params: { href: "/search" },
};
```
--------------------------------
### Install Required Packages for Config Plugin
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
When using the expo-quick-actions config plugin, ensure these development dependencies are installed in your project. This includes the Expo Config Plugins and expo-module-scripts.
```json
{
"devDependencies": {
"@expo/config-plugins": "^56.0.0",
"expo-module-scripts": "^56.0.0"
}
}
```
--------------------------------
### Dynamic App Icon Plugin Basic Setup
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
Configure the dynamic app icon plugin in app.json. This allows for runtime switching of app icons.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions/icon/plugin",
[] // Array or object format
]
]
}
}
```
--------------------------------
### Combining Expo Quick Actions and Icon Plugins
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Example of how to use both the main expo-quick-actions plugin and its icon plugin within the app's config. This demonstrates the structure for configuring both actions and icons.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": { ... },
"iosIcons": { ... },
"iosActions": [ ... ]
}
],
[
"expo-quick-actions/icon/plugin",
{
"dark": "./assets/app-icon-dark.png",
"light": "./assets/app-icon-light.png"
}
]
]
}
}
```
--------------------------------
### Get Initial Quick Action
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Retrieves the quick action that was used to launch the app. Returns undefined if the app was not launched via a quick action or if the device does not support them.
```typescript
const initialAction = QuickActions.initial;
if (initialAction) {
console.log("App opened with quick action:", initialAction.id);
}
```
--------------------------------
### Example isRouterAction Usage
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Shows how to use the `isRouterAction` type guard to safely navigate using action parameters.
```typescript
import { isRouterAction } from "expo-quick-actions/router";
if (isRouterAction(action)) {
router.navigate(action.params.href);
}
```
--------------------------------
### Configure Expo Quick Actions Plugin
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Add the `expo-quick-actions` plugin to your `app.json` to enable its features. This example shows the basic structure for including the plugin with configuration options.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": { ... },
"iosIcons": { ... },
"iosActions": [ ... ]
}
]
]
}
}
```
--------------------------------
### Set Quick Actions at Runtime
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Configure the quick actions that appear when a user long-presses the app icon. Ensure the `expo-quick-actions` library is installed and imported.
```typescript
import * as QuickActions from "expo-quick-actions";
await QuickActions.setItems([
{
id: "1",
title: "Search",
icon: "search",
params: { href: "/search" },
},
]);
```
--------------------------------
### App Icon Selection UI
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/icon.md
Create a user interface for selecting and changing the app icon. This example maps buttons to available icon names and handles the logic for setting the chosen icon.
```typescript
import * as AppIcon from "expo-quick-actions/icon";
import { View, Button, Text } from "react-native";
import { useState } from "react";
const AVAILABLE_ICONS = ["default", "dark", "light", "colorful"];
export function IconSelector() {
const [currentIcon, setCurrentIcon] = useState(null);
async function handleIconSelect(iconName: string) {
if (!AppIcon.setIcon) {
return;
}
try {
const name = iconName === "default" ? null : iconName;
await AppIcon.setIcon(name);
setCurrentIcon(iconName === "default" ? null : iconName);
} catch (error) {
console.error("Failed to set icon:", error);
}
}
if (!AppIcon.isSupported) {
return App icon switching is not supported on this device;
}
return (
{AVAILABLE_ICONS.map((icon) => (
);
}
```
--------------------------------
### Rebuild and Run Project
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
After configuring `app.json`, rebuild the native projects and run the application on a simulator or device.
```bash
npx expo prebuild --clean
npx expo run:ios # or run:android
```
--------------------------------
### initial Constant
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Provides the initial quick action that launched the application, if any. This is available immediately on app startup.
```APIDOC
## initial (Constant)
### Description
Provides the initial quick action that launched the application, if any. This is available immediately on app startup.
### Type Definition
```typescript
const initial: Action | undefined;
```
### Value
- `Action` object if app was launched via quick action
- `undefined` if app was launched normally or quick actions not supported
### Example
```typescript
import * as QuickActions from "expo-quick-actions";
if (QuickActions.initial) {
console.log("Launched with action:", QuickActions.initial.id);
handleAction(QuickActions.initial);
}
```
```
--------------------------------
### QuickActions.initial
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Retrieves the initial quick action that was used to launch the app, if any. This is useful for handling deep links or specific actions when the app is opened via a home screen shortcut.
```APIDOC
## Property: initial
**Type:** `Action | undefined`
A static property that returns the quick action used to launch the app, if any. This is populated when the app is opened through a quick action on the home screen. Returns `undefined` if the app was launched normally or if quick actions are not supported on the device.
```typescript
const initialAction = QuickActions.initial;
if (initialAction) {
console.log("App opened with quick action:", initialAction.id);
}
```
```
--------------------------------
### Get Maximum Action Count
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Returns the maximum number of quick action items that can be set on the device.
```APIDOC
## `maxCount`
### Description
A static property that returns the maximum number of quick action items that can be set.
- On iOS, this is hardcoded to 4.
- On Android, this is dynamically collected on start-up.
### Returns
- `number | null`: The maximum number of quick actions supported, or null on iOS.
### Example
```tsx
// e.g. 15 on Pixel 6, null on iOS.
const maxCount = QuickActions.maxCount;
```
```
--------------------------------
### Create Custom Build for Integration Testing
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
Integration testing for Quick Actions requires a custom build. Use 'npx expo prebuild' to create one, then run the app on a device or simulator.
```bash
# Create custom build
npx expo prebuild --clean
# Run on device/simulator
npx expo run:ios
npx expo run:android
# Run tests on device
```
--------------------------------
### QuickActions.isSupported
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Checks if the current device and platform support home screen quick actions.
```APIDOC
## Function: isSupported
**Signature:**
```typescript
function isSupported(): Promise
```
Determines whether the current device supports home screen quick actions.
### Parameters
None.
### Return Type
`Promise` - Resolves to `true` if the device supports quick actions, `false` otherwise.
```
--------------------------------
### ExpoAppIcon Native Module
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Interface for the native module that manages the application icon, allowing setting and getting the current icon.
```APIDOC
## Native Module: ExpoAppIcon
### Description
ExpoAppIcon native module
### Properties
#### isSupported (boolean)
Indicates if the app icon functionality is supported.
### Methods
#### setIcon(name: string | null): Promise
Sets the application icon.
#### getIcon(): Promise
Gets the current application icon name.
```
--------------------------------
### Check Support and Set Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/compatibility.md
Safely check if Quick Actions are supported on the current platform and set items if they are. This approach works on all platforms.
```typescript
// Safe: Works on all platforms
const supported = await QuickActions.isSupported();
if (supported) {
await QuickActions.setItems([...]);
}
```
--------------------------------
### ExpoAppIcon Native Module
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Defines the interface for the ExpoAppIcon native module, providing functionality to set and get the application icon.
```typescript
// ExpoAppIcon native module
declare class ExpoAppIcon extends NativeModule {
isSupported: boolean;
setIcon(name: string | null): Promise;
getIcon(): Promise;
}
```
--------------------------------
### Configure App.json for Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Configure the `app.json` file to enable the quick actions plugin and define static actions and icons for Android and iOS.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": {
"compose": {
"foregroundImage": "./assets/compose.png",
"backgroundColor": "#FF5722"
}
},
"iosIcons": {
"compose": "./assets/compose.png"
},
"iosActions": [
{
"id": "compose",
"title": "New Message",
"icon": "compose",
"params": { "href": "/compose" }
}
]
}
]
]
}
}
```
--------------------------------
### Simulate Quick Actions in Development
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/integration-guide.md
For development and testing purposes, you can simulate a quick action within your application. This allows you to test the `handleQuickAction` listener without needing to trigger it from the OS.
```typescript
// For testing in development
if (__DEV__) {
// Simulate a quick action
const simulateQuickAction = () => {
const testAction = {
id: "test",
title: "Test Action",
params: { href: "/search" },
};
// Call your listener
handleQuickAction(testAction);
};
}
```
--------------------------------
### OptionalPromise Usage Example
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Demonstrates using the OptionalPromise type in a hook callback, allowing for both synchronous boolean returns and asynchronous Promise returns.
```typescript
const callback = async (action: Action): OptionalPromise => {
// Can return a promise or a boolean
return true;
};
```
--------------------------------
### Get Current App Icon
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Retrieves the name of the currently active app icon. Returns `null` if the default app icon is in use.
```APIDOC
## AppIcon.getIcon()
### Description
Retrieves the name of the currently set application icon. If the default app icon is active, it returns `null`.
### Method
`AppIcon.getIcon(): Promise`
### Parameters
None
### Request Example
```typescript
import * as AppIcon from "expo-quick-actions/icon";
const current = await AppIcon.getIcon();
// Returns icon name or null for default
```
### Response
#### Success Response (string | null)
Returns the name of the current app icon as a string, or `null` if the default icon is active.
#### Response Example
`"dark"` or `null`
```
--------------------------------
### Check if Supported
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Asynchronously checks if the current device supports home screen quick actions.
```APIDOC
## `isSupported`
### Description
An async function that returns whether the device supports home screen quick actions.
### Returns
- `Promise`: True if supported, false otherwise.
### Example
```ts
const isSupported = await QuickActions.isSupported();
```
```
--------------------------------
### Basic Icon Plugin Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Adds the icon plugin to app.json to enable runtime app icon switching.
```json
{
"expo": {
"plugins": [
[
"expo-quick-actions/icon/plugin",
[
"./assets/icon-dark.png",
"./assets/icon-light.png"
]
]
]
}
}
```
--------------------------------
### Set Quick Actions at Runtime
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Configure the quick actions that appear when a user long-presses the app icon. This function takes an array of action objects, each with an ID, title, icon, and optional parameters for routing.
```APIDOC
## setItems()
### Description
Configures the quick actions available to the user by long-pressing the app icon.
### Method
`setItems(actions: Action[]): Promise`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
* **actions** (Action[]) - Required - An array of `Action` objects to display.
* **id** (string) - Required - Unique identifier for the action.
* **title** (string) - Required - The text displayed for the action.
* **icon** (string) - Required - The icon to display for the action (e.g., 'search', 'star').
* **params** (object) - Optional - Parameters to pass when the action is triggered, often used for routing.
### Request Example
```typescript
await QuickActions.setItems([
{
id: "1",
title: "Search",
icon: "search",
params: { href: "/search" },
},
]);
```
### Response
#### Success Response (void)
This function does not return a value upon success.
#### Response Example
None
```
--------------------------------
### addListener
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Registers a listener callback to be invoked when a quick action is triggered. This can occur either when the app is launched via a quick action or when the app is already running and a quick action is selected.
```APIDOC
## Function: addListener
### Description
Registers a listener callback to be invoked when a quick action is triggered. This can occur either when the app is launched via a quick action or when the app is already running and a quick action is selected.
### Signature
```typescript
function addListener(
listener: (action: TAction) => void
): { remove: () => void }
```
### Parameters
#### listener
- **listener** (`(action: TAction) => void`) - Required - Callback function invoked with the triggered action.
### Return Type
- `{ remove: () => void }` - An object with a `remove()` method to unsubscribe the listener.
### Example
```typescript
import * as QuickActions from "expo-quick-actions";
const subscription = QuickActions.addListener((action) => {
console.log("Quick action triggered:", action.id);
console.log("Action params:", action.params);
});
// Later, when you no longer need the listener:
subscription.remove();
```
**Web Fallback:** On web and unsupported platforms, this returns a no-op subscription object.
```
--------------------------------
### Get Current App Icon
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/icon.md
Retrieve the name of the currently active app icon. This is useful for understanding the app's current state or for UI feedback.
```typescript
import * as AppIcon from "expo-quick-actions/icon";
async function getCurrentIcon() {
if (!AppIcon.getIcon) {
console.log("Get icon not supported");
return;
}
try {
const current = await AppIcon.getIcon();
if (current) {
console.log("Current icon:", current);
} else {
console.log("Using default icon");
}
} catch (error) {
console.error("Failed to get icon:", error);
}
}
```
--------------------------------
### Get Maximum Number of Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Retrieve the maximum number of quick action items supported by the device. This value is hardcoded to 4 on iOS and dynamic on Android.
```tsx
// e.g. 15 on Pixel 6, null on iOS.
const maxCount = QuickActions.maxCount;
```
--------------------------------
### Configure Android Quick Action Icons
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
Map icon names to Android icon configurations, specifying foreground images, background colors, or adaptive icon properties. Icon names must follow Java/Android resource identifier rules.
```json
{
"androidIcons": {
"compose": {
"foregroundImage": "./assets/compose-fg.png",
"backgroundColor": "#EA3323"
},
"search": "./assets/search.png",
"settings": {
"foregroundImage": "./assets/settings-fg.png",
"backgroundColor": "#4A90E2",
"backgroundImage": "./assets/settings-bg.png"
}
}
}
```
--------------------------------
### Get Maximum Supported Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Retrieves the maximum number of quick actions supported by the device. This value is hardcoded to 4 on iOS and dynamically determined on Android.
```typescript
const max = QuickActions.maxCount;
if (max) {
console.log(`Device supports up to ${max} quick actions`);
}
```
--------------------------------
### Get Current Quick Action
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Use the `useQuickAction` hook to retrieve the current quick action. This hook re-renders the component when the action changes, making it suitable for UI updates.
```tsx
import { useQuickAction } from "expo-quick-actions/hooks";
function Route() {
// Re-renders the component when the action changes. This is useful for updating the UI.
const action = useQuickAction();
}
```
--------------------------------
### Static iOS Quick Actions Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
Define static quick actions for iOS directly in your app.json. These actions are available immediately on app launch.
```json
{
"iosActions": [
{
"id": "compose",
"title": "New Message",
"icon": "compose",
"params": {
"href": "/compose"
}
},
{
"id": "search",
"title": "Search",
"icon": "search",
"subtitle": "Find content",
"params": {
"href": "/search",
"focus": "true"
}
},
{
"id": "settings",
"title": "Settings",
"subtitle": "App Preferences",
"icon": "symbol:gear",
"params": {
"url": "https://example.com/help"
}
}
]
}
```
--------------------------------
### Get Current Quick Action in React
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
A React hook that returns the current quick action object and triggers a re-render when it changes. Ideal for displaying action data or conditional rendering.
```typescript
import { useQuickAction } from "expo-quick-actions/hooks";
function MyComponent() {
const action = useQuickAction();
return {action?.title || "No action"};
}
```
--------------------------------
### Import Quick Actions Module
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Import the main module for using quick actions functionality.
```typescript
import * as QuickActions from "expo-quick-actions";
```
--------------------------------
### IosStaticQuickActionProps
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Configuration for a static iOS quick action, including its ID, title, optional icon, subtitle, and parameters.
```APIDOC
## Type: IosStaticQuickActionProps
### Description
Configuration for a static iOS quick action in the config plugin.
### Fields
#### id (string) - Required
Unique action identifier.
#### title (string) - Required
User-visible title.
#### icon (string) - Optional
Icon name (built-in, SF Symbol, or custom asset).
#### subtitle (string) - Optional
iOS-only subtitle.
#### params (Record) - Optional
Additional action parameters.
```
--------------------------------
### Get Current App Icon
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/README.md
Retrieve the name of the currently set app icon using `AppIcon.getIcon()`. This function returns the icon name string or `null` if the default icon is active.
```typescript
import * as AppIcon from "expo-quick-actions/icon";
const current = await AppIcon.getIcon();
// Returns icon name or null for default
```
--------------------------------
### Check Quick Actions Support
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Determines if the current device supports home screen quick actions. Returns a promise that resolves to a boolean.
```typescript
function isSupported(): Promise
```
--------------------------------
### Set Quick Actions on Home Screen
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Configures the quick actions displayed on the device's home screen. Pass an empty array to clear existing actions.
```typescript
await QuickActions.setItems([
{
id: "search",
title: "Search",
icon: "search",
params: { href: "/search" },
},
]);
```
--------------------------------
### Listen for Quick Action Triggers
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Register a callback function to be executed when a quick action is triggered. This listener can handle actions when the app is launched via a shortcut or when the app is already running. Remember to unsubscribe when no longer needed.
```typescript
import * as QuickActions from "expo-quick-actions";
const subscription = QuickActions.addListener((action) => {
console.log("Quick action triggered:", action.id);
console.log("Action params:", action.params);
});
// Later, when you no longer need the listener:
subscription.remove();
```
--------------------------------
### Set Quick Action Items
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Sets the quick action items for the app. It's recommended to use a maximum of 4 items for both Apple and Android.
```APIDOC
## `setItems`
### Description
An async function that sets the quick action items for the app. Both Apple and Android recommend a max of 4 items.
### Parameters
- **items** (Action[]) - Required - An array of `Action` objects to set as quick actions.
### Returns
- `Promise`
### Example
```ts
QuickActions.setItems([
{
id: "0",
title: "Open Settings",
subtitle: "Go here to configure settings",
icon: "heart",
params: { href: "/settings" },
},
]);
```
```
--------------------------------
### ExpoQuickActions Native Module
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Interface for the native module that handles Expo Quick Actions, including methods to set items, check support, and listen for actions.
```APIDOC
## Native Module: ExpoQuickActions
### Description
ExpoQuickActions native module
### Properties
#### initial (Action)
#### maxCount (number)
### Methods
#### setItems(data?: Action[]): Promise
Sets the quick action items.
#### isSupported(): Promise
Checks if quick actions are supported on the current platform.
#### addListener(name: "onQuickAction", callback: (action: Action) => void): Subscription
Adds a listener for the `onQuickAction` event.
```
--------------------------------
### Check if Quick Actions are Supported
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Verifies if the current device supports the quick actions feature. Use this before attempting to set or listen for actions.
```typescript
const supported = await QuickActions.isSupported();
if (supported) {
await QuickActions.setItems([...]);
}
```
--------------------------------
### Dynamic App Icon Plugin: Array of Paths
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
Configure dynamic app icons using an array of image paths. Icon names are assigned as string indices.
```json
{
"plugins": [
[
"expo-quick-actions/icon/plugin",
[
"./assets/icon-dark.png",
"./assets/icon-light.png"
]
]
]
}
```
--------------------------------
### Check if Quick Actions are Supported
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Asynchronously check if the current device supports home screen quick actions.
```typescript
const isSupported = await QuickActions.isSupported();
```
--------------------------------
### Handle Custom Quick Action Logic
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/integration-guide.md
Implement custom logic for quick actions before default routing. Use this to redirect users or perform specific tasks based on the action ID.
```typescript
// app/(root)/_layout.tsx
import { useQuickActionRouting } from "expo-quick-actions/router";
import { useRouter } from "expo-router";
export default function RootLayout() {
const router = useRouter();
useQuickActionRouting(async (action) => {
// Custom handling for specific actions
if (action.id === "compose" && !isUserLoggedIn) {
// Redirect to login first
router.navigate("/login");
return true; // Skip default routing
}
if (action.id === "search") {
// Clear search history before navigating
await clearSearchHistory();
return false; // Allow default routing
}
// For all other actions, use default behavior
return false;
});
return ;
}
```
--------------------------------
### Set Home Screen Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/main.md
Configures the quick actions displayed on the home screen. This function replaces any existing actions. It's recommended to limit the number of actions to 4.
```typescript
import * as QuickActions from "expo-quick-actions";
await QuickActions.setItems([
{
id: "0",
title: "Open Settings",
subtitle: "Configure app preferences",
icon: "symbol:gear",
params: { href: "/settings" },
},
{
id: "1",
title: "New Message",
icon: "compose",
params: { href: "/compose" },
},
{
id: "2",
title: "Search",
icon: "search",
params: { href: "/search" },
},
{
id: "3",
title: "Favorites",
icon: "symbol:heart.fill",
params: { href: "/favorites" },
},
]);
```
--------------------------------
### Set Quick Action Items
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Set the quick action items for the app. It's recommended to use a maximum of 4 items on both Apple and Android platforms.
```typescript
QuickActions.setItems([
{
id: "0",
title: "Open Settings",
subtitle: "Go here to configure settings",
icon: "heart",
params: { href: "/settings" },
},
]);
```
--------------------------------
### Configure Quick Actions in app.json
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/configuration.md
Configure quick actions and icons within the `app.json` file using the `expo-quick-actions` plugin. This allows for platform-specific settings for Android and iOS, including custom icons and static actions for iOS.
```json
{
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": {
"action_1": { ... },
"action_2": { ... }
},
"iosIcons": {
"action_1": { ... },
"action_2": { ... }
},
"iosActions": [ ... ]
}
]
]
}
```
--------------------------------
### expo-quick-actions Module Exports
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Summary of the main exports from the `expo-quick-actions` module, including types, constants, and functions.
```APIDOC
## Module: expo-quick-actions
### Exports
- **Action**: Type
- **initial**: Const
- **maxCount**: Const
- **setItems**: Function
- **isSupported**: Function
- **addListener**: Function
```
--------------------------------
### Icon Plugin: Object with Named Icons Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Configures the icon plugin using an object where keys are icon names and values are image paths.
```json
[
"expo-quick-actions/icon/plugin",
{
"dark": "./assets/dark-icon.png",
"light": "./assets/light-icon.png",
"colorful": "./assets/colorful-icon.png"
}
]
```
--------------------------------
### useQuickActionRouting
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Enables linking to the `href` param when a quick action is used, integrating with Expo Router.
```APIDOC
## useQuickActionRouting
### Description
Enables linking to the `href` param when a quick action is used. This hook is designed for integration with Expo Router.
### Usage Example
```tsx
// app/(root)/_layout.tsx
import { useEffect } from "react";
import { Slot } from "expo-router";
import { useQuickActionRouting, RouterAction } from "expo-quick-actions/router";
import * as QuickActions from "expo-quick-actions";
export default function Layout() {
// Enable linking to the `href` param when a quick action is used.
useQuickActionRouting();
useEffect(() => {
// Now you can configure your quick actions to link places (including externally):
QuickActions.setItems([
{
title: "New Chat",
icon: "compose",
id: "0",
params: { href: "/compose" },
},
{
title: "Search",
icon: "search",
id: "1",
params: { href: "/search" },
},
{
title: "Leave Feedback",
subtitle: "Please provide feedback before deleting the app",
icon: "symbol:envelope",
id: "2",
params: { href: "mailto:support@myapp.dev" },
},
]);
}, []);
return ;
}
```
```
--------------------------------
### Icon Plugin: Array of Paths Configuration
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/config-plugin.md
Configures the icon plugin using an array of image paths. Icons are named by their index (e.g., '0', '1').
```json
[
"expo-quick-actions/icon/plugin",
[
"./assets/dark-icon.png",
"./assets/light-icon.png"
]
]
```
--------------------------------
### isSupported Function
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Checks whether the quick actions feature is supported on the current device.
```APIDOC
## isSupported() (Function)
### Description
Checks whether the quick actions feature is supported on the current device.
### Signature
```typescript
function isSupported(): Promise;
```
### Returns
- `Promise`: A promise that resolves to `true` if quick actions are supported, and `false` otherwise.
### Example
```typescript
const supported = await QuickActions.isSupported();
if (supported) {
await QuickActions.setItems([...]);
}
```
```
--------------------------------
### Checking Quick Actions Support
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/integration-guide.md
Always check if quick actions are supported before attempting to use them. This prevents runtime errors on platforms or devices where quick actions are not available.
```typescript
// Assumes quick actions are always supported
await QuickActions.setItems([...]);
```
```typescript
const supported = await QuickActions.isSupported();
if (supported) {
await QuickActions.setItems([...]);
}
```
--------------------------------
### Nested Layout with useQuickAction
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/api-reference/hooks.md
Use `useQuickAction` to conditionally set the initial route of a Stack navigator based on whether a quick action parameter is present. This allows for deep linking into specific screens when an action is triggered.
```typescript
import { useQuickAction } from "expo-quick-actions/hooks";
import { Stack } from "expo-router";
export function ScreenStack() {
const action = useQuickAction();
// Can use action to control stack state
const initialRoute = action?.params?.href ? "detail" : "list";
return ;
}
```
--------------------------------
### Add Listener for Quick Actions
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/README.md
Adds a listener that will be called when a quick action is triggered by the user.
```APIDOC
## `addListener`
### Description
Adds a listener that will fire when a quick action is triggered.
### Parameters
- **listener** (`(payload: Action) => void`) - Required - A callback function that receives the triggered `Action` object.
### Returns
- `Subscription`: An object with an `remove()` method to unsubscribe the listener.
### Example
```ts
const subscription = QuickActions.addListener((action) => {
console.log(action);
});
```
```
--------------------------------
### expo-quick-actions/icon Module Exports
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Summary of the exports from the `expo-quick-actions/icon` module, for managing application icons.
```APIDOC
## Module: expo-quick-actions/icon
### Exports
- **isSupported**: Const
- **setIcon**: Function
- **getIcon**: Function
```
--------------------------------
### ConfigPlugin Type (Root)
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
The main configuration plugin type for expo-quick-actions, used to configure Android icons, iOS icons, and iOS actions within `app.json`.
```APIDOC
## ConfigPlugin
### Description
The plugin is a standard Expo config plugin with the following signature:
```typescript
type ConfigPlugin = (
config: ExpoConfig,
options: {
androidIcons?: Record;
iosIcons?: Record;
iosActions?: IosAction[];
}
) => ExpoConfig;
```
### Configuration in app.json:
```json
{
"plugins": [
[
"expo-quick-actions",
{
"androidIcons": {...},
"iosIcons": {...},
"iosActions": [...]
}
]
]
}
```
```
--------------------------------
### Action Type Hierarchy
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/types.md
Illustrates the type hierarchy for actions, showing the base `Action` properties and how `RouterAction` extends it.
```APIDOC
## Type Hierarchy
```
Action
├── id: string
├── title: string
├── icon?: IconType
├── subtitle?: string (iOS-only)
└── params?: Record
RouterAction extends Action
└── params: {
href: Href;
...additionalParams
}
IconType =
| AppleBuiltInIcons
| AppleSymbolId
| LocalAssetId
| string
| null
```
```
--------------------------------
### Listen for Quick Action Events
Source: https://github.com/evanbacon/expo-quick-actions/blob/main/_autodocs/module-exports.md
Registers a callback function to be executed when a quick action is triggered. The returned subscription object can be used to unsubscribe.
```typescript
const subscription = QuickActions.addListener((action) => {
console.log("Action triggered:", action.id);
});
// Later:
subscription.remove();
```