One Logo Pool Ball
wwwwwwwwwwwwwwwwwww

Migrating to One Native

Moving an app from Expo and community native packages onto One's native modules

Most of One’s native modules keep the API shape of the package they replace, so migrating is usually an import change plus the renames below. Options that a table does not list have no One equivalent.

// before
import * as Clipboard from 'expo-clipboard'
await Clipboard.setStringAsync(text)
// after
import { One } from 'one'
await One.Clipboard.setString(text)

Clipboard

From expo-clipboard. See Clipboard.

expo-clipboardOne
getStringAsync()One.Clipboard.getString()
setStringAsync(text)One.Clipboard.setString(text)
hasStringAsync()One.Clipboard.hasString()

Network

From expo-network. Import useNetworkState directly from one. See Network.

expo-networkOne
getNetworkStateAsync()One.Network.getState()
addNetworkStateListener(fn)One.Network.addStateListener(fn)
useNetworkState()useNetworkState()
NetworkStateType.WIFI'wifi' (and likewise for every member)

Browser

From expo-web-browser. See Browser.

expo-web-browserOne
openBrowserAsync(url, options?)One.Browser.open(url, options?)
dismissBrowser()One.Browser.dismiss()
openAuthSessionAsync(url, redirectUrl?, options?)One.Browser.openAuthSession(url, redirectUrl?, options?)
dismissAuthSession()One.Browser.dismissAuthSession()
WebBrowserResultBrowserResult
WebBrowserResultTypeBrowserResultType
WebBrowserPresentationStyleBrowserPresentationStyle
ERR_WEB_BROWSER_BLOCKEDE_BROWSER_BLOCKED

Secure store

From expo-secure-store. See SecureStore.

expo-secure-storeOne
getItemAsync(key)One.SecureStore.getItem(key)
setItemAsync(key, value)One.SecureStore.setItem(key, value)
deleteItemAsync(key)One.SecureStore.deleteItem(key)
getItem(key)One.SecureStore.getItemSync(key)
setItem(key, value)One.SecureStore.setItemSync(key, value)

Image picker

From expo-image-picker. See ImagePicker.

expo-image-pickerOne
launchImageLibraryAsyncOne.ImagePicker.launchLibrary
launchCameraAsyncOne.ImagePicker.launchCamera
getCameraPermissionsAsyncOne.ImagePicker.getCameraPermissions
requestCameraPermissionsAsyncOne.ImagePicker.requestCameraPermissions

mediaTypes and selectionLimit are the whole options surface; allowsEditing, quality, aspect, and the rest have no equivalent.

Document picker

From expo-document-picker. See DocumentPicker.

expo-document-pickerOne
getDocumentAsyncOne.DocumentPicker.getDocument

copyToCacheDirectory has no equivalent because files are always copied. Reads through expo-file-system become fetch(uri).

Notifications

From expo-notifications. See Notifications. Payload, permission, and push token shapes are the same. Platform enums become string unions, and channel importance still accepts the numbers 0 to 5.

Maps

From react-native-maps. See Map.

Convert the region to a camera: zoom = log2(360 * widthPt / 256 / longitudeDelta), where widthPt is the map view width in points, and center coordinates as-is. Marker children become the markers array, and onRegionChangeComplete becomes onCameraMove. Designs that need custom pin views, callouts, or camera refs have no equivalent yet; keep react-native-maps for those screens.

Splash screen

From expo-splash-screen. one prebuild keeps the launch screen (the iOS storyboard, the Android splash) up until React Native draws its first content. Expo-prebuilt apps get the same hold by dropping expo-splash-screen and passing holdLaunchScreen: true to vxrn/expo-plugin. To keep it up beyond the first content, call One.LaunchScreen.preventAutoHide() while modules evaluate, then One.LaunchScreen.hide() when the app is ready. See Launch screen.

Build tooling

Expo apps keep Expo prebuild with the vxrn/expo-plugin adapter. Apps without Expo use one prebuild from native.app. See Build or Run iOS and Ship with EAS.

Edit this page on GitHub.