didair-native-package

Small UI components for React Native

Usage no npm install needed!

<script type="module">
  import didairNativePackage from 'https://cdn.skypack.dev/didair-native-package';
</script>

README

native-package

A set of versatile, good looking components

This package contains a few ready to go components for setting up an app quickly.

Good looking?

I know, the style of these are not that well designed.. I'm not a designer but in the future i will try to make these follow the same design pattern as the iPhone App Store on iOs 11. (This might be something that could be done by the handy hacker)

Whats it contain, tho?

Hold your horses, pal. I'm getting there.

  1. Button.js
  • A simple button that stretches as big as it needs to be.
  • Props: onPress (function)
  • Example usage:
    <Button onPress={ this.onButtonClick }>
        Press me!
    </Button>
    
  1. Header.js
  • A simple component that acts as an app header. Send the text it should display as a props.
  • Props: headerText (string)
  • Example usage:
    <Header headerText="Look at my header" />
    
  1. Spinner.js
  • This component is a wrapper of the React Native ActivityIndicator with styling so it centers on the screen
  • Props: size (string) [small/large]
  • Example usage:
    <Spinner size="large" />
    
  1. Card.js
  • This component is a container that should wrap CardSection
  • Example usage:
    <Card>
        <CardSection>
        </CardSection>
    </Card>
    
  1. CardSection.js
  • This component is used for each "section" inside a Card.
  • CardSection and Cards are only styled Views

Getting started...

.. is really simple heres an full example:

import React, { Component } from 'react';
import { Text } from 'react-native';

import { Card, CardSection, Button } from 'didair-native-package';

class Example extends Component {
    state = {
        tapped: 0,
    };
    
    onButtonPress = () => {
        this.setState({ tapped++ });
    }
    
    render() {
        const { tapped } = this.state;
        
        return(
            <Card>
                <CardSection>
                    <Text>You have tapped the button { tapped } times!</Text>
                </CardSection>
                
                <CardSection>
                    <Button onPress={ this.onButtonPress }>
                        Tap me
                    </Button>
                </CardSection>
            </Card>
        );
    }
}