Expo
The library contains native iOS and Android code, so it runs in an Expo development build or an EAS build, not in Expo Go.
1. Install
npx expo install react-native-universal-sheet2. Add the config plugin
The plugin sets the iOS deployment target to 15.0 if it is lower. Add it to app.json (or app.config.js):
{
"expo": {
"plugins": ["react-native-universal-sheet"]
}
}Android needs minSdkVersion 24, which current Expo SDKs already use. If you have lowered it, raise it with expo-build-properties:
{
"expo": {
"plugins": [
"react-native-universal-sheet",
["expo-build-properties", {"android": {"minSdkVersion": 24}}]
]
}
}3. Build and run
npx expo run:ios
npx expo run:androidThese commands run expo prebuild for you and compile the native code. With EAS:
eas build --profile development --platform all4. Add the provider
With Expo Router, put it in your root layout:
// app/_layout.tsx
import {Stack} from 'expo-router';
import {NativeSheetProvider} from 'react-native-universal-sheet';
export default function RootLayout() {
return (
<NativeSheetProvider>
<Stack />
</NativeSheetProvider>
);
}Without Expo Router, wrap the component exported from App.tsx.
Expo Go
Expo Go only contains the native modules that ship with Expo. Opening an app that uses this library in Expo Go fails, because the native NativeSheetHost view isn't there. Use a development build instead.
Expo web
npx expo start --web works. Metro picks the web renderer automatically. See Web.