Skip to content
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
75 changes: 44 additions & 31 deletions docs/appDrawer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,65 @@ title: App drawer
Creating an app drawer like layout is very common and with NativeBase's SimpleGrid make this extremely simple while still keeping it extremely customisable. Here is an example to illustrate it.

```SnackPlayer name=AppDrawer
import React from "react";
import { IconButton, SimpleGrid, Icon, NativeBaseProvider } from "native-base";
import {MaterialIcons} from '@expo/vector-icons';
import React from 'react';
import {
IconButton,
SimpleGrid,
Icon,
NativeBaseProvider,
Box,
} from 'native-base';
import { MaterialIcons } from '@expo/vector-icons';

function AppDrawer(){
function AppDrawer() {
const icons = [
"bolt",
"build",
"cloud",
"delivery-dining",
"favorite",
"music-note",
"invert-colors-on",
"navigation",
"settings",
"sports-esports",
"shield",
"photo-camera",
"network-wifi",
"nightlight-round",
"flight",
"extension",
"duo",
"album",
"access-alarm",
"forum",
{ name: 'bolt', bg: 'amber.600' },
{ name: 'build', bg: 'emerald.600' },
{ name: 'cloud', bg: 'blue.600' },
{ name: 'delivery-dining', bg: 'orange.600' },
{ name: 'favorite', bg: 'rose.600' },
{ name: 'music-note', bg: 'violet.600' },
{ name: 'invert-colors-on', bg: 'lime.600' },
{ name: 'navigation', bg: 'indigo.600' },
{ name: 'settings', bg: 'pink.600' },
{ name: 'sports-esports', bg: 'coolGray.600' },
{ name: 'shield', bg: 'darkBlue.600' },
{ name: 'photo-camera', bg: 'fuchsia.600' },
{ name: 'network-wifi', bg: 'amber.500' },
{ name: 'nightlight-round', bg: 'violet.800' },
{ name: 'flight', bg: 'blue.800' },
{ name: 'extension', bg: 'indigo.600' },
{ name: 'duo', bg: 'orange.600' },
{ name: 'album', bg: 'rose.600' },
{ name: 'access-alarm', bg: 'emerald.600' },
{ name: 'forum', bg: 'indigo.600' },
];

return <SimpleGrid columns="5" spacingY="4" spacingX="4">
return (
<SimpleGrid columns={4} spacingY={8} spacingX={4}>
{icons.map((icon) => (
<IconButton
borderRadius="full"
colorScheme="indigo"
bg={icon.bg}
variant="solid"
p="4"
icon={<Icon name={icon} as={MaterialIcons} size='sm' />}
p="3"
icon={
<Icon color="white" name={icon.name} as={MaterialIcons} size="sm" />
}
/>
))}
</SimpleGrid>
);
}

export default function () {
return (
<NativeBaseProvider>
<AppDrawer/>
</NativeBaseProvider>
<NativeBaseProvider>
<Box alignItems="center" pt="8" flex={1}>
<AppDrawer />
</Box>
</NativeBaseProvider>
);
}

```
114 changes: 104 additions & 10 deletions docs/breakpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,113 @@ breakpoints = {

`useBreakpointValue` is a custom hook which returns the value for the current breakpoint from the provided responsive values object. This hook also responds to the window resizing and returning the appropriate value for the new window size.

```jsx
```SnackPlayer name=useBreakpointValue
import React from 'react';
import { Box, useBreakpointValue } from 'native-base';
export default () => {
const color = useBreakpointValue({
base: 'red.200',
sm: 'blue.200',
md: 'blue.200',
import {
Factory,
Button,
Stack,
NativeBaseProvider,
Center,
} from 'native-base';
import { TextInput } from 'react-native';

import { Icon, useBreakpointValue, Text, VStack, Heading } from 'native-base';
import { FontAwesome, Foundation, Feather } from '@expo/vector-icons';
import { View } from 'react-native';

export const UseBreakpointValueExample = () => {
const flexDir = useBreakpointValue({
base: 'column',
lg: 'row',
});
return (
<Box bg={color} w={'100px'}>
This is a box
</Box>
<VStack space={10} alignItems="center" justifyContent="center">
<Heading>Why us?</Heading>
<View style={{ flexDirection: flexDir }}>
<VStack
m="3"
w="140"
borderRadius="xl"
p="3"
bg="cyan.200"
space={2}
alignItems="center"
justifyContent="center">
<Icon
as={Foundation}
name="shield"
size="sm"
textAlign="center"
_dark={{ color: 'coolGray.800' }}
/>
<Text
fontSize="lg"
textAlign="center"
_dark={{ color: 'coolGray.800' }}>
Secure Checkout
</Text>
</VStack>
<VStack
m="3"
w="140"
borderRadius="xl"
p="3"
bg="cyan.200"
space={2}
alignItems="center"
justifyContent="center">
<Icon
as={Foundation}
name="shield"
size="sm"
textAlign="center"
_dark={{ color: 'coolGray.800' }}
/>
<Text
fontSize="lg"
textAlign="center"
_dark={{ color: 'coolGray.800' }}>
Secure Checkout
</Text>
</VStack>
<VStack
m="3"
w="140"
borderRadius="xl"
p="3"
bg="cyan.200"
space={2}
alignItems="center"
justifyContent="center">
<Icon
as={Feather}
name="clock"
size="sm"
textAlign="center"
_dark={{ color: 'coolGray.800' }}
/>
<Text
fontSize="lg"
textAlign="center"
_dark={{ color: 'coolGray.800' }}>
Fast Turn Around
</Text>
</VStack>
</View>
</VStack>
);
};

// Example template which wraps component with NativeBaseProvider
export default function () {
return (
<NativeBaseProvider>
<Center flex="1">
<UseBreakpointValueExample />
</Center>
</NativeBaseProvider>
);
}

```
81 changes: 47 additions & 34 deletions docs/buildingFooterTabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ With NativeBase v3 we have removed FooterTab components because as it's very sim
## Example

```SnackPlayer name=Footer dependencies=react-native-linear-gradient
import React from 'react';

import React from 'react';
import {
NativeBaseProvider,
Box,
Expand All @@ -25,85 +25,97 @@ import {
Center,
Pressable,
} from 'native-base';
import { MaterialCommunityIcons , MaterialIcons} from '@expo/vector-icons';
import { MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons';

export default function App() {
const [selected, setSelected] = React.useState(1);
return (
<NativeBaseProvider>
<Box flex="1" bg="white" safeAreaTop>
<Center flex="1">
</Center>
<HStack bg="primary.500" alignItems="center" safeAreaBottom shadow="6">
<Box flex="1" bg="white" safeAreaTop>
<Center flex="1"></Center>
<HStack bg="indigo.600" alignItems="center" safeAreaBottom shadow={6}>
<Pressable
cursor="pointer"
opacity={selected === 0 ? 1 : 0.5}
py="2"
py="3"
flex="1"
onPress={() => setSelected(0)}
>
onPress={() => setSelected(0)}>
<Center>
<Icon
mb="1"
as={<MaterialCommunityIcons name="heart" />}
as={
<MaterialCommunityIcons
name={selected === 0 ? 'home' : 'home-outline'}
/>
}
color="white"
size="xs"
size="sm"
/>

<Text color="white" fontSize="14">Favorites</Text>
<Text color="white" fontSize="12">
Home
</Text>
</Center>
</Pressable>
<Pressable
cursor="pointer"
opacity={selected === 1 ? 1 : 0.5}
py="2"
flex="1"
onPress={() => setSelected(1)}
>
py={2}
flex={1}
onPress={() => setSelected(1)}>
<Center>
<Icon
mb="1"
as={<MaterialCommunityIcons name="music-note" />}
as={<MaterialIcons name="search" />}
color="white"
size="xs"
size="sm"
/>

<Text color="white" fontSize="14">Music</Text>
<Text color="white" fontSize="12">
Search
</Text>
</Center>
</Pressable>
<Pressable
cursor="pointer"
opacity={selected === 2 ? 1 : 0.6}
py="2"
flex="1"
onPress={() => setSelected(2)}
>
onPress={() => setSelected(2)}>
<Center>
<Icon
mb="1"
as={<MaterialIcons name="location-pin" />}
mb={1}
as={
<MaterialCommunityIcons
name={selected === 2 ? 'cart' : 'cart-outline'}
/>
}
color="white"
size="xs"
size="sm"
/>

<Text color="white" fontSize="14">Places</Text>
<Text color="white" fontSize={12}>
Cart
</Text>
</Center>
</Pressable>
<Pressable
cursor="pointer"
opacity={selected === 3 ? 1 : 0.5}
py="2"
flex="1"
onPress={() => setSelected(3)}
>
onPress={() => setSelected(3)}>
<Center>
<Icon
mb="1"
as={<MaterialCommunityIcons name="newspaper" />}
mb={1}
as={
<MaterialCommunityIcons
name={selected === 3 ? 'account' : 'account-outline'}
/>
}
color="white"
size="xs"
size="sm"
/>
<Text color="white" fontSize="14">News</Text>
<Text color="white" fontSize="12">
Account
</Text>
</Center>
</Pressable>
</HStack>
Expand All @@ -112,4 +124,5 @@ export default function App() {
);
}


```
Loading