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
15 changes: 8 additions & 7 deletions docs/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ import { Box, Center, NativeBaseProvider } from "native-base"

export const Example = () => {
return (
<Box
<Box
bg={{
linearGradient: {
colors: ["lightBlue.300", "violet.800"],
colors: ['lightBlue.300', 'violet.800'],
start: [0, 0],
end: [1, 0],
},
}}
p="12"
rounded="lg"
rounded="xl"
_text={{
fontSize: "md",
fontWeight: "bold",
color: "white",
fontSize: 'md',
fontWeight: 'medium',
color: 'warmGray.50',
textAlign: 'center',
}}
>
This is a Box with Linear Gradient
Expand All @@ -63,7 +64,7 @@ const config = {
export default () => {
return (
<NativeBaseProvider config={config}>
<Center flex="1">
<Center flex="1" px="3">
<Example />
</Center>
</NativeBaseProvider>
Expand Down
3 changes: 0 additions & 3 deletions docs/buildingSwipeList.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,9 @@ function Basic() {
<Box>
<Pressable onPress={() => console.log('You touched me')} bg="white">
<Box
borderBottomWidth="1"
borderColor="coolGray.200"
pl="4"
pr="5"
py="2"
_dark={{ borderColor: 'gray.600' }}
>
<HStack alignItems="center" space={3}>
<Avatar size="48px" source={{ uri: item.avatarUrl }} />
Expand Down
128 changes: 31 additions & 97 deletions docs/colorMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,69 +27,38 @@ import {
Avatar,
Center,
useColorModeValue,
NativeBaseProvider
Text,
NativeBaseProvider,
} from 'native-base';

function ColorModeExample () {
function ColorModeExample() {
const { colorMode, toggleColorMode } = useColorMode();
return (
<>
<Heading>I'm a Heading</Heading>
<Button
colorScheme={colorMode === 'light' ? 'blue' : 'red'}
onPress={() => {
toggleColorMode();
}}
>
Change mode
</Button>
<HStack space={2} mt={3}>
<Avatar
name="Ankur"
borderWidth={2}
source={{
uri:
'https://pbs.twimg.com/profile_images/1309797238651060226/18cm6VhQ_400x400.jpg',
}}
/>
<Avatar
name="Rohit"
borderWidth={2}
source={{
uri:
'https://pbs.twimg.com/profile_images/1352844693151731713/HKO7cnlW_400x400.jpg',
}}
/>
</HStack>
</>
);
}

const LocalWrapper = ({ children }) => {
const bg = useColorModeValue('gray.200', 'gray.800')
return (
<Center
flex={1}
bg={bg}
>
{children}
<Center flex={1} bg={useColorModeValue('warmGray.50', 'coolGray.800')}>
<Text fontSize="lg" display="flex" mb={20}>
The active color mode is{' '}
<Text bold fontSize="18px">
{useColorModeValue('Light', 'Dark')}
</Text>
</Text>
<Button onPress={toggleColorMode}>Toggle</Button>
</Center>
);
};
}

export default function () {
return (
<NativeBaseProvider>
<LocalWrapper>
<ColorModeExample />
</LocalWrapper>
<ColorModeExample />
</NativeBaseProvider>
);
}

```
## _light and _dark Pseudo props

All components accepts _light and _dark props which applies the passed props on dark and light mode.
## \_light and \_dark Pseudo props

All components accepts \_light and \_dark props which applies the passed props on dark and light mode.

```SnackPlayer name=PseudoProps%20Usage
import React from 'react';
Expand All @@ -101,70 +70,35 @@ import {
Avatar,
Center,
useColorModeValue,
NativeBaseProvider
Text,
NativeBaseProvider,
} from 'native-base';

function PseduoPropsUsage () {
const { toggleColorMode } = useColorMode();
return (
<>
<Heading>I'm a Heading</Heading>
<Button
_light={{colorScheme:'blue'}}
_dark={{colorScheme:'red'}}
onPress={() => {
toggleColorMode();
}}
>
Change mode
</Button>
<HStack space={2} mt={3}>
<Avatar
name="Ankur"
borderWidth={2}
source={{
uri:
'https://pbs.twimg.com/profile_images/1309797238651060226/18cm6VhQ_400x400.jpg',
}}
/>
<Avatar
name="Rohit"
borderWidth={2}
source={{
uri:
'https://pbs.twimg.com/profile_images/1352844693151731713/HKO7cnlW_400x400.jpg',
}}
/>
</HStack>
</>
);
}

const LocalWrapper = ({ children }) => {
const bg = useColorModeValue('gray.200', 'gray.800')
function PseudoPropsUsage() {
const { colorMode, toggleColorMode } = useColorMode();
return (
<Center
flex={1}
bg={bg}
>
{children}
<Center flex={1} _dark={{bg:'coolGray.800'}} _light={{bg:'warmGray.50'}}>
<Text fontSize="lg" display="flex" mb="20">
The active color mode is{' '}
<Text bold fontSize="lg">
{colorMode}
</Text>
</Text>
<Button onPress={toggleColorMode}>Toggle</Button>
</Center>
);
};
}

export default function () {
return (
<NativeBaseProvider>
<LocalWrapper>
<PseduoPropsUsage />
</LocalWrapper>
<PseudoPropsUsage />
</NativeBaseProvider>
);
}

```


## Default color mode

You can set default color mode. By default, the color mode will be `light`. To support this, extend the default theme with a `config`
Expand Down
13 changes: 6 additions & 7 deletions docs/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ import React from 'react';
import { Container, Text, Heading, NativeBaseProvider, Center } from 'native-base';
function ContainerComponent() {
return (
<Container>
<Container>
<Heading>
A component library for the
<Heading color="emerald.400">
React Ecosystem
</Heading>
</Heading>
<Heading pt={4} fontWeight="md" size="sm">
NativeBase is a simple, modular and accessible component library that gives you building blocks to build you React applications.
<Heading color="emerald.500"> React Ecosystem</Heading>
</Heading>
<Text mt="3" fontWeight="medium">
NativeBase is a simple, modular and accessible component library that
gives you building blocks to build you React applications.
</Text>
</Container>
);
}
Expand Down
136 changes: 135 additions & 1 deletion docs/flatList.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,141 @@ A component for rendering performant scrollable lists.

## Example

```ComponentSnackPlayer path=basic,FlatList,Basic.tsx
```SnackPlayer name=Basic
import React from "react"
import {
Box,
FlatList,
Heading,
Avatar,
HStack,
VStack,
Text,
Spacer,
Center,
NativeBaseProvider,
} from "native-base"
export const Example = () => {
const data = [
{
id: "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba",
fullName: "Aafreen Khan",
timeStamp: "12:47 PM",
recentText: "Good Day!",
avatarUrl:
"https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
},
{
id: "3ac68afc-c605-48d3-a4f8-fbd91aa97f63",
fullName: "Sujitha Mathur",
timeStamp: "11:11 PM",
recentText: "Cheer up, there!",
avatarUrl:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTyEaZqT3fHeNrPGcnjLLX1v_W4mvBlgpwxnA&usqp=CAU",
},
{
id: "58694a0f-3da1-471f-bd96-145571e29d72",
fullName: "Anci Barroco",
timeStamp: "6:22 PM",
recentText: "Good Day!",
avatarUrl: "https://miro.medium.com/max/1400/0*0fClPmIScV5pTLoE.jpg",
},
{
id: "68694a0f-3da1-431f-bd56-142371e29d72",
fullName: "Aniket Kumar",
timeStamp: "8:56 PM",
recentText: "All the best",
avatarUrl:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSr01zI37DYuR8bMV5exWQBSw28C1v_71CAh8d7GP1mplcmTgQA6Q66Oo--QedAN1B4E1k&usqp=CAU",
},
{
id: "28694a0f-3da1-471f-bd96-142456e29d72",
fullName: "Kiara",
timeStamp: "12:47 PM",
recentText: "I will call today.",
avatarUrl:
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRBwgu1A5zgPSvfE83nurkuzNEoXs9DMNr8Ww&usqp=CAU",
},
]
return (
<Box
w={{
base: "100%",
md: "25%",
}}
>
<Heading fontSize="xl" p="4" pb="3">
Inbox
</Heading>
<FlatList
data={data}
renderItem={({ item }) => (
<Box
borderBottomWidth="1"
_dark={{
borderColor: "gray.600",
}}
borderColor="coolGray.200"
pl="4"
pr="5"
py="2"
>
<HStack space={3} justifyContent="space-between">
<Avatar
size="48px"
source={{
uri: item.avatarUrl,
}}
/>
<VStack>
<Text
_dark={{
color: "warmGray.50",
}}
color="coolGray.800"
bold
>
{item.fullName}
</Text>
<Text
color="coolGray.600"
_dark={{
color: "warmGray.200",
}}
>
{item.recentText}
</Text>
</VStack>
<Spacer />
<Text
fontSize="xs"
_dark={{
color: "warmGray.50",
}}
color="coolGray.800"
alignSelf="flex-start"
>
{item.timeStamp}
</Text>
</HStack>
</Box>
)}
keyExtractor={(item) => item.id}
/>
</Box>
)
}

export default () => {
return (
<NativeBaseProvider>
<Center flex="1" >
<Example />
</Center>
</NativeBaseProvider>
)
}


```

Expand Down
Loading