Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update getting started #120

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions docs/docs/docs/getting-started/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,9 @@ Here you can read more about [Android Native Styling](/docs/guides/android-nativ

## Example usage

:::warning
To use this navigator, ensure that you have [`@react-navigation/native` and its dependencies (follow this guide)](https://reactnavigation.org/docs/getting-started).
:::
Please follow the guides below to integrate the library with your navigation library:

```tsx
import {createNativeBottomTabNavigator} from 'react-native-bottom-tabs/react-navigation';

const Tabs = createNativeBottomTabNavigator();

function NativeBottomTabs() {
return (
<Tabs.Navigator>
<Tabs.Screen
name="index"
options={{
title: "Home",
tabBarIcon: () => ({ sfSymbol: "house" }),
}}
/>
<Tabs.Screen
name="explore"
options={{
title: "Explore",
tabBarIcon: () => ({ sfSymbol: "person" }),
}}
/>
</Tabs.Navigator>
);
}
```
- [Usage with React Navigation](/docs/guides/usage-with-react-navigation)
- [Usage with Expo Router](/docs/guides/usage-with-expo-router)
- [Usage with One](/docs/guides/usage-with-one)
- [Standalone usage](/docs/guides/standalone-usage)
59 changes: 41 additions & 18 deletions docs/docs/docs/guides/usage-with-react-navigation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,52 @@ import { Badge } from '@theme';
To use this navigator, ensure that you have [`@react-navigation/native` and its dependencies (follow this guide)](https://reactnavigation.org/docs/getting-started).
:::

Minimal example of using `createNativeBottomTabNavigator` with React Navigation:

```tsx
import * as React from 'react';
import { Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeBottomTabNavigator } from 'react-native-bottom-tabs/react-navigation';

const Tabs = createNativeBottomTabNavigator();
const Tab = createNativeBottomTabNavigator();

function HomeScreen() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Home!</Text>
</View>
);
}

function SettingsScreen() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Settings!</Text>
</View>
);
}

function NativeBottomTabs() {
export default function App() {
return (
<Tabs.Navigator>
<Tabs.Screen
name="index"
options={{
title: 'Home',
tabBarIcon: () => ({ sfSymbol: 'house' }),
}}
/>
<Tabs.Screen
name="explore"
options={{
title: 'Explore',
tabBarIcon: () => ({ sfSymbol: 'person' }),
}}
/>
</Tabs.Navigator>
<NavigationContainer>
<Tab.Navigator ignoresTopSafeArea>
<Tab.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: () => ({ sfSymbol: 'book' }),
}}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{
tabBarIcon: () => ({ sfSymbol: 'gear' }),
}}
/>
</Tab.Navigator>
</NavigationContainer>
);
}
```
Expand Down
30 changes: 15 additions & 15 deletions docs/docs/docs/guides/usage-with-vector-icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ const Tabs = createNativeBottomTabNavigator();

function NativeBottomTabs() {
return (
<Tabs.Navigator>
<Tabs.Screen
name="index"
options={{
title: 'Home',
tabBarIcon: () => homeIcon,
}}
/>
<Tabs.Screen
name="explore"
options={{
title: 'Explore',
tabBarIcon: () => exploreIcon,
}}
/>
<Tabs.Navigator ignoresTopSafeArea>
<Tabs.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: () => homeIcon,
}}
/>
<Tabs.Screen
name="Explore"
component={ExploreScreen}
options={{
tabBarIcon: () => exploreIcon,
}}
/>
</Tabs.Navigator>
);
}
Expand Down
Loading