It's a React Native bar component with different interactions: Text Only, Clickable, Collapsible.
Install the package via npm:
npm i react-native-bar-collapsible --save
The React Native Vector Icons package is a dependency of this component and it's needed to link it, as you can read in its installation instructions.
In order to link it to the project first install rnpm
npm install rnpm -g
Then run the following command to link the react-native-vector-icons package
rnpm link react-native-vector-icons
Import the component:
import Bar from 'react-native-bar-collapsible';
Text Only:
This is the default action, you just need to pass a "title" property with the text to show
<Bar title='My title'/>
You need to pass the properties:
<Bar
title='My title'
clickable={true}
icon='rocket'
onPressed={() => this._myFunction()}/>
You need to pass the properties:
<Bar
title='My title'
collapsible={true}
showOnStart={false}
iconCollapsed='chevron-right'
iconOpened='chevron-down'
children={<OtherComponent/>}/>
// or
<Bar
title='My title'
collapsible={true}
showOnStart={true}
iconCollapsed='chevron-right'
iconOpened='chevron-down'
>
<OtherComponent />
</Bar>
Additional to the basic properties, you can pass:
<Bar
style={{ backgroundColor: '#FFF'}}
title='My title'
titleStyle={{ color: #000 }}
clickable={true}
icon='rocket'
tintColor='#BBB'
iconSize={15} />
The component use Font Awesome Icons from React Native Vector Icons package. All the icons available can be found here.
Copyright (C) 2016 Carolina Aguilar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Version | Tag | Published |
---|---|---|
1.6.0 | latest | 5yrs ago |