react-native-panel
A Customizable React Native Panel for Android and iOS
- note: It's lag due to gif recorder app, actually it works more smooth.
Installation
npm install --save react-native-panel
Usage
- Just import
Panel
from the package and use your own component to render Header or Content. - Don't forget to wrap your
Panel
component insideScrollView
orListView
. - To render a content, you must wrap your component inside
Panel
(as a children). - See Example below for more details.
Example
import React Component from 'react';import StyleSheet Text View ScrollView from 'react-native';import Panel from 'react-native-panel'; { return <View => <Text>This is Custom Header</Text> </View> ; } { return <ScrollView = = > <Panel = = > <Text => Lorem ipsum dolor sit amet consectetur adipiscing elit </Text> </Panel> <Panel ="With onPress, yeaahhhh!!! It's so f#cking amazing wooohoooo..." = > <Text => Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum </Text> </Panel> <Panel = ="Custom container style" > <Text => Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur Excepteur sint occaecat cupidatat non proident </Text> </Panel> <Panel ="Custom content style"> <View => <View = /> <View = /> <View = /> </View> </Panel> </ScrollView> ; } const styles = StyleSheet; ;
Properties
props | type | description |
---|---|---|
header | String / Function | Use String or Function that render a React Element |
onPress | Function | Invoke a function when the Panel header is pressed |
style | Object | Custom wrapper style for Panel |
License
MIT