Preview: Youtube
- Technical
- Project Scaffolding
- Alias
- Core Component
- Custom Component
- π Getting Started
- How to create new Service
- How to create new Flow
- How to use Lottie Animation
- Package Management
- State Management
- Routing and Navigation
- React Navigation for native mobile
- Connect API
- Local Storage
- MMKV for React Native
- Redux Persist
- Animation Handler
- Reanimated3
- React Native Gesture Handler
- React Native Animated API
- Lottie for React Native
src
βββ @type #define commons type use in project
βββ assets #contain file image, svg, animation config, ... in project
β
βββ components
β βββ bases #define base component for project
β βββ commons #define custom component for project
β βββ utils #define utils for component
β
βββ hooks #define custom hook
βββ navigation
β βββ index.ts #export all method, variable, and components
β βββ routes.ts #define all screen route in project
β βββ RootStack.tsx #contain all stack in project
β βββ RootApp.tsx #contain RootStack, loading modal, message modal
β βββ NavigationService.ts #define 'navigationRef' and all method to interact with it
β
βββ redux #define all end point for api
β βββ reducers #define all reducer in project
β βββ store #define store for project with Redux Persist - MMKV storage
β βββ selectors #define all selector in project
β
βββ screens
β βββ HomeScreen
β β βββ components #define common component for screen
β β βββ index.tsx #define and export screen component
β β βββ type.ts #define common type for screen
β βββ ...
β βββ index.ts #export all screen
β
βββ services
β βββ PokemonService.ts #define all method to connect api of service
β βββ ...
β βββ index.ts #export all service
β
βββ themes
β βββ baseStyles.ts #define base style for style sheet create by method 'makeStyles'
β βββ colors.ts #define color palette
β βββ font.ts #define font, fontSize in project
β βββ normalize.ts #define responsive method
β βββ style.ts #define utils, type, hook for style of project theme
β βββ index.ts #export all theme method and constants
β
βββ utils
β βββ ...
β βββ helper.ts #define helper function for project
β
βββ App.tsx- @type: ./src/@type
- @assets: ./src/assets
- @components: ./src/components
- @hooks: ./src/hooks
- @navigation: ./src/navigation
- @redux: ./src/redux
- @screens: ./src/screens
- @themes: ./src/themes
- @utils: ./src/utils
- @services: ./src/services
- @i18n: ./src/i18n
- Container
- Block
- Text
- TextInput
- Image
- StatusBar
-
Circle Progress
-
Props
Name Type Default value Require step numberβ totalStep numberβ size numberβ strokeWidth number10 totalStepColor stringorangestepColor stringgreyLightprogressContainerStyles StyleProp<ViewStyle>{}progressValueProps CommonTextPropsundefinedonCompleteAnimation(isFinish?: boolean) Function()=>{} -
How to use
<CircleProgress size={150} step={50} totalSteps={100} strokeWidth={10} />
-
-
Progress
-
Props
Name Type Default value Require step numberβ totalStep numberβ strokeHeight number10 totalStepColor stringorangestepColor stringgreyLightprogressContainerStyles StyleProp<ViewStyle>{}onCompleteAnimation(isFinish?: boolean) Function()=>{} -
How to use
<Progress strokeHeight={10} step={80} totalSteps={100} progressContainerStyles={{ paddingHorizontal: 10, }} />
-
-
LinearGradient
-
Props
Name Type Default value Require colors string[]β containerStyle StyleProp<ViewStyle>{}orientation horizontalorverticalornumberverticalrevers booleanfalsetransform Partial<TransformedProps>{} -
How to use
<LinearGradient colors={['#FFEFAD', '#FFC107']} containerStyle={{ flex: 1 }} transform={{ rotation: 20 }} />
-
-
ShadowBlock
-
Props
- Component is extended all props from
Blockcomponent - External Props
Name Type Default value Require shadowHeight number5 shadowPosition toporbottombottomshadowLabel stringundefinedshadowLabelTextStyle CommonTextPropsundefinedshadowLabelContainerStyle BlockPropsundefinedshadowBackgroundColor string#ccccontainerPaddingVertical numberundefinedcontainerPaddingHorizontal numberundefinedcontainerPaddingRight numberundefinedcontainerPaddingLeft numberundefinedcontainerPaddingTop numberundefinedcontainerPaddingBottom numberundefined - Component is extended all props from
-
How to use
<ShadowBlock row marginTop={20} space="between" paddingHorizontal={20} containerPaddingHorizontal={20} > <Block width={10} height={10} backgroundColor="red" /> <Progress step={10} totalSteps={100} strokeHeight={10} progressContainerStyles={{ flex: 1, marginStart: 10, }} /> </ShadowBlock>
-
-
ShadowButton
-
Props
- Component is extended all props from
Pressable(native component from ReactNative) component - External Props
Name Type Default value Require buttonWidth numberorstring5 buttonHeight numberorstring#cccbuttonBorderSize numberundefinedbuttonBorderColor stringorReactNodeundefinedcontainerStyle StyleProp<ViewStyle>undefinedshadowHeight number5 buttonRadius number5 buttonColor stringprimarydisabled booleanundefinedshadowButtonColor stringgreyLight - Component is extended all props from
-
How to use
<ShadowButton buttonHeight={45} buttonBorderSize={2} buttonBorderColor={ <Block style={StyleSheet.absoluteFill}> <LinearGradient colors={['#FFEFAD', '#FFC107']} containerStyle={{ width: '100%', height: '100%' }} /> </Block> } shadowHeight={10} buttonRadius={8} shadowButtonColor="#FFC107" buttonColor="#FFEFAD" onPress={() => { console.log('press') }} />
-
-
Modal
-
Props
Name Type Default value Require children ReactNodeauto produceβ position toporbottomorcenterbottomonShow void functionundefinedonDismiss void functionundefined -
How to use
-
Wrap the component as a container to use
const modalRef = useRef<ModalFunction>(null) const handleOpen = useCallback(() => { modalRef.current?.openModal() }, []) const handleDismiss = useCallback(() => { modalRef.current?.dismissModal() }, []) const onShow = useCallback(() => { console.log('Modal opened') }, []) const onDissmiss = useCallback(() => { console.log('Modal closed') }, []) return ( <Modal position="bottom" ref={modalRef} onShow={onShow} onDismiss={onDismiss} > You code here </Modal>
-
-
LineChart
-
Props
Name Type Default value Require data Arrayundefinedβ width numberundefinedβ height numberundefinedβ precision number0 haveVerticalGuides booleanfalsehaveHorizontalGuides booleanfalsehaveXAxis booleanfalsehaveYAxis booleanfalseaxisStrokeWidth number0.5 axisStrokeColor string#E5E5E5haveDots booleanfalsedotsColor string##FFC107dotsStrokeColor string#FFFFFFdotsStrokeWidth number2 rDots number8 labelColor string#171725labelFontSize stringh5labelFontFamily stringsemiboldlineColor string#FFEFADlineWidth number2 onItemClick void functioinundefined -
How to use
-
Line chart will be changed based on the data provided
const data = [ { id: 0, label: 'Mon', x: 0, y: 0 }, { id: 1, label: 'Tues', x: 1, y: 4 }, { id: 2, label: 'Wed', x: 2, y: 30 }, { id: 3, label: 'Thur', x: 3, y: 15 }, { id: 4, label: 'Fri', x: 4, y: 40 }, { id: 5, label: 'Sat', x: 5, y: 50 }, { id: 6, label: 'Sun', x: 6, y: 40 }, ] <LineChart width={widthScreen} height={300} data={data} haveDots haveXAxis haveHorizontalGuides lineColor="#FFEFAD" onItemClick={handleItemClick} />
-
yarn install
# To build iOS app
cd ios
pod install
cd ..yarn androidyarn ios- Go to
sevicefolder and define new Service - To export all services from new services, use exported values in the
indexfile.
- Go to
screensfolder and define new component - Config the
screenname route atsrc/navigation/routes - Config the new screen route at
src/navigation/RootStack
- Official document from Lottie
From Youth-Tech with π