### Pedometer Usage Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/pedometer
This example demonstrates how to check pedometer availability, get past step counts, and subscribe to live updates. Ensure you handle the subscription cleanup.
```jsx
import { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Pedometer } from 'expo-sensors';
export default function App() {
const [isPedometerAvailable, setIsPedometerAvailable] = useState('checking');
const [pastStepCount, setPastStepCount] = useState(0);
const [currentStepCount, setCurrentStepCount] = useState(0);
const subscribe = async () => {
const isAvailable = await Pedometer.isAvailableAsync();
setIsPedometerAvailable(String(isAvailable));
if (isAvailable) {
const end = new Date();
const start = new Date();
start.setDate(end.getDate() - 1);
const pastStepCountResult = await Pedometer.getStepCountAsync(start, end);
if (pastStepCountResult) {
setPastStepCount(pastStepCountResult.steps);
}
return Pedometer.watchStepCount(result => {
setCurrentStepCount(result.steps);
});
}
};
useEffect(() => {
const subscription = subscribe();
return () => subscription && subscription.remove();
}, []);
return (
Pedometer.isAvailableAsync(): {isPedometerAvailable}Steps taken in the last 24 hours: {pastStepCount}Walk! And watch this go up: {currentStepCount}
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 15,
alignItems: 'center',
justifyContent: 'center',
},
});
```
--------------------------------
### Install @shopify/react-native-skia with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/skia
Use this command to install the library using bun.
```sh
bun expo install @shopify/react-native-skia
```
--------------------------------
### Install @react-native-async-storage/async-storage with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/async-storage
Use this command to install the library using bun.
```sh
bun expo install @react-native-async-storage/async-storage
```
--------------------------------
### Install @react-native-segmented-control/segmented-control with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/segmented-control
Use this command to install the library using bun.
```sh
bun expo install @react-native-segmented-control/segmented-control
```
--------------------------------
### Install @react-native-async-storage/async-storage with pnpm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/async-storage
Use this command to install the library using pnpm.
```sh
pnpm expo install @react-native-async-storage/async-storage
```
--------------------------------
### Install @react-native-async-storage/async-storage with npm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/async-storage
Use this command to install the library using npm.
```sh
npx expo install @react-native-async-storage/async-storage
```
--------------------------------
### Install @shopify/react-native-skia with pnpm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/skia
Use this command to install the library using pnpm.
```sh
pnpm expo install @shopify/react-native-skia
```
--------------------------------
### Install @react-native-async-storage/async-storage with yarn
Source: https://docs.expo.dev/versions/v55.0.0/sdk/async-storage
Use this command to install the library using yarn.
```sh
yarn expo install @react-native-async-storage/async-storage
```
--------------------------------
### Install react-native-gesture-handler with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/gesture-handler
Use this command to install the library using bun.
```sh
bun expo install react-native-gesture-handler
```
--------------------------------
### Install react-native-webview
Source: https://docs.expo.dev/versions/v55.0.0/sdk/webview
Install the react-native-webview library using your preferred package manager.
```sh
npx expo install react-native-webview
```
```sh
yarn expo install react-native-webview
```
```sh
pnpm expo install react-native-webview
```
```sh
bun expo install react-native-webview
```
--------------------------------
### Install @shopify/react-native-skia with npm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/skia
Use this command to install the library using npm.
```sh
npx expo install @shopify/react-native-skia
```
--------------------------------
### Install @react-native-masked-view/masked-view with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/masked-view
Use this command to install the library using bun.
```sh
bun expo install @react-native-masked-view/masked-view
```
--------------------------------
### Install @shopify/react-native-skia with yarn
Source: https://docs.expo.dev/versions/v55.0.0/sdk/skia
Use this command to install the library using yarn.
```sh
yarn expo install @shopify/react-native-skia
```
--------------------------------
### Install expo-video-thumbnails
Source: https://docs.expo.dev/versions/v55.0.0/sdk/video-thumbnails
Install the expo-video-thumbnails package using npm, yarn, pnpm, or bun.
```sh
npx expo install expo-video-thumbnails
```
```sh
yarn expo install expo-video-thumbnails
```
```sh
pnpm expo install expo-video-thumbnails
```
```sh
bun expo install expo-video-thumbnails
```
--------------------------------
### Install expo-screen-capture
Source: https://docs.expo.dev/versions/v55.0.0/sdk/screen-capture
Install the expo-screen-capture package using npm, yarn, pnpm, or bun.
```sh
npx expo install expo-screen-capture
```
```sh
yarn expo install expo-screen-capture
```
```sh
pnpm expo install expo-screen-capture
```
```sh
bun expo install expo-screen-capture
```
--------------------------------
### Install @react-native-segmented-control/segmented-control with pnpm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/segmented-control
Use this command to install the library using pnpm.
```sh
pnpm expo install @react-native-segmented-control/segmented-control
```
--------------------------------
### Install expo-audio
Source: https://docs.expo.dev/versions/v55.0.0/sdk/audio
Install the expo-audio library using your preferred package manager.
```sh
npx expo install expo-audio
```
```sh
yarn expo install expo-audio
```
```sh
pnpm expo install expo-audio
```
```sh
bun expo install expo-audio
```
--------------------------------
### Start a Live Activity Tracking
Source: https://docs.expo.dev/versions/v55.0.0/sdk/widgets
Initiate a Live Activity by calling the `start` method with activity props and a deep link URL. The returned instance can be used for further management of the Live Activity.
```tsx
import { Button, View } from 'react-native';
import DeliveryActivity from './DeliveryActivity';
function App() {
const startDeliveryTracking = () => {
// Start the Live Activity
const instance = DeliveryActivity.start(
{
etaMinutes: 15,
status: 'Your delivery is on the way',
},
'myapp://deliveries/12345'
);
// Store instance
};
return (
);
}
export default App;
```
--------------------------------
### usePowerState Hook Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/battery
Example of using the usePowerState hook to get comprehensive power state information.
```ts
const { lowPowerMode, batteryLevel, batteryState } = usePowerState();
```
--------------------------------
### Install @react-native-segmented-control/segmented-control with yarn
Source: https://docs.expo.dev/versions/v55.0.0/sdk/segmented-control
Use this command to install the library using yarn.
```sh
yarn expo install @react-native-segmented-control/segmented-control
```
--------------------------------
### useBatteryState Hook Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/battery
Example of using the useBatteryState hook to get the device's battery state.
```ts
const batteryState = useBatteryState();
```
--------------------------------
### Install react-native-gesture-handler with npm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/gesture-handler
Use this command to install the library using npm.
```sh
npx expo install react-native-gesture-handler
```
--------------------------------
### Install react-native-gesture-handler with pnpm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/gesture-handler
Use this command to install the library using pnpm.
```sh
pnpm expo install react-native-gesture-handler
```
--------------------------------
### useBatteryLevel Hook Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/battery
Example of using the useBatteryLevel hook to get the device's battery level.
```ts
const batteryLevel = useBatteryLevel();
```
--------------------------------
### Install @react-native-segmented-control/segmented-control with npm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/segmented-control
Use this command to install the library using npm.
```sh
npx expo install @react-native-segmented-control/segmented-control
```
--------------------------------
### Menu Picker Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/ui/swift-ui/picker
Shows how to implement a 'menu' style Picker for selecting an item. This example uses state management to track the selected option and requires specific imports.
```tsx
import { useState } from 'react';
import { Host, Picker, Text } from '@expo/ui/swift-ui';
import { pickerStyle, tag } from '@expo/ui/swift-ui/modifiers';
const options = ['Apple', 'Banana', 'Orange'];
export default function MenuPickerExample() {
const [selectedTag, setSelectedTag] = useState(options[0]);
return (
{
setSelectedTag(selection);
}}>
{options.map(option => (
{option}
))}
);
}
```
--------------------------------
### Install @expo/app-integrity
Source: https://docs.expo.dev/versions/v55.0.0/sdk/app-integrity
Install the AppIntegrity library using your preferred package manager. This command ensures you get the correct version for your Expo project.
```sh
npx expo install @expo/app-integrity
```
```sh
yarn expo install @expo/app-integrity
```
```sh
pnpm expo install @expo/app-integrity
```
```sh
bun expo install @expo/app-integrity
```
--------------------------------
### Install react-native-gesture-handler with yarn
Source: https://docs.expo.dev/versions/v55.0.0/sdk/gesture-handler
Use this command to install the library using yarn.
```sh
yarn expo install react-native-gesture-handler
```
--------------------------------
### Application.getInstallReferrerAsync()
Source: https://docs.expo.dev/versions/v55.0.0/sdk/application
Gets the referrer URL of the installed app with the Install Referrer API from the Google Play Store. Returns a Promise that fulfills with a string.
```APIDOC
## `Application.getInstallReferrerAsync()`
### Description
Gets the referrer URL of the installed app with the Install Referrer API from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
### Method
`getInstallReferrerAsync()`
### Returns
`Promise` - A Promise that fulfills with a `string` of the referrer URL of the installed app.
### Example
```ts
await Application.getInstallReferrerAsync();
// "utm_source=google-play&utm_medium=organic"
```
```
--------------------------------
### Install @shopify/flash-list with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/flash-list
Use this command to install the @shopify/flash-list package using bun.
```sh
bun expo install @shopify/flash-list
```
--------------------------------
### Basic Pull to Refresh Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/ui/jetpack-compose/pulltorefreshbox
Wrap scrollable content in a PullToRefreshBox to add pull-to-refresh behavior. This example demonstrates a basic setup with a LazyColumn.
```tsx
import { useState, useCallback } from 'react';
import { Host, PullToRefreshBox, LazyColumn, ListItem } from '@expo/ui/jetpack-compose';
export default function BasicPullToRefresh() {
const [refreshing, setRefreshing] = useState(false);
const onRefresh = useCallback(() => {
setRefreshing(true);
setTimeout(() => {
setRefreshing(false);
}, 2000);
}, []);
return (
Item 1Item 2Item 3Item 4Item 5
);
}
```
--------------------------------
### Browserslist Configuration in package.json
Source: https://docs.expo.dev/versions/v55.0.0/config/metro
Example of defining browser support and CSS vendor prefixing using the 'browserslist' field in package.json.
```json
{
"browserslist": [">0.2%", "not dead", "not op_mini all"]
}
```
--------------------------------
### Install react-native-pager-view
Source: https://docs.expo.dev/versions/v55.0.0/sdk/view-pager
Install the react-native-pager-view package using your preferred package manager. This command ensures you get the correct version compatible with your Expo SDK.
```sh
npx expo install react-native-pager-view
```
```sh
yarn expo install react-native-pager-view
```
```sh
pnpm expo install react-native-pager-view
```
```sh
bun expo install react-native-pager-view
```
--------------------------------
### Install Expo Maps
Source: https://docs.expo.dev/versions/v55.0.0/sdk/maps
Install the expo-maps package using npm, yarn, pnpm, or bun. This command ensures you get the correct version for your project.
```sh
npx expo install expo-maps
```
```sh
yarn expo install expo-maps
```
```sh
pnpm expo install expo-maps
```
```sh
bun expo install expo-maps
```
--------------------------------
### Basic Print and File Saving Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/print
This example demonstrates how to print HTML content directly or save it as a PDF file and share it. It includes platform-specific logic for selecting printers on iOS.
```jsx
import { useState } from 'react';
import { View, StyleSheet, Button, Platform, Text } from 'react-native';
import * as Print from 'expo-print';
import { shareAsync } from 'expo-sharing';
const html = "
Hello Expo!
";
export default function App() {
const [selectedPrinter, setSelectedPrinter] = useState();
const print = async () => {
// On iOS/android prints the given html. On web prints the HTML from the current page.
await Print.printAsync({
html,
printerUrl: selectedPrinter?.url, // iOS only
});
};
const printToFile = async () => {
// On iOS/android prints the given html. On web prints the HTML from the current page.
const { uri } = await Print.printToFileAsync({ html });
console.log('File has been saved to:', uri);
await shareAsync(uri, { UTI: '.pdf', mimeType: 'application/pdf' });
};
const selectPrinter = async () => {
const printer = await Print.selectPrinterAsync(); // iOS only
setSelectedPrinter(printer);
};
return (
{Platform.OS === 'ios' && (
<>
{selectedPrinter ? (
{`Selected printer: ${selectedPrinter.name}`}
) : undefined}
>
)}
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#ecf0f1',
flexDirection: 'column',
padding: 8,
},
spacer: {
height: 8,
},
printer: {
textAlign: 'center',
},
});
```
--------------------------------
### Install Expo Device
Source: https://docs.expo.dev/versions/v55.0.0/sdk/device
Install the expo-device package using your preferred package manager. This command ensures you get the correct version for your Expo SDK.
```sh
npx expo install expo-device
```
```sh
yarn expo install expo-device
```
```sh
pnpm expo install expo-device
```
```sh
bun expo install expo-device
```
--------------------------------
### Get App Installation Time
Source: https://docs.expo.dev/versions/v55.0.0/sdk/application
Retrieves the time the application was initially installed on the device. This value is not updated for subsequent app updates. Returns null on web.
```typescript
await Application.getInstallationTimeAsync();
// 2019-07-18T18:08:26.121Z
```
--------------------------------
### Install NetInfo with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/netinfo
Use this command to install the @react-native-community/netinfo library using bun.
```sh
bun expo install @react-native-community/netinfo
```
--------------------------------
### LiveActivityFactory.start
Source: https://docs.expo.dev/versions/v55.0.0/sdk/widgets
Starts a new Live Activity with initial content properties and an optional deep linking URL.
```APIDOC
## LiveActivityFactory.start
### Description
Starts a new Live Activity with the given properties. An optional URL can be provided for deep linking.
### Method
start
### Parameters
#### Request Body
- **props** (T) - Required - The initial content properties for the Live Activity.
- **url** (string) - Optional - An optional URL to associate with the Live Activity, used for deep linking.
### Response
#### Success Response (LiveActivity)
- Returns the newly created Live Activity instance.
### Request Example
```tsx
const instance = DeliveryActivity.start({
etaMinutes: 15,
status: 'Your delivery is on the way',
}, 'exp://example.com/delivery/123');
```
```
--------------------------------
### Get App Install Referrer
Source: https://docs.expo.dev/versions/v55.0.0/sdk/application
Fetches the referrer URL used during the app's installation from the Google Play Store on Android. The referrer may not always be a complete URL.
```typescript
await Application.getInstallReferrerAsync();
// "utm_source=google-play&utm_medium=organic"
```
--------------------------------
### Linking URL Examples
Source: https://docs.expo.dev/versions/v55.0.0/sdk/linking
Examples of different URL formats for development and production builds, including web and Expo Go.
```text
://path
```
```text
https://localhost:19006/path
```
```text
https://myapp.com/path
```
```text
exp://128.0.0.1:8081/--/path
```
--------------------------------
### Background Location Tracking Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/task-manager
This example demonstrates how to request background location permissions and start location updates using expo-task-manager and expo-location. The task is defined to handle incoming location data or errors.
```jsx
import React from 'react';
import { Button, View, StyleSheet } from 'react-native';
import * as TaskManager from 'expo-task-manager';
import * as Location from 'expo-location';
const LOCATION_TASK_NAME = 'background-location-task';
const requestPermissions = async () => {
const { status: foregroundStatus } = await Location.requestForegroundPermissionsAsync();
if (foregroundStatus === 'granted') {
const { status: backgroundStatus } = await Location.requestBackgroundPermissionsAsync();
if (backgroundStatus === 'granted') {
await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, {
accuracy: Location.Accuracy.Balanced,
});
}
}
};
const PermissionsButton = () => (
);
TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => {
if (error) {
// Error occurred - check `error.message` for more details.
return;
}
if (data) {
const { locations } = data;
// do something with the locations captured in the background
}
});
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});
export default PermissionsButton;
```
--------------------------------
### Use Brightness Hook
Source: https://docs.expo.dev/versions/v55.0.0/sdk/brightness
Example of using the usePermissions hook to get permission status and request permissions for brightness.
```ts
const [permissionResponse, requestPermission] = Brightness.usePermissions();
```
--------------------------------
### Application.getInstallationTimeAsync()
Source: https://docs.expo.dev/versions/v55.0.0/sdk/application
Gets the time the app was installed onto the device, not counting subsequent updates. Returns a Promise that fulfills with a Date object.
```APIDOC
## `Application.getInstallationTimeAsync()`
### Description
Gets the time the app was installed onto the device, not counting subsequent updates. If the app is uninstalled and reinstalled, this method returns the time the app was reinstalled.
### Method
`getInstallationTimeAsync()`
### Returns
`Promise` - A Promise that fulfills with a `Date` object that specifies the time the app was installed on the device.
### Example
```ts
await Application.getInstallationTimeAsync();
// 2019-07-18T18:08:26.121Z
```
```
--------------------------------
### Start Activity Async
Source: https://docs.expo.dev/versions/v55.0.0/sdk/intent-launcher
Start a specified activity with optional parameters. The promise resolves when the user returns to the app.
```js
IntentLauncher.startActivityAsync(activityAction, params)
```
--------------------------------
### Get user's preferred calendars
Source: https://docs.expo.dev/versions/v55.0.0/sdk/localization
Example of the data structure returned by the useCalendars hook, representing the user's calendar preferences.
```js
[{
"calendar": "gregory",
"timeZone": "Europe/Warsaw",
"uses24hourClock": true,
"firstWeekday": 1
}]
```
--------------------------------
### Install react-native-screens with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/screens
Use this command to install the react-native-screens library using bun.
```bash
bun expo install react-native-screens
```
--------------------------------
### PostCSS Configuration with Tailwind CSS
Source: https://docs.expo.dev/versions/v55.0.0/config/metro
Example of a PostCSS configuration file using Tailwind CSS. This setup allows for custom CSS processing.
```json
{
"plugins": {
"tailwindcss": {}
}
}
```
--------------------------------
### Icon Size Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/ui/jetpack-compose/icon
Example demonstrating how to set a specific size for the icon in dp using the 'size' prop.
```tsx
```
--------------------------------
### Get Available Email Clients
Source: https://docs.expo.dev/versions/v55.0.0/sdk/mail-composer
Retrieve a list of installed email clients on the device using getClients(). This can be useful for offering users a choice of which client to use.
```js
const clients = await MailComposer.getClients();
console.log(clients);
```
--------------------------------
### startObserving
Source: https://docs.expo.dev/versions/v55.0.0/sdk/expo
Function that is automatically invoked when the first listener for an event with the given name is added. Override it in a subclass to perform some additional setup once the event started being observed.
```APIDOC
## startObserving(eventName)
### Description
Function that is automatically invoked when the first listener for an event with the given name is added. Override it in a subclass to perform some additional setup once the event started being observed.
### Method
Not applicable (SDK method)
### Parameters
#### Path Parameters
- **eventName** (EventName) - Required - The name of the event to start observing.
### Response
#### Success Response (void)
Returns void.
```
--------------------------------
### Get System Groups
Source: https://docs.expo.dev/versions/v55.0.0/sdk/contacts
Queries and returns a list of system groups based on the provided group query. This example shows fetching groups by name and fetching all groups.
```javascript
const groups = await Contacts.getGroupsAsync({ groupName: 'sailor moon' });
const allGroups = await Contacts.getGroupsAsync({});
```
--------------------------------
### Install Expo FileSystem
Source: https://docs.expo.dev/versions/v55.0.0/sdk/filesystem-legacy
Install the `expo-file-system` package using your preferred package manager.
```sh
npx expo install expo-file-system
```
```sh
yarn expo install expo-file-system
```
```sh
pnpm expo install expo-file-system
```
```sh
bun expo install expo-file-system
```
--------------------------------
### Get System Containers
Source: https://docs.expo.dev/versions/v55.0.0/sdk/contacts
Queries and retrieves a list of system containers based on the provided query criteria. This example fetches containers associated with a specific contact ID.
```javascript
const allContainers = await Contacts.getContainersAsync({
contactId: '665FDBCFAE55-D614-4A15-8DC6-161A368D',
});
```
--------------------------------
### Import and Initialize Packages for Blurhash
Source: https://docs.expo.dev/versions/v55.0.0/sdk/image
Import multer, sharp, and the encode function from blurhash. Initialize multer for handling uploads.
```js
// Multer is a middleware for handling `multipart/form-data`.
const multer = require('multer');
// Sharp allows you to receive a data buffer from the uploaded image.
const sharp = require('sharp');
// Import the encode function from the blurhash package.
const { encode } = require('blurhash');
// Initialize `multer`.
const upload = multer();
```
--------------------------------
### Install @react-native-picker/picker with bun
Source: https://docs.expo.dev/versions/v55.0.0/sdk/picker
Use this command to install the picker component using bun.
```sh
bun expo install @react-native-picker/picker
```
--------------------------------
### Get Contacts with Specific Fields
Source: https://docs.expo.dev/versions/v55.0.0/sdk/contacts
Fetches a list of contacts, optionally filtering by specific fields. This example retrieves contacts and logs the first one if data is available.
```javascript
const { data } = await Contacts.getContactsAsync({
fields: [Contacts.Fields.Emails],
});
if (data.length > 0) {
const contact = data[0];
console.log(contact);
}
```
--------------------------------
### Date Range Picker Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/ui/swift-ui/datepicker
Demonstrates how to set a date range for the DatePicker component, restricting selections between a start and end date. The component updates the selected date on change.
```tsx
import { useState } from 'react';
import { Host, DatePicker } from '@expo/ui/swift-ui';
export default function DateRangePickerExample() {
const [selectedDate, setSelectedDate] = useState(new Date());
return (
{
setSelectedDate(date);
}}
/>
);
}
```
--------------------------------
### Getting Current Pathname with usePathname
Source: https://docs.expo.dev/versions/v55.0.0/sdk/router/index
The `usePathname` hook returns the current route location without search parameters, normalizing segments. For example, `/acme?foo=bar` returns `/acme`.
```tsx
import { Text } from 'react-native';
import { usePathname } from 'expo-router';
export default function Route() {
// pathname = "/profile/baconbrix"
const pathname = usePathname();
return Pathname: {pathname};
}
```
--------------------------------
### onLoadStart
Source: https://docs.expo.dev/versions/v55.0.0/sdk/live-photo
Callback function invoked when the live photo loading process begins.
```APIDOC
## onLoadStart
### Description
Called when the live photo starts loading.
### Method
Callback
```
--------------------------------
### Set Audio Mode for Background Recording
Source: https://docs.expo.dev/versions/v55.0.0/sdk/audio
Configure audio playback and recording settings at runtime, including enabling background recording. This example also shows how to initialize and start the audio recorder.
```jsx
import { setAudioModeAsync, useAudioRecorder, RecordingPresets } from 'expo-audio';
await setAudioModeAsync({
playsInSilentMode: true,
allowsRecording: true,
allowsBackgroundRecording: true,
});
const recorder = useAudioRecorder(RecordingPresets.HIGH_QUALITY);
await recorder.prepareToRecordAsync();
await recorder.record();
// Recording continues in background
```
--------------------------------
### startAnimating
Source: https://docs.expo.dev/versions/v55.0.0/sdk/image
Asynchronously starts the playback of an animated image view.
```APIDOC
## `startAnimating()`
### Description
Asynchronously starts playback of the view's image if it is animated.
### Returns
* `Promise`
```
--------------------------------
### Install react-native-view-shot
Source: https://docs.expo.dev/versions/v55.0.0/sdk/captureRef
Install the react-native-view-shot library using npm, yarn, pnpm, or bun.
```sh
npx expo install react-native-view-shot
```
```sh
yarn expo install react-native-view-shot
```
```sh
pnpm expo install react-native-view-shot
```
```sh
bun expo install react-native-view-shot
```
--------------------------------
### Get Step Count Between Dates
Source: https://docs.expo.dev/versions/v55.0.0/sdk/pedometer
Use Pedometer.getStepCountAsync(start, end) to retrieve the number of steps taken between two specified dates. Note that only the past seven days of data are available on iOS.
```js
Pedometer.getStepCountAsync(start, end)
```
--------------------------------
### Stack Toolbar Search Bar Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/router/stack
Demonstrates how to integrate a search bar within a Stack Toolbar, alongside other toolbar items and a spacer. This setup is useful for creating interactive search functionalities in the toolbar.
```tsx
{}} />
```
--------------------------------
### Install @shopify/flash-list with pnpm
Source: https://docs.expo.dev/versions/v55.0.0/sdk/flash-list
Use this command to install the @shopify/flash-list package using pnpm.
```sh
pnpm expo install @shopify/flash-list
```
--------------------------------
### Exclude Libraries from Expo Version Checks
Source: https://docs.expo.dev/versions/v55.0.0/config/package-json
Use the 'install.exclude' array to prevent specific libraries from being checked against Expo's recommended versions during commands like 'npx expo start' or 'npx expo install'.
```json
{
"expo": {
"install": {
"exclude": ["expo-updates", "expo-splash-screen"]
}
}
}
```
--------------------------------
### Open OS Settings with Linking.openSettings
Source: https://docs.expo.dev/versions/v55.0.0/sdk/linking
Open the operating system's settings app to display the app's custom settings. This method returns a promise that resolves when the settings are opened.
```javascript
await Linking.openSettings();
```
--------------------------------
### Install @shopify/flash-list with yarn
Source: https://docs.expo.dev/versions/v55.0.0/sdk/flash-list
Use this command to install the @shopify/flash-list package using yarn.
```sh
yarn expo install @shopify/flash-list
```
--------------------------------
### Expo Secure Store Usage Example
Source: https://docs.expo.dev/versions/v55.0.0/sdk/securestore
A React Native component demonstrating how to save and retrieve key-value pairs using Expo Secure Store. It includes input fields for keys and values, and buttons to perform save and get operations.
```jsx
import { useState } from 'react';
import { Text, View, StyleSheet, TextInput, Button } from 'react-native';
import * as SecureStore from 'expo-secure-store';
async function save(key, value) {
await SecureStore.setItemAsync(key, value);
}
async function getValueFor(key) {
let result = await SecureStore.getItemAsync(key);
if (result) {
alert("\ud83d\udd10 Here's your value \ud83d\udd10 \n" + result);
} else {
alert('No values stored under that key.');
}
}
export default function App() {
const [key, onChangeKey] = useState('Your key here');
const [value, onChangeValue] = useState('Your value here');
return (
Save an item, and grab it later!
{Add some TextInput components... }
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: 10,
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
marginTop: 34,
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
textInput: {
height: 35,
borderColor: 'gray',
borderWidth: 0.5,
padding: 4,
},
});
```
--------------------------------
### Install expo-background-fetch
Source: https://docs.expo.dev/versions/v55.0.0/sdk/background-fetch
Install the library using your preferred package manager. If you are in an existing React Native app, ensure Expo is installed.
```sh
npx expo install expo-background-fetch
```
```sh
yarn expo install expo-background-fetch
```
```sh
pnpm expo install expo-background-fetch
```
```sh
bun expo install expo-background-fetch
```
--------------------------------
### Install @expo/ui
Source: https://docs.expo.dev/versions/v55.0.0/sdk/ui/drop-in-replacements/segmentedcontrol
Install the @expo/ui package using npm, yarn, pnpm, or bun. Ensure Expo is installed in bare React Native projects.
```sh
npx expo install @expo/ui
```
```sh
yarn expo install @expo/ui
```
```sh
pnpm expo install @expo/ui
```
```sh
bun expo install @expo/ui
```
--------------------------------
### Show Manual Action
Source: https://docs.expo.dev/versions/v55.0.0/sdk/intent-launcher
Use this constant to show the manual.
```javascript
ActivityAction.SHOW_MANUAL = "android.settings.SHOW_MANUAL"
```
--------------------------------
### Install expo-glass-effect
Source: https://docs.expo.dev/versions/v55.0.0/sdk/glass-effect
Install the expo-glass-effect package using npm, yarn, pnpm, or bun. Ensure Expo is installed in bare React Native projects.
```sh
npx expo install expo-glass-effect
yarn expo install expo-glass-effect
pnpm expo install expo-glass-effect
bun expo install expo-glass-effect
```
--------------------------------
### Install expo-application
Source: https://docs.expo.dev/versions/v55.0.0/sdk/application
Install the expo-application package using npm, yarn, pnpm, or bun. Ensure Expo is installed in existing React Native apps.
```sh
npx expo install expo-application
```
```sh
yarn expo install expo-application
```
```sh
pnpm expo install expo-application
```
```sh
bun expo install expo-application
```
--------------------------------
### Example .fingerprintignore Configuration
Source: https://docs.expo.dev/versions/v55.0.0/sdk/fingerprint
Use a .fingerprintignore file in your project root to exclude files from hash calculation. Patterns are relative to the project root and use minimatch.
```ignore
# Ignore the entire android directory
android/**/*
# Ignore the entire ios directory but still keep ios/Podfile and ios/Podfile.lock
ios/**/*
!ios/Podfile
!ios/Podfile.lock
# Ignore specific package in node_modules
node_modules/some-package/**/*
# Same as above but having broader scope because packages may be nested
**/node_modules/some-package/**/*
```
--------------------------------
### Install expo-video
Source: https://docs.expo.dev/versions/v55.0.0/sdk/video
Install the expo-video package using npm, yarn, pnpm, or bun. Ensure Expo modules are installed in bare React Native projects.
```sh
npx expo install expo-video
```
```sh
yarn expo install expo-video
```
```sh
pnpm expo install expo-video
```
```sh
bun expo install expo-video
```
--------------------------------
### Install Expo Font
Source: https://docs.expo.dev/versions/v55.0.0/sdk/font
Install the expo-font package using npm, yarn, pnpm, or bun. Ensure expo is installed in existing React Native apps.
```sh
npx expo install expo-font
```
```sh
yarn expo install expo-font
```
```sh
pnpm expo install expo-font
```
```sh
bun expo install expo-font
```
--------------------------------
### Basic SQLiteProvider Setup
Source: https://docs.expo.dev/versions/v55.0.0/sdk/sqlite
Set up the SQLiteProvider with a database name. This component provides access to SQLite functionalities within its children.
```tsx
export default function App() {
return (
);
}
```
--------------------------------
### Install Expo ImagePicker
Source: https://docs.expo.dev/versions/v55.0.0/sdk/imagepicker
Install the expo-image-picker package using npm, yarn, pnpm, or bun. If using a bare React Native app, ensure Expo is installed.
```sh
npx expo install expo-image-picker
yarn expo install expo-image-picker
pnpm expo install expo-image-picker
bun expo install expo-image-picker
```
--------------------------------
### Install Expo LivePhoto
Source: https://docs.expo.dev/versions/v55.0.0/sdk/live-photo
Install the expo-live-photo package using your preferred package manager. Ensure Expo modules are installed if using an existing React Native app.
```sh
npx expo install expo-live-photo
```
```sh
yarn expo install expo-live-photo
```
```sh
pnpm expo install expo-live-photo
```
```sh
bun expo install expo-live-photo
```
--------------------------------
### Using Local Config Plugins for Fingerprinting
Source: https://docs.expo.dev/versions/v55.0.0/sdk/fingerprint
This example shows how to use a local config plugin by exporting it as a module. This approach allows for better fingerprinting when changes are made to the plugin's implementation, as the module path can be specified in the `app.json` configuration.
```javascript
const { withInfoPlist } = require('expo/config-plugins');
const withMyPlugin = config => {
return withInfoPlist(config, config => {
config.modResults.NSLocationWhenInUseUsageDescription =
'Allow $(PRODUCT_NAME) to use your location';
return config;
});
};
module.exports = withMyPlugin;
```
```json
{
"expo": {
...
"plugins": "./plugins/withMyPlugin"
}
}
```
--------------------------------
### Install Expo Blob
Source: https://docs.expo.dev/versions/v55.0.0/sdk/blob
Install the expo-blob package using npm, yarn, pnpm, or bun. Ensure Expo modules are installed for existing React Native apps.
```sh
npx expo install expo-blob
yarn expo install expo-blob
pnpm expo install expo-blob
bun expo install expo-blob
```