npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mesan-react-native-components

v1.0.15

Published

Basic Components for React Native

Downloads

8

Readme

React Native Basic Components

React Native Basic Components

Installation

$ npm i mesan-react-native-components --save

FilterView

Shows a filter view

import React from 'react';
import {View} from 'react-native';

import {FilterView} from 'mesan-react-native-components'

export default function Example(props) {
    const [selectedFilters, setSelectedFilters] = useState([]);
    const [filterVisible, setFilterVisible] = useState(false);
    
    //returns the filters and an array of selected
    const onDone = ({filters, selected}) => setSelectedFilters(selected);
    
    const order_options = [{name: "Name"}, {name: "Age"}, {name: "Price"}];
    const category_options = [{name: "Music"}, {name: "Sport"}, {name: "Theatre"}];
    const filters = [
        {title: "Order By", options: order_options}, 
        {title: "Category", options: category_options}
    ];
    
    return (
        <View>
            <FilterView
                modal={true}
                filters={filters}
                visible={filterVisible}
                onDone={onDone}
                onCancel={() => setFilterVisible(false)}/>
            <Text>{selectedFilters.toString()}</Text>
        </View>
    );

};

| prop | value | required/optional | description | | ---- | ----- | ----------------- | ----------- | | modal | boolean | optional | indicates if the filter view will be displayed in a modal or not. if true, view is hidden until triggered | | filters | array | required | an array of objects of filters to display | | onDone | function | required | the function called when the 'Done' button is tapped | | onCancel | function | required | the function called when the 'Cancel' button is tapped | | visible | object | optional | used to trigger the visibility of the Component, used only if 'modal' is true |

Panel

Shows a panel

import React from 'react';

import {Panel} from 'mesan-react-native-components'

export default function Example(props) {
    return (
        <View>
            <Panel title={'Panel Header Title'}
                   data={[{}, {}, ...]} 
                   itemWidth={200}
                   margin={12}
                   containerStyle={{paddingTop: 12}}
                   titleStyle={{fontFamily: font,color: "#0E0E27", marginBottom: 4}}
                   renderItem={({item}) => <EventItem item={item} isFeatured={true}/>}/>
        </View>
    );

};

| prop | value | required/optional | description | | ---- | ----- | ----------------- | ----------- | | title | string | optional | The panel title - Show at the top of panel | | data | object | required | the data to show | | itemWidth | number | required | the width of the child components | | margin | number | required | the margin between the child components | | containerStyle | function | optional | the style for the container | | titleStyle | function | optional | the style for the title | | renderItem | function | required | the component to render for each item |

Container

A container with collapsing header and an hidden overlay view.

import React from 'react';

import {Panel} from 'mesan-react-native-components'

export default function Example(props) {
    return (
        <View>
            <Panel title={'Panel Header Title'}
                   data={[{}, {}, ...]} 
                   itemWidth={200}
                   margin={12}
                   containerStyle={{paddingTop: 12}}
                   titleStyle={{fontFamily: font,color: "#0E0E27", marginBottom: 4}}
                   renderItem={({item}) => <EventItem item={item} isFeatured={true}/>}/>
        </View>
    );

};

| prop | value | required/optional | description | | ---- | ----- | ----------------- | ----------- | | headerHeight | string | optional | The height of the header - defaults to 44 for ios and 65 for Android|

| showHiddenView | boolean | optional | used to show/hide the hidden overlay view| | renderHiddenView | boolean | optional | used to show/hide the hidden overlay view| | hiddenViewStyle | function | optional | the style for the hidden view wrapper |

| data | object | required | the data to show | | itemWidth | number | required | the width of the child components | | margin | number | required | the margin between the child components | | containerStyle | function | optional | the style for the container | | renderItem | function | required | the component to render for each item |

style: {},
contentContainerStyle: {},

headerTitle: '',
showHeader: true,
fixedHeader: false,
renderHeader: null,
headerBackgroundColor: '#ffffff',

renderFixedHeader: null

Loading

Shows a large view with a centered large loading indicator.

Footer

Shows a small view with a centered small loading indicator.

import React from 'react';

import {Loading, Footer} from 'mesan-react-native-components'

export default function Example(props) {
    const [data, setData] = useState([]);
    const [isFetching, setIsFetching] = useState(true);
    
    //2 - MAIN CODE BEGINS HERE
    useEffect(() => {
        setTimeout(() =>  setIsFetching(false), 3000);
    }, []);

    if (isFetching) return <Loading/>;
    
    return(
        <FlatList
            data={data}
            renderItem={renderItem}
            ListFooterComponent={<Footer/>}/>
    )
};

Error

Shows a view with a error message and a retry button

import React from 'react';
import {View} from 'react-native';

import {Error} from 'mesan-react-native-components'

export default function Example(props) {
    
    const onRetry= () => console.log("Retrying....");
    
    return (
        <View>
            <Error error={error} onRetry={onRetry}/>
        </View>
    );

};

| prop | value | required/optional | description | | ---- | ----- | ----------------- | ----------- | | error | object | required | an object with the key 'message' | | onRetry | function | optional | the function called when the retry button is tapped |