From 5887efc3dd119c41fbec9afea001fefe94c0eb1e Mon Sep 17 00:00:00 2001 From: kaykdm Date: Sun, 16 Jan 2022 17:50:40 +0900 Subject: [PATCH 1/6] fix: infinite loop in Image component --- .../storybook/stories/components/primitives/Image/Sizes.tsx | 1 + src/components/primitives/Image/index.tsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/example/storybook/stories/components/primitives/Image/Sizes.tsx b/example/storybook/stories/components/primitives/Image/Sizes.tsx index a92f92767..457d378d9 100644 --- a/example/storybook/stories/components/primitives/Image/Sizes.tsx +++ b/example/storybook/stories/components/primitives/Image/Sizes.tsx @@ -8,6 +8,7 @@ export function Example() { {['xs', 'sm', 'md', 'lg', 'xl', '2xl'].map((size) => ( { finalSource.current = { uri: src }; } return finalSource.current; - }, [source, src]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [source?.uri, src]); const [renderedSource, setSource] = useState(getSource()); const [alternate, setAlternate] = useState(false); @@ -39,7 +40,7 @@ const Image = (props: IImageProps, ref: any) => { return () => { finalSource.current = null; }; - }, [source, src, getSource]); + }, [source?.uri, src, getSource]); const onImageLoadError = useCallback( (event: any) => { From 0dbe757b68f315a66911b58898c2829dff3111d1 Mon Sep 17 00:00:00 2001 From: ankitt Date: Thu, 20 Jan 2022 13:23:55 +0530 Subject: [PATCH 2/6] feat: add typings for header, footer --- src/components/composites/Actionsheet/types.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/composites/Actionsheet/types.tsx b/src/components/composites/Actionsheet/types.tsx index 2fac2c5e8..29b15396f 100644 --- a/src/components/composites/Actionsheet/types.tsx +++ b/src/components/composites/Actionsheet/types.tsx @@ -48,4 +48,14 @@ export type IActionsheetComponentType = (( props: IActionsheetItemProps & { ref?: MutableRefObject } ) => JSX.Element >; + Header: React.MemoExoticComponent< + ( + props: IActionsheetHeaderProps & { ref?: MutableRefObject } + ) => JSX.Element + >; + Footer: React.MemoExoticComponent< + ( + props: IActionsheetFooterProps & { ref?: MutableRefObject } + ) => JSX.Element + >; }; From d101a429d7014d3e3bf676f3f77cdd0dc85bdf91 Mon Sep 17 00:00:00 2001 From: ankitt Date: Thu, 20 Jan 2022 13:25:38 +0530 Subject: [PATCH 3/6] fix: add ActionsheetHeaderProps, ActionsheetFooterProps --- src/components/composites/Actionsheet/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/composites/Actionsheet/index.tsx b/src/components/composites/Actionsheet/index.tsx index 448d95c30..7683792ac 100644 --- a/src/components/composites/Actionsheet/index.tsx +++ b/src/components/composites/Actionsheet/index.tsx @@ -1,11 +1,15 @@ import ActionsheetMain from './Actionsheet'; import ActionsheetItem from './ActionsheetItem'; +import ActionsheetHeader from './ActionsheetHeader'; +import ActionsheetFooter from './ActionsheetFooter'; import ActionsheetContent from './ActionsheetContent'; import type { IActionsheetComponentType } from './types'; const ActionsheetTemp: any = ActionsheetMain; ActionsheetTemp.Content = ActionsheetContent; ActionsheetTemp.Item = ActionsheetItem; +ActionsheetTemp.Header = ActionsheetHeader; +ActionsheetTemp.Footer = ActionsheetFooter; // To add typings const Actionsheet = ActionsheetTemp as IActionsheetComponentType; @@ -16,4 +20,6 @@ export type { IActionsheetProps, IActionsheetContentProps, IActionsheetItemProps, + IActionsheetHeaderProps, + IActionsheetFooterProps, } from './types'; From 6bc5a5f70fa89981ec0733c5dcb87de4478f3f07 Mon Sep 17 00:00:00 2001 From: ankitt Date: Thu, 20 Jan 2022 15:55:23 +0530 Subject: [PATCH 4/6] fix: remove heading fontfamily --- src/theme/components/heading.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/theme/components/heading.ts b/src/theme/components/heading.ts index a6d7c752f..02beb2d06 100644 --- a/src/theme/components/heading.ts +++ b/src/theme/components/heading.ts @@ -4,7 +4,6 @@ const baseStyle = (props: Record) => { return { color: mode('muted.700', 'white')(props), fontWeight: 'bold', - fontFamily: 'heading', lineHeight: 'sm', }; }; From e5f97ec86478da04cf5336a071b7da61173871e6 Mon Sep 17 00:00:00 2001 From: Rohit Singh Date: Fri, 21 Jan 2022 10:54:46 +0530 Subject: [PATCH 5/6] fix: examples --- .../components/basic/FlatList/Basic.tsx | 9 +- .../basic/KeyboardAvoidingView/Basic.tsx | 38 ++---- .../components/basic/ScrollView/Basic.tsx | 92 +++++++------ .../components/basic/SectionList/Basic.tsx | 40 +++--- .../composites/Transitions/Fade.tsx | 4 +- .../composites/Transitions/ScaleFade.tsx | 4 +- .../composites/Transitions/Slide.tsx | 65 ++------- .../Transitions/SlideComposition.tsx | 81 ++++++----- .../composites/Transitions/SlideWrapped.tsx | 128 +++++++++--------- .../composites/Transitions/Stagger.tsx | 5 +- .../primitives/Hidden/hiddenOnColorModes.tsx | 43 ++++-- .../components/primitives/Icon/AllIcons.tsx | 2 +- .../components/primitives/Icon/CustomIcon.tsx | 34 ++--- .../components/primitives/Icon/Sizes.tsx | 16 +-- .../components/primitives/Image/Basic.tsx | 18 +-- .../primitives/Image/BorderRadius.tsx | 22 +-- .../primitives/Image/FallbackElement.tsx | 26 ++-- .../primitives/Image/FallbackSupport.tsx | 26 ++-- .../components/primitives/Image/Sizes.tsx | 2 +- .../components/primitives/Image/WithRef.tsx | 20 +-- .../stories/hooks/useDisclose/Usage.tsx | 2 +- 21 files changed, 331 insertions(+), 346 deletions(-) diff --git a/example/storybook/stories/components/basic/FlatList/Basic.tsx b/example/storybook/stories/components/basic/FlatList/Basic.tsx index f08f586e4..a8077a425 100644 --- a/example/storybook/stories/components/basic/FlatList/Basic.tsx +++ b/example/storybook/stories/components/basic/FlatList/Basic.tsx @@ -9,7 +9,6 @@ import { Text, Spacer, } from 'native-base'; - export const Example = () => { const data = [ { @@ -52,14 +51,8 @@ export const Example = () => { 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRBwgu1A5zgPSvfE83nurkuzNEoXs9DMNr8Ww&usqp=CAU', }, ]; - return ( - + Inbox diff --git a/example/storybook/stories/components/basic/KeyboardAvoidingView/Basic.tsx b/example/storybook/stories/components/basic/KeyboardAvoidingView/Basic.tsx index 9db972f89..2cfc9b7f9 100644 --- a/example/storybook/stories/components/basic/KeyboardAvoidingView/Basic.tsx +++ b/example/storybook/stories/components/basic/KeyboardAvoidingView/Basic.tsx @@ -6,38 +6,30 @@ import { Button, VStack, Heading, - useBreakpointValue, + Center, } from 'native-base'; import { Platform } from 'react-native'; export const Example = () => { - const isLargeScreen = useBreakpointValue({ - base: false, - sm: false, - md: false, - lg: true, - }); return ( - - - Forgot Password - - - Not to worry! Enter email address associated with your account and - we’ll send a link to reset your password. - - - - {isLargeScreen ? ( - - Please see the example in your mobile to observe the effect. +
+ + Forgot Password + + Not to worry! Enter email address associated with your account and + we’ll send a link to reset your password. - ) : null} - + + + +
); }; diff --git a/example/storybook/stories/components/basic/ScrollView/Basic.tsx b/example/storybook/stories/components/basic/ScrollView/Basic.tsx index c23817710..cf12dff64 100644 --- a/example/storybook/stories/components/basic/ScrollView/Basic.tsx +++ b/example/storybook/stories/components/basic/ScrollView/Basic.tsx @@ -3,46 +3,56 @@ import { ScrollView, VStack, Center, useTheme, Heading } from 'native-base'; export const Example = () => { const { colors } = useTheme(); return ( - -
- Cyan -
- - {Object.keys(colors.cyan).map((key, index) => { - if (index >= 1 && index <= 5) - return ( -
- {key} -
- ); - })} -
-
- Yellow -
- - {Object.keys(colors.cyan).map((key, index) => { - if (index >= 1 && index <= 5) - return ( -
- {key} -
- ); - })} -
-
- Violet -
- - {Object.keys(colors.violet).map((key, index) => { - if (index >= 1 && index <= 5) - return ( -
- {key} -
- ); - })} -
-
+
+ +
+ Cyan +
+ + {Object.keys(colors.cyan).map((key, index) => { + if (index >= 1 && index <= 5) + return ( +
+ {key} +
+ ); + })} +
+
+ Yellow +
+ + {Object.keys(colors.cyan).map((key, index) => { + if (index >= 1 && index <= 5) + return ( +
+ {key} +
+ ); + })} +
+
+ Violet +
+ + {Object.keys(colors.violet).map((key, index) => { + if (index >= 1 && index <= 5) + return ( +
+ {key} +
+ ); + })} +
+
+
); }; diff --git a/example/storybook/stories/components/basic/SectionList/Basic.tsx b/example/storybook/stories/components/basic/SectionList/Basic.tsx index c7697f86d..cc972d2e9 100644 --- a/example/storybook/stories/components/basic/SectionList/Basic.tsx +++ b/example/storybook/stories/components/basic/SectionList/Basic.tsx @@ -27,25 +27,27 @@ export const Example = () => { ], }, ]; - return ( - item + index} - renderItem={({ item }) => ( -
- {item.split('.')[1]} -
- )} - renderSectionHeader={({ section: { title } }) => ( -
- - {title} - -
- )} - /> +
+ item + index} + renderItem={({ item }) => ( +
+ {item.split('.')[1]} +
+ )} + renderSectionHeader={({ section: { title } }) => ( +
+ + {title} + +
+ )} + /> +
); }; diff --git a/example/storybook/stories/components/composites/Transitions/Fade.tsx b/example/storybook/stories/components/composites/Transitions/Fade.tsx index 39f21848a..03fc8e250 100644 --- a/example/storybook/stories/components/composites/Transitions/Fade.tsx +++ b/example/storybook/stories/components/composites/Transitions/Fade.tsx @@ -5,7 +5,7 @@ export const Example = () => { const [isOpen, setIsOpen] = React.useState(false); return ( - <> +
@@ -25,6 +25,6 @@ export const Example = () => { Fade
- + ); }; diff --git a/example/storybook/stories/components/composites/Transitions/ScaleFade.tsx b/example/storybook/stories/components/composites/Transitions/ScaleFade.tsx index 310586c86..003dc1450 100644 --- a/example/storybook/stories/components/composites/Transitions/ScaleFade.tsx +++ b/example/storybook/stories/components/composites/Transitions/ScaleFade.tsx @@ -4,7 +4,7 @@ export const Example = () => { const [isOpen, setIsOpen] = React.useState(false); return ( - <> +
@@ -17,6 +17,6 @@ export const Example = () => { ScaleFade
- + ); }; diff --git a/example/storybook/stories/components/composites/Transitions/Slide.tsx b/example/storybook/stories/components/composites/Transitions/Slide.tsx index f869df779..30123459d 100644 --- a/example/storybook/stories/components/composites/Transitions/Slide.tsx +++ b/example/storybook/stories/components/composites/Transitions/Slide.tsx @@ -1,65 +1,26 @@ import React from 'react'; -import { - Slide, - Button, - Alert, - VStack, - Heading, - Divider, - Center, - Text, -} from 'native-base'; +import { Slide, Button, Alert, Text, Box } from 'native-base'; export const Example = () => { - const [isOpenBottom, setIsOpenBottom] = React.useState(false); const [isOpenTop, setIsOpenTop] = React.useState(false); - - const str1 = `${isOpenTop ? 'Hide' : 'Show'}`; - const str2 = `${isOpenBottom ? 'Hide' : 'Show'}`; + const str = `${isOpenTop ? 'Hide' : 'Check Internet Connection'}`; return ( - <> - - - - - Order placed successfully! - - - + - + - No Internet Connection - - -
- - Top - - - -
-
- - Bottom - - -
-
- + +
); }; diff --git a/example/storybook/stories/components/composites/Transitions/SlideComposition.tsx b/example/storybook/stories/components/composites/Transitions/SlideComposition.tsx index df41f873a..84b7da705 100644 --- a/example/storybook/stories/components/composites/Transitions/SlideComposition.tsx +++ b/example/storybook/stories/components/composites/Transitions/SlideComposition.tsx @@ -10,48 +10,57 @@ import { Spacer, WarningIcon, Input, + Center, } from 'native-base'; export const Example = () => { const [isOpen, setIsOpen] = React.useState(false); return ( - <> - - - Due to government restrictions around COVID- 19, you may experience a - delay in your delivery. - - - - - - Order - - - - - Sub Total - $298.77 - - - Tax - $38.84 - - - Total Amount - $337.61 - - - Promo Code - - - +
+ + + + + Order + + + + + Sub Total + $298.77 + + + Tax + $38.84 + + Total Amount + $337.61 + + + Promo Code + + + + + + - - + + + + Due to government restrictions around COVID- 19, you may experience + a delay in your delivery. + + - +
); }; diff --git a/example/storybook/stories/components/composites/Transitions/SlideWrapped.tsx b/example/storybook/stories/components/composites/Transitions/SlideWrapped.tsx index 110bd50c8..b81c6d061 100644 --- a/example/storybook/stories/components/composites/Transitions/SlideWrapped.tsx +++ b/example/storybook/stories/components/composites/Transitions/SlideWrapped.tsx @@ -9,75 +9,77 @@ import { HStack, Text, CheckIcon, + Center, } from 'native-base'; export const Example = () => { const [isOpen, setIsOpen] = React.useState(false); return ( - - - - Order - - - Sub Total - $298.77 - - - Tax - $38.84 - - - Total Amount - $337.61 - - - Promo Code - - - +
+ + + + Order - - - - - - - - - Order Placed Successfully. - + + Sub Total + $298.77 + + + Tax + $38.84 - - - + + Total Amount + $337.61 + + + Promo Code + + + + + + + + + + + + + Order Placed Successfully. + + + + + +
); }; diff --git a/example/storybook/stories/components/composites/Transitions/Stagger.tsx b/example/storybook/stories/components/composites/Transitions/Stagger.tsx index df9b5178d..07d348270 100644 --- a/example/storybook/stories/components/composites/Transitions/Stagger.tsx +++ b/example/storybook/stories/components/composites/Transitions/Stagger.tsx @@ -6,13 +6,14 @@ import { Stagger, HStack, Icon, + Center, } from 'native-base'; import { MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons'; export const Example = () => { const { isOpen, onToggle } = useDisclose(); return ( - +
{ } /> - +
); }; diff --git a/example/storybook/stories/components/primitives/Hidden/hiddenOnColorModes.tsx b/example/storybook/stories/components/primitives/Hidden/hiddenOnColorModes.tsx index 0f0b2bba7..6ac573230 100644 --- a/example/storybook/stories/components/primitives/Hidden/hiddenOnColorModes.tsx +++ b/example/storybook/stories/components/primitives/Hidden/hiddenOnColorModes.tsx @@ -1,28 +1,45 @@ import React from 'react'; -import { Hidden, Text, Button, Box, useColorMode } from 'native-base'; +import { Hidden, Button, Image, useColorMode, Center } from 'native-base'; export const Example = () => { - const { colorMode, toggleColorMode } = useColorMode(); + const { toggleColorMode } = useColorMode(); return ( - <> +
- - - This text will be hidden on light mode - - - - This text will be hidden on dark mode - +
+ image +
+
+ +
+ image +
- +
); }; diff --git a/example/storybook/stories/components/primitives/Icon/AllIcons.tsx b/example/storybook/stories/components/primitives/Icon/AllIcons.tsx index 13131d0a0..de04218a1 100644 --- a/example/storybook/stories/components/primitives/Icon/AllIcons.tsx +++ b/example/storybook/stories/components/primitives/Icon/AllIcons.tsx @@ -34,7 +34,7 @@ export const Example = () => { const cols = useBreakpointValue({ base: 3, sm: 4, - md: 12, + md: 8, }); const icons = [ { diff --git a/example/storybook/stories/components/primitives/Icon/CustomIcon.tsx b/example/storybook/stories/components/primitives/Icon/CustomIcon.tsx index db51a6d28..4e5d63000 100644 --- a/example/storybook/stories/components/primitives/Icon/CustomIcon.tsx +++ b/example/storybook/stories/components/primitives/Icon/CustomIcon.tsx @@ -1,25 +1,27 @@ import React from 'react'; -import { Icon } from 'native-base'; +import { Icon, Center } from 'native-base'; import { Path, G } from 'react-native-svg'; export const Example = () => { return ( - - - - - +
+ + + + + + - - + +
); }; diff --git a/example/storybook/stories/components/primitives/Icon/Sizes.tsx b/example/storybook/stories/components/primitives/Icon/Sizes.tsx index 5154efd8a..53fc67153 100644 --- a/example/storybook/stories/components/primitives/Icon/Sizes.tsx +++ b/example/storybook/stories/components/primitives/Icon/Sizes.tsx @@ -3,21 +3,7 @@ import { Icon, Heading, Center, VStack } from 'native-base'; import { Ionicons } from '@expo/vector-icons'; export const Example = () => { - const sizes = [ - '10', - '50px', - '2xl', - // 'xs', - // 'sm', - // 'md', - // 'lg', - // 'xl', - // '2xl', - // '3xl', - // '4xl', - // '5xl', - // '6xl', - ]; + const sizes = ['10', '50px', '2xl']; return (
Sizes diff --git a/example/storybook/stories/components/primitives/Image/Basic.tsx b/example/storybook/stories/components/primitives/Image/Basic.tsx index 4d3a8b000..802c826db 100644 --- a/example/storybook/stories/components/primitives/Image/Basic.tsx +++ b/example/storybook/stories/components/primitives/Image/Basic.tsx @@ -1,13 +1,15 @@ import React from 'react'; -import { Image } from 'native-base'; +import { Center, Image } from 'native-base'; export function Example() { return ( - Alternate Text +
+ Alternate Text +
); } diff --git a/example/storybook/stories/components/primitives/Image/BorderRadius.tsx b/example/storybook/stories/components/primitives/Image/BorderRadius.tsx index a479d77da..c6624e164 100644 --- a/example/storybook/stories/components/primitives/Image/BorderRadius.tsx +++ b/example/storybook/stories/components/primitives/Image/BorderRadius.tsx @@ -1,15 +1,17 @@ import React from 'react'; -import { Image } from 'native-base'; +import { Image, Center } from 'native-base'; export function Example() { return ( - Alternate Text +
+ Alternate Text +
); } diff --git a/example/storybook/stories/components/primitives/Image/FallbackElement.tsx b/example/storybook/stories/components/primitives/Image/FallbackElement.tsx index 0a46c30ec..8b2423d7c 100644 --- a/example/storybook/stories/components/primitives/Image/FallbackElement.tsx +++ b/example/storybook/stories/components/primitives/Image/FallbackElement.tsx @@ -1,17 +1,19 @@ import React from 'react'; -import { Image, Box } from 'native-base'; +import { Image, Box, Center } from 'native-base'; export function Example() { return ( - fallback text - This is a box - - } - /> +
+ fallback text + This is a box + + } + /> +
); } diff --git a/example/storybook/stories/components/primitives/Image/FallbackSupport.tsx b/example/storybook/stories/components/primitives/Image/FallbackSupport.tsx index 5bba0fdba..79fc1f9cb 100644 --- a/example/storybook/stories/components/primitives/Image/FallbackSupport.tsx +++ b/example/storybook/stories/components/primitives/Image/FallbackSupport.tsx @@ -1,17 +1,19 @@ import React from 'react'; -import { Image } from 'native-base'; +import { Image, Center } from 'native-base'; export function Example() { return ( - fallback text +
+ fallback text +
); } diff --git a/example/storybook/stories/components/primitives/Image/Sizes.tsx b/example/storybook/stories/components/primitives/Image/Sizes.tsx index a92f92767..788cb7790 100644 --- a/example/storybook/stories/components/primitives/Image/Sizes.tsx +++ b/example/storybook/stories/components/primitives/Image/Sizes.tsx @@ -3,7 +3,7 @@ import { VStack, Image, ScrollView, Heading, Center } from 'native-base'; export function Example() { return ( -
+
Image Sizes {['xs', 'sm', 'md', 'lg', 'xl', '2xl'].map((size) => ( diff --git a/example/storybook/stories/components/primitives/Image/WithRef.tsx b/example/storybook/stories/components/primitives/Image/WithRef.tsx index 41e2eed7c..a4a72a732 100644 --- a/example/storybook/stories/components/primitives/Image/WithRef.tsx +++ b/example/storybook/stories/components/primitives/Image/WithRef.tsx @@ -1,6 +1,6 @@ //@ts-nocheck import React from 'react'; -import { Image } from 'native-base'; +import { Center, Image } from 'native-base'; export function Example() { const myRef = React.useRef(null); @@ -11,13 +11,15 @@ export function Example() { }, [myRef]); return ( - Alternate Text +
+ Alternate Text +
); } diff --git a/example/storybook/stories/hooks/useDisclose/Usage.tsx b/example/storybook/stories/hooks/useDisclose/Usage.tsx index 5b4460270..395b3c399 100644 --- a/example/storybook/stories/hooks/useDisclose/Usage.tsx +++ b/example/storybook/stories/hooks/useDisclose/Usage.tsx @@ -16,7 +16,7 @@ export const Example = () => { reversed. Deleted data can not be recovered. -