Skip to content

Commit a3140df

Browse files
Vidhi KatariaVidhi Kataria
Vidhi Kataria
authored and
Vidhi Kataria
committed
Merge branch 'staging' of github.com:GeekyAnts/nativebase-docs into staging
2 parents 8f37b11 + fbce44b commit a3140df

File tree

3 files changed

+51
-45
lines changed

3 files changed

+51
-45
lines changed

docs/3.0.x/customizing-components.md

+18-20
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ Let's customise a Button component to include rounded borders and red colorSchem
1212
## Basic
1313

1414
```tsx
15-
import React from 'react';
16-
import { NativeBaseProvider, extendTheme } from 'native-base';
15+
import React from "react";
16+
import { NativeBaseProvider, extendTheme } from "native-base";
1717

1818
export default function () {
1919
const theme = extendTheme({
2020
components: {
2121
Button: {
2222
// Can simply pass default props to change default behaviour of components.
2323
baseStyle: {
24-
rounded: 'md',
24+
rounded: "md",
2525
},
2626
defaultProps: {
27-
colorScheme: 'red',
27+
colorScheme: "red",
2828
},
2929
},
3030
Heading: {
3131
// Can pass also function, giving you access theming tools
3232
baseStyle: ({ colorMode }) => {
3333
return {
34-
color: colorMode === 'dark' ? 'red.300' : 'blue.300',
35-
fontWeight: 'normal',
34+
color: colorMode === "dark" ? "red.300" : "blue.300",
35+
fontWeight: "normal",
3636
};
3737
},
3838
},
@@ -78,22 +78,22 @@ When variant in defaultProps is `solid` the above button will use solid variant.
7878
You can specify the base style of the component and use it across project.
7979

8080
```jsx isLive=true
81-
import React from 'react';
82-
import { Text, NativeBaseProvider, Center, extendTheme } from 'native-base';
81+
import React from "react";
82+
import { Text, NativeBaseProvider, Center, extendTheme } from "native-base";
8383

8484
export function Example() {
8585
const theme = extendTheme({
8686
components: {
8787
Text: {
8888
baseStyle: {
89-
color: 'emerald.400'
89+
color: "emerald.400",
9090
},
91-
defaultProps: { size: 'lg' },
91+
defaultProps: { size: "lg" },
9292
sizes: {
93-
xl: { fontSize: '64px' },
94-
lg: { fontSize: '32px' },
95-
md: { fontSize: '16px' },
96-
sm: { fontSize: '12px' },
93+
xl: { fontSize: "64px" },
94+
lg: { fontSize: "32px" },
95+
md: { fontSize: "16px" },
96+
sm: { fontSize: "12px" },
9797
},
9898
},
9999
},
@@ -106,32 +106,31 @@ export function Example() {
106106
</NativeBaseProvider>
107107
);
108108
}
109-
110109
```
111110

112111
## Adding Variants
113112

114113
You can also add the variants to the components and use it across project.
115114

116115
```jsx isLive=true
117-
import React from 'react';
116+
import React from "react";
118117
import {
119118
NativeBaseProvider,
120119
Button,
121120
extendTheme,
122121
Center,
123122
VStack,
124-
} from 'native-base';
123+
} from "native-base";
125124

126125
export function Example() {
127126
const theme = extendTheme({
128127
components: {
129128
Button: {
130129
variants: {
131-
rounded: ({ colorScheme }: any) => {
130+
rounded: ({ colorScheme }) => {
132131
return {
133132
bg: `${colorScheme}.500`,
134-
rounded: 'full',
133+
rounded: "full",
135134
};
136135
},
137136
},
@@ -152,7 +151,6 @@ export function Example() {
152151
</NativeBaseProvider>
153152
);
154153
}
155-
156154
```
157155

158156
<br />

docs/3.1.x/customizing-components.md

+18-20
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ Let's customise a Button component to include rounded borders and red colorSchem
1212
## Basic
1313

1414
```tsx
15-
import React from 'react';
16-
import { NativeBaseProvider, extendTheme } from 'native-base';
15+
import React from "react";
16+
import { NativeBaseProvider, extendTheme } from "native-base";
1717

1818
export default function () {
1919
const theme = extendTheme({
2020
components: {
2121
Button: {
2222
// Can simply pass default props to change default behaviour of components.
2323
baseStyle: {
24-
rounded: 'md',
24+
rounded: "md",
2525
},
2626
defaultProps: {
27-
colorScheme: 'red',
27+
colorScheme: "red",
2828
},
2929
},
3030
Heading: {
3131
// Can pass also function, giving you access theming tools
3232
baseStyle: ({ colorMode }) => {
3333
return {
34-
color: colorMode === 'dark' ? 'red.300' : 'blue.300',
35-
fontWeight: 'normal',
34+
color: colorMode === "dark" ? "red.300" : "blue.300",
35+
fontWeight: "normal",
3636
};
3737
},
3838
},
@@ -78,22 +78,22 @@ When variant in defaultProps is `solid` the above button will use solid variant.
7878
You can specify the base style of the component and use it across project.
7979

8080
```jsx isLive=true
81-
import React from 'react';
82-
import { Text, NativeBaseProvider, Center, extendTheme } from 'native-base';
81+
import React from "react";
82+
import { Text, NativeBaseProvider, Center, extendTheme } from "native-base";
8383

8484
export function Example() {
8585
const theme = extendTheme({
8686
components: {
8787
Text: {
8888
baseStyle: {
89-
color: 'emerald.400'
89+
color: "emerald.400",
9090
},
91-
defaultProps: { size: 'lg' },
91+
defaultProps: { size: "lg" },
9292
sizes: {
93-
xl: { fontSize: '64px' },
94-
lg: { fontSize: '32px' },
95-
md: { fontSize: '16px' },
96-
sm: { fontSize: '12px' },
93+
xl: { fontSize: "64px" },
94+
lg: { fontSize: "32px" },
95+
md: { fontSize: "16px" },
96+
sm: { fontSize: "12px" },
9797
},
9898
},
9999
},
@@ -106,32 +106,31 @@ export function Example() {
106106
</NativeBaseProvider>
107107
);
108108
}
109-
110109
```
111110

112111
## Adding Variants
113112

114113
You can also add the variants to the components and use it across project.
115114

116115
```jsx isLive=true
117-
import React from 'react';
116+
import React from "react";
118117
import {
119118
NativeBaseProvider,
120119
Button,
121120
extendTheme,
122121
Center,
123122
VStack,
124-
} from 'native-base';
123+
} from "native-base";
125124

126125
export function Example() {
127126
const theme = extendTheme({
128127
components: {
129128
Button: {
130129
variants: {
131-
rounded: ({ colorScheme }: any) => {
130+
rounded: ({ colorScheme }) => {
132131
return {
133132
bg: `${colorScheme}.500`,
134-
rounded: 'full',
133+
rounded: "full",
135134
};
136135
},
137136
},
@@ -152,7 +151,6 @@ export function Example() {
152151
</NativeBaseProvider>
153152
);
154153
}
155-
156154
```
157155

158156
<br />

layouts/index.tsx

+15-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useEffect, useContext } from "react";
33
import {
44
Box,
55
HStack,
6+
Link,
67
ScrollView,
78
Text,
89
useBreakpointValue,
@@ -246,15 +247,24 @@ function Layout({
246247
<NativebaseIconLogo width="125" height="130" />
247248
</Box>
248249

249-
<Text
250+
<Link
250251
pl="6"
251-
_light={{ color: "black" }}
252-
_dark={{ color: "coolGray.50" }}
252+
_text={{
253+
_light: {
254+
color: "black",
255+
},
256+
_dark: {
257+
color: "coolGray.50",
258+
},
259+
fontSize: "sm",
260+
}}
253261
m="auto"
254-
fontSize="sm"
262+
isUnderlined={false}
263+
href="https://madewithnativebase.com/"
264+
isExternal
255265
>
256266
MadeWithNativeBase
257-
</Text>
267+
</Link>
258268
</Box>
259269
</Box>
260270
</>

0 commit comments

Comments
 (0)