A powerful and customizable React Native TabView component with RTL support, smooth animations, and gesture handling
npm install react-native-tabview-mobilehisaabA beautiful, smooth, and highly customizable React Native TabView component with RTL support, fluid animations, and gesture handling. Built with React Native Reanimated 3 for optimal performance.
_Smooth tab transitions with animated indicator and fluid content switching_
Check out the complete working example with multiple TabView configurations:
``bash`
git clone https://github.com/ap9101/tabview-example.git
cd tabview-example
npm installRun on iOS
npx react-native run-iosRun on Android
npx react-native run-android
- 🎨 Beautiful Design - Modern, clean UI with smooth animations
- 🚀 High Performance - Built with React Native Reanimated 3
- 📱 Responsive - Adapts to different screen sizes
- 🌍 RTL Support - Full right-to-left language support
- 🎯 Gesture Handling - Smooth swipe gestures with react-native-gesture-handler
- 🎭 Dark Mode - Built-in dark/light theme support
- 🔧 Highly Customizable - Extensive styling options
- ⚡ TypeScript - Full TypeScript support
- 🎪 Smooth Animations - Fluid tab transitions and indicator animations
`bash`
npm install react-native-tabview-mobilehisaabor
yarn add react-native-tabview-mobilehisaab
This package requires the following peer dependencies:
`bash`
npm install react-native-reanimated react-native-gesture-handleror
yarn add react-native-reanimated react-native-gesture-handler
#### iOS
`bash`
cd ios && pod install
#### Android
Add to android/app/src/main/java/.../MainActivity.java:
`java`
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
For React Native Reanimated, add to babel.config.js:
`javascript`
module.exports = {
plugins: [
"react-native-reanimated/plugin", // This should be last
],
};
`tsx
import React, { useState } from "react";
import { View, Text, StyleSheet } from "react-native";
import { TabView } from "react-native-tabview-mobilehisaab";
const App = () => {
const [index, setIndex] = useState(0);
const routes = [
{ key: "first", title: "First Tab" },
{ key: "second", title: "Second Tab" },
{ key: "third", title: "Third Tab" },
];
const renderScene = ({ route, index, isActive }) => {
switch (route.key) {
case "first":
return (
);
case "second":
return (
);
case "third":
return (
);
default:
return null;
}
};
return (
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
/>
);
};
const styles = StyleSheet.create({
scene: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#f5f5f5",
},
text: {
fontSize: 18,
fontWeight: "600",
color: "#333",
},
});
export default App;
`
`tsx`
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
tabBarStyle={{
backgroundColor: "#ffffff",
shadowColor: "#000",
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 8,
elevation: 4,
}}
activeTabStyle={{
backgroundColor: "#007AFF",
borderRadius: 12,
}}
activeLabelStyle={{
color: "#ffffff",
fontWeight: "600",
}}
labelStyle={{
color: "#666666",
fontWeight: "500",
}}
indicatorStyle={{
backgroundColor: "#007AFF",
height: 3,
borderRadius: 2,
}}
/>
`tsx`
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
isRTL={true} // Enable RTL support
/>
You can choose between animated indicator or background highlighting:
`tsx
// With indicator (default)
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
showIndicator={true} // Shows animated indicator, no background
/>
// With background highlighting
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
showIndicator={false} // Shows background color, no indicator
activeTabStyle={{
backgroundColor: "#007AFF",
borderRadius: 12,
}}
/>
`
The component automatically adapts to your app's color scheme, but you can also customize it:
`tsx`
initialIndex={index}
onIndexChange={setIndex}
renderScene={renderScene}
tabBarStyle={{
backgroundColor: "#1a1a1a", // Dark background
}}
activeLabelStyle={{
color: "#ffffff",
}}
labelStyle={{
color: "#cccccc",
}}
/>
| Prop | Type | Default | Description |
| ------------------ | --------------------------------- | ------- | ------------------------------ |
| routes | TabRoute[] | [] | Array of route objects |initialIndex
| | number | 0 | Initial tab index |onIndexChange
| | (index: number) => void | - | Callback when tab changes |renderScene
| | SceneRendererProps => ReactNode | - | Function to render tab content |isRTL
| | boolean | false | Enable RTL support |scrollEnabled
| | boolean | true | Enable tab bar scrolling |tabBarStyle
| | ViewStyle | - | Custom tab bar style |tabStyle
| | ViewStyle | - | Custom inactive tab style |activeTabStyle
| | ViewStyle | - | Custom active tab style |labelStyle
| | TextStyle | - | Custom inactive label style |activeLabelStyle
| | TextStyle | - | Custom active label style |indicatorStyle
| | ViewStyle | - | Custom indicator style |showIndicator
| | boolean | true | Show/hide animated indicator |
`tsx
interface TabRoute {
key: string;
title: string;
}
interface SceneRendererProps {
route: TabRoute;
index: number;
isActive: boolean;
}
`
1. Lazy Loading: Only render active and adjacent tabs for better performance
2. Memoization: Use React.memo for your scene components
3. Image Optimization: Optimize images in tab content
4. Avoid Heavy Computations: Move heavy operations outside render
`tsx`
const MemoizedScene = React.memo(({ route, index, isActive }) => {
// Your scene content
return
});
1. Tabs not scrolling smoothly
- Ensure react-native-reanimated is properly installed
- Check if babel.config.js includes the reanimated plugin
2. Gesture handling not working
- Verify react-native-gesture-handler installation
- Make sure to wrap your app with GestureHandlerRootView
3. TypeScript errors
- Update @types/react-native to latest version
- Ensure peer dependencies are installed
If you encounter installation issues:
`bashClean install
rm -rf node_modules package-lock.json
npm install
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see the LICENSE file for details.
- Built with React Native Reanimated
- Gesture handling by React Native Gesture Handler
- Inspired by react-native-tab-view
- 📧 Email: abdullah.return@gmail.com
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
---
Made with ❤️ by [Developer Ap]