
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
react-native-inappbrowser-nitro
Advanced tools
🚀 Lightning-fast in-app browser for React Native powered by Nitro Modules. Direct JSI bindings for native performance with Safari View Controller (iOS) & Chrome Custom Tabs (Android). Zero bridge overhead, TypeScript-first, with React hooks support.
Lightning-fast, modern in-app browser for React Native powered by Nitro Modules ⚡
Experience the next generation of React Native performance with direct JSI bindings, zero bridge overhead, and beautiful native browser experiences on both iOS and Android.
npm install react-native-inappbrowser-nitro react-native-nitro-modules
or
yarn add react-native-inappbrowser-nitro react-native-nitro-modules
Note:
react-native-nitro-modules
is required as this library leverages the powerful Nitro framework.
For iOS, the library uses CocoaPods for linking:
Navigate to your iOS project directory:
cd ios
Install pods:
pod install
For Android, the library is automatically linked via Gradle.
import { InAppBrowser } from 'react-native-inappbrowser-nitro';
const openBrowser = async () => {
try {
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.open('https://github.com', {
// iOS options
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
// Android options
toolbarColor: '#6200EE',
showTitle: true,
});
console.log('🎉 Success:', result);
}
} catch (error) {
console.error('❌ Error:', error);
}
};
import { useInAppBrowser } from 'react-native-inappbrowser-nitro';
function MyComponent() {
const { open, isLoading, error } = useInAppBrowser();
const handleOpenBrowser = async () => {
try {
const result = await open('https://github.com', {
preferredBarTintColor: '#453AA4',
toolbarColor: '#6200EE',
});
console.log('🎉 Browser opened:', result);
} catch (err) {
console.error('❌ Failed to open browser:', err);
}
};
return (
<Button
title={isLoading ? "Opening..." : "Open Browser"}
onPress={handleOpenBrowser}
disabled={isLoading}
/>
);
}
import { InAppBrowser } from 'react-native-inappbrowser-nitro';
const authenticateUser = async () => {
try {
const result = await InAppBrowser.openAuth(
'https://provider.com/oauth/authorize?client_id=...',
'your-app://oauth', // redirect URL scheme
{
ephemeralWebSession: true, // 🕵️ iOS incognito mode
showTitle: false,
}
);
if (result.type === 'success' && result.url) {
console.log('🎉 Auth successful:', result.url);
// Handle successful authentication
}
} catch (error) {
console.error('❌ Auth failed:', error);
}
};
isLoading
behavior
On Android, the open()
promise resolves immediately after launching Chrome Custom Tabs, so the React hook’s isLoading
toggles off right away. On iOS we updated open()
to resolve immediately after presenting SafariViewController (instead of waiting for user dismissal), matching Android behavior.
partialCurl
transition
The iOS modalTransitionStyle
value partialCurl
is only supported when paired with a fullScreen
presentation. If you specify partialCurl
, the library now forces modalPresentationStyle
to fullScreen
under the hood to prevent UIKit crashes with overFullScreen
.
Method | Description | Platform | Performance |
---|---|---|---|
isAvailable() | Check if InAppBrowser is supported | iOS, Android | ⚡ Instant |
open(url, options?) | Open URL in in-app browser | iOS, Android | ⚡ Native speed |
openAuth(url, redirectUrl, options?) | Open URL for authentication | iOS, Android | ⚡ Native speed |
close() | Close the browser | iOS, Android | ⚡ Instant |
closeAuth() | Close authentication session | iOS, Android | ⚡ Instant |
Option | Type | Description | Default |
---|---|---|---|
dismissButtonStyle | 'done' | 'close' | 'cancel' | Style of dismiss button | 'done' |
preferredBarTintColor | string | Navigation bar background color | System default |
preferredControlTintColor | string | Control elements color | System default |
readerMode | boolean | Enable Reader mode if available | false |
animated | boolean | Animate presentation | true |
modalPresentationStyle | string | Modal presentation style | 'automatic' |
modalTransitionStyle | string | Modal transition style | 'coverVertical' |
modalEnabled | boolean | Present modally vs push | true |
enableBarCollapsing | boolean | Allow toolbar collapsing | false |
ephemeralWebSession | boolean | Use incognito mode (auth only) | false |
Option | Type | Description | Default |
---|---|---|---|
showTitle | boolean | Show page title in toolbar | true |
toolbarColor | string | Toolbar background color | System default |
secondaryToolbarColor | string | Secondary toolbar color | System default |
navigationBarColor | string | Navigation bar color | System default |
enableUrlBarHiding | boolean | Hide URL bar on scroll | false |
enableDefaultShare | boolean | Show share button | false |
animations | object | Custom enter/exit animations | System default |
headers | object | Additional HTTP headers | {} |
forceCloseOnRedirection | boolean | Close on redirect | false |
hasBackButton | boolean | Show back arrow instead of X | false |
showInRecents | boolean | Show in Android recents | true |
Android emulators often lack pre-installed browsers. The library handles this gracefully:
For Development:
Safari View Controller has limited functionality on iOS Simulator:
Since this library uses Nitro modules, you get optimal performance out of the box! But here are some additional tips:
// 📱 Check availability once and cache the result
const [isSupported, setIsSupported] = useState<boolean>();
useEffect(() => {
InAppBrowser.isAvailable().then(setIsSupported);
}, []);
// 🎨 Reuse options objects to avoid recreating them
const browserOptions = useMemo(() => ({
preferredBarTintColor: '#453AA4',
toolbarColor: '#6200EE',
}), []);
We welcome contributions! See the contributing guide to learn how to contribute to the repository and development workflow.
MIT
Built with ❤️ using Nitro Modules for the React Native community
Experience the future of React Native performance today! 🚀
FAQs
🚀 Lightning-fast in-app browser for React Native powered by Nitro Modules. Direct JSI bindings for native performance with Safari View Controller (iOS) & Chrome Custom Tabs (Android). Zero bridge overhead, TypeScript-first, with React hooks support.
We found that react-native-inappbrowser-nitro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.