1.12.0 • Published 2 years ago

react-native-easy-breadcrumbs v1.12.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

react-native-easy-breadcrumbs

standard-readme compliant

Android / ios package to create customizable breadcrumbs to use in react native projects

No need to re-invent the wheel. Its already been done. Just use it and take advantage of open source projects.

Usefull for exemple, let's say we are using this library to create a breadcrumbs to navigate between folders

Table of Contents

Install

Make sure you have node and instaled globaly. And just run this command

npm i react-native-easy-breadcrumbs

Usage

Import this module:

import { Crumb, EasyBreadcrumb } from 'react-native-easy-breadcrumbs'

Use as a component

// initial crumb items, he we set one item, feel free to initialize it with more itens
const [crumbs, setCrumbs] = useState([
    { id: 0, title: 'Root' }
])

// initial selected crumbs, must be one crumb item
const [selectedCrumb, setSelectedCrumb] = useState<Crumb>({
    id: 0,
    title: 'Root',
})

// on crumb press event handler
const __onCrumbPress = (crumb: Crumb) => {
    console.log(crumb.id)
    // console.log('Selected', `Crumb ${crumb.title} selected`)
}

// your crumbs component call
<EasyBreadcrumb
    crumbs={crumbs}
    setCrumbs={setCrumbs}
    selectedCrumb={selectedCrumb}
    setSelectedCrumb={setSelectedCrumb}
    onCrumbPress={(crumb) => __onCrumbPress(crumb)}
/>

for concrete example, please check the example folder

API

Here is the customization properties you may use in order to customize your breadcrumb. There is brief description of prop, type, option, and description

proptypedescription
flatlistbooleanif to use flatlist to show crumbs. default to true
horizontalbooleanif to use flatlist horizontally
crumbsarrayarray of crumb items
onCrumbPressfunctioncallback when crumb is pressed
containerStyleobjectcrumb container style
selectedCrumbTextStyleobjectselected cumb text style
selectedCrumbItemStyleobjectselected crumb container style
selectedCrumbStyleobjectoutside crumb container style (applied to the touchable opacity component)
selectedCrumbobjectselected crumb
setCrumbsfunctionfunction to update crumbs or set crumbs
setSelectedCrumbfunctionfunction to set selected crumb
unselectedCrumbStyleobjectstyle to be applied to all not selected crumbs container
unselectedCrumbItemStyleobjectstyle to be applied to all not selected crumbs item container
unselectedCrumbTextStyleobjectstyle to be applied to all not selected crumbs text
contentContainerStyleobjectflatlist content style
flatlistPropsobjectstyle to override over flatlist

Maintainers

@acgtwentyone

Contributing

See the contributing file!

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2021 Antonio Goncalves

1.12.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.11.0

2 years ago

1.10.0

2 years ago

1.4.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.3.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago