Skip to content

Commit b39cfaa

Browse files
authored
docs: update getting started (#120)
1 parent cfcac85 commit b39cfaa

File tree

3 files changed

+61
-62
lines changed

3 files changed

+61
-62
lines changed

docs/docs/docs/getting-started/quick-start.mdx

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,9 @@ Here you can read more about [Android Native Styling](/docs/guides/android-nativ
7575

7676
## Example usage
7777

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

82-
```tsx
83-
import {createNativeBottomTabNavigator} from 'react-native-bottom-tabs/react-navigation';
84-
85-
const Tabs = createNativeBottomTabNavigator();
86-
87-
function NativeBottomTabs() {
88-
return (
89-
<Tabs.Navigator>
90-
<Tabs.Screen
91-
name="index"
92-
options={{
93-
title: "Home",
94-
tabBarIcon: () => ({ sfSymbol: "house" }),
95-
}}
96-
/>
97-
<Tabs.Screen
98-
name="explore"
99-
options={{
100-
title: "Explore",
101-
tabBarIcon: () => ({ sfSymbol: "person" }),
102-
}}
103-
/>
104-
</Tabs.Navigator>
105-
);
106-
}
107-
```
80+
- [Usage with React Navigation](/docs/guides/usage-with-react-navigation)
81+
- [Usage with Expo Router](/docs/guides/usage-with-expo-router)
82+
- [Usage with One](/docs/guides/usage-with-one)
83+
- [Standalone usage](/docs/guides/standalone-usage)

docs/docs/docs/guides/usage-with-react-navigation.mdx

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,52 @@ import { Badge } from '@theme';
66
To use this navigator, ensure that you have [`@react-navigation/native` and its dependencies (follow this guide)](https://reactnavigation.org/docs/getting-started).
77
:::
88

9+
Minimal example of using `createNativeBottomTabNavigator` with React Navigation:
10+
911
```tsx
12+
import * as React from 'react';
13+
import { Text, View } from 'react-native';
14+
import { NavigationContainer } from '@react-navigation/native';
1015
import { createNativeBottomTabNavigator } from 'react-native-bottom-tabs/react-navigation';
1116

12-
const Tabs = createNativeBottomTabNavigator();
17+
const Tab = createNativeBottomTabNavigator();
18+
19+
function HomeScreen() {
20+
return (
21+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
22+
<Text>Home!</Text>
23+
</View>
24+
);
25+
}
26+
27+
function SettingsScreen() {
28+
return (
29+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
30+
<Text>Settings!</Text>
31+
</View>
32+
);
33+
}
1334

14-
function NativeBottomTabs() {
35+
export default function App() {
1536
return (
16-
<Tabs.Navigator>
17-
<Tabs.Screen
18-
name="index"
19-
options={{
20-
title: 'Home',
21-
tabBarIcon: () => ({ sfSymbol: 'house' }),
22-
}}
23-
/>
24-
<Tabs.Screen
25-
name="explore"
26-
options={{
27-
title: 'Explore',
28-
tabBarIcon: () => ({ sfSymbol: 'person' }),
29-
}}
30-
/>
31-
</Tabs.Navigator>
37+
<NavigationContainer>
38+
<Tab.Navigator ignoresTopSafeArea>
39+
<Tab.Screen
40+
name="Home"
41+
component={HomeScreen}
42+
options={{
43+
tabBarIcon: () => ({ sfSymbol: 'book' }),
44+
}}
45+
/>
46+
<Tab.Screen
47+
name="Settings"
48+
component={SettingsScreen}
49+
options={{
50+
tabBarIcon: () => ({ sfSymbol: 'gear' }),
51+
}}
52+
/>
53+
</Tab.Navigator>
54+
</NavigationContainer>
3255
);
3356
}
3457
```

docs/docs/docs/guides/usage-with-vector-icons.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ const Tabs = createNativeBottomTabNavigator();
2121

2222
function NativeBottomTabs() {
2323
return (
24-
<Tabs.Navigator>
25-
<Tabs.Screen
26-
name="index"
27-
options={{
28-
title: 'Home',
29-
tabBarIcon: () => homeIcon,
30-
}}
31-
/>
32-
<Tabs.Screen
33-
name="explore"
34-
options={{
35-
title: 'Explore',
36-
tabBarIcon: () => exploreIcon,
37-
}}
38-
/>
24+
<Tabs.Navigator ignoresTopSafeArea>
25+
<Tabs.Screen
26+
name="Home"
27+
component={HomeScreen}
28+
options={{
29+
tabBarIcon: () => homeIcon,
30+
}}
31+
/>
32+
<Tabs.Screen
33+
name="Explore"
34+
component={ExploreScreen}
35+
options={{
36+
tabBarIcon: () => exploreIcon,
37+
}}
38+
/>
3939
</Tabs.Navigator>
4040
);
4141
}

0 commit comments

Comments
 (0)