Skip to content

Commit ab0fd8c

Browse files
committed
add: remote URL example
1 parent fa7f4d0 commit ab0fd8c

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ Function that given `{ focused: boolean }` returns `ImageSource` or `AppleIcon`
189189
component={Albums}
190190
options={{
191191
tabBarIcon: () => require('person.png'),
192+
// SVG is also supported
193+
tabBarIcon: () => require('person.svg'),
192194
// or
193195
tabBarIcon: () => ({ sfSymbol: 'person' }),
196+
// You can also pass a URL
197+
tabBarIcon: () => ({ uri: 'https://example.com/icon.png' }),
194198
}}
195199
/>
196200
```

example/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import TintColorsExample from './Examples/TintColors';
3333
import NativeBottomTabsVectorIcons from './Examples/NativeBottomTabsVectorIcons';
3434
import NativeBottomTabsEmbeddedStacks from './Examples/NativeBottomTabsEmbeddedStacks';
3535
import NativeBottomTabsSVGs from './Examples/NativeBottomTabsSVGs';
36+
import NativeBottomTabsRemoteIcons from './Examples/NativeBottomTabsRemoteIcons';
3637

3738
const FourTabsIgnoreSafeArea = () => {
3839
return <FourTabs ignoresTopSafeArea />;
@@ -131,6 +132,10 @@ const examples = [
131132
component: NativeBottomTabsSVGs,
132133
name: 'Native Bottom Tabs with SVG Icons',
133134
},
135+
{
136+
component: NativeBottomTabsRemoteIcons,
137+
name: 'Native Bottom Tabs with SVG Remote Icons',
138+
},
134139
{ component: NativeBottomTabs, name: 'Native Bottom Tabs' },
135140
{ component: JSBottomTabs, name: 'JS Bottom Tabs' },
136141
{
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Article } from '../Screens/Article';
2+
import { Albums } from '../Screens/Albums';
3+
import { Contacts } from '../Screens/Contacts';
4+
import { Chat } from '../Screens/Chat';
5+
// This import works properly when library is published
6+
import createNativeBottomTabNavigator from '../../../src/react-navigation/navigators/createNativeBottomTabNavigator';
7+
8+
const Tab = createNativeBottomTabNavigator();
9+
10+
function NativeBottomTabsRemoteIcons() {
11+
return (
12+
<Tab.Navigator labeled>
13+
<Tab.Screen
14+
name="Article"
15+
component={Article}
16+
options={{
17+
tabBarBadge: '10',
18+
tabBarIcon: () => ({
19+
uri: 'https://www.svgrepo.com/show/533824/water-container.svg',
20+
}),
21+
}}
22+
/>
23+
<Tab.Screen
24+
name="Albums"
25+
component={Albums}
26+
options={{
27+
tabBarIcon: () => ({
28+
uri: 'https://www.svgrepo.com/show/533813/hat-chef.svg',
29+
}),
30+
}}
31+
/>
32+
<Tab.Screen
33+
name="Contacts"
34+
component={Contacts}
35+
options={{
36+
tabBarIcon: () => ({
37+
uri: 'https://www.svgrepo.com/show/533826/shop.svg',
38+
}),
39+
}}
40+
/>
41+
<Tab.Screen
42+
name="Chat"
43+
component={Chat}
44+
options={{
45+
tabBarIcon: () => ({
46+
uri: 'https://www.svgrepo.com/show/533828/cheese.svg',
47+
}),
48+
}}
49+
/>
50+
</Tab.Navigator>
51+
);
52+
}
53+
54+
export default NativeBottomTabsRemoteIcons;

0 commit comments

Comments
 (0)