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

rn-declarative-eva

v0.1.0

Published

A responsive layout for the react-native

Downloads

18

Readme

⚛️ rn-declarative

Responsive layout for react-native

screencast

The howto guide available by the link

Installation

The package is split into two parts: rn-declarative and rn-declarative-eva. The rn-declarative manage the core part: It independent from any UI Kit and can be easely installed to any project. The rn-declarative-eva contains bindings to the UI Kitten - an open source ui components for react-native build on top of Eva Design. By replacing rn-declarative-eva package you can connect the rn-declarative to any UI kit, for example, react-native-paper

npm i @ui-kitten/components @eva-design/eva react-native-svg rn-declarative rn-declarative-eva

Documentation

[!IMPORTANT] This is a fork of project named react-declarative. You should seek for documentation in that repo. ⭐Star and 💻Fork It on github will be appreciated

The rn-declarative contains the following fields

FieldType.Combo, FieldType.Items, FieldType.Text, FieldType.YesNo, FieldType.Switch, FieldType.Radio, FieldType.Checkbox, FieldType.Component, FieldType.Button

And layouts

FieldType.Group, FieldType.Fragment, FieldType.Layout, FieldType.Condition

Code sample

Responsive Forms for the React Native

import { One, FieldType, TypedField } from 'rn-declarative';

import { Text } from '@ui-kitten/components';
import { ScrollView } from 'react-native';

const fields: TypedField[] = [
    {
        type: FieldType.Component,
        style: {
            justifyContent: 'center',
            width: '100%',
            height: 125,
        },
        element: () => (
            <Text category='h4'>
                Adaptive columns
            </Text>
        ),
    },
    {
        type: FieldType.Group,
        style: {
            width: '100%',
        },
        fields: [
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Text
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Text,
                        style: {
                            width: '100%',
                        },
                        name: 'text',
                        title: 'Text',
                        description: 'Single line',
                    },
                    {
                        type: FieldType.Text,
                        style: {
                            width: '100%',
                        },
                        validation: {
                            required: true,
                        },
                        dirty: true,
                        name: 'text_invalid',
                        title: 'Text',
                        description: 'Invalid',
                    },
                    {
                        type: FieldType.Text,
                        style: {
                            width: '100%',
                        },
                        inputMultiline: true,
                        name: 'text',
                        title: 'Text',
                        description: 'Multi line',
                    },
                ],
            },
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Combo
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Combo,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        name: 'combo',
                        title: 'Combo',
                        placeholder: 'combo',
                        description: 'Default',
                    },
                    {
                        type: FieldType.Combo,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        validation: {
                            required: true,
                        },
                        dirty: true,
                        name: 'combo_invalid',
                        title: 'Combo',
                        placeholder: 'combo',
                        description: 'Invalid',
                    },
                    {
                        type: FieldType.Combo,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        name: 'combo',
                        title: 'Combo',
                        placeholder: 'combo',
                        description: 'No deselect',
                    },
                ],
            },
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Items
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Items,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        name: 'items',
                        title: 'Items',
                        placeholder: 'items',
                        description: 'Default',
                    },
                    {
                        type: FieldType.Items,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        validation: {
                            required: true,
                        },
                        dirty: true,
                        name: 'items_invalid',
                        title: 'Items',
                        placeholder: 'items',
                        description: 'Invalid',
                    },
                    {
                        type: FieldType.Items,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        itemList: [
                            'Test 1',
                            'Test 2',
                            'Test 3',
                        ],
                        name: 'items',
                        title: 'Items',
                        placeholder: 'items',
                        description: 'No deselect',
                    },
                ],
            },
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.YesNo
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.YesNo,
                        style: {
                            width: '100%',
                        },
                        name: 'yesno',
                        title: 'YesNo',
                        placeholder: 'yesno',
                        description: 'Default',
                    },
                    {
                        type: FieldType.YesNo,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        validation: {
                            required: true,
                        },
                        dirty: true,
                        name: 'yesno_invalid',
                        title: 'YesNo',
                        placeholder: 'yesno',
                        description: 'Invalid',
                    },
                    {
                        type: FieldType.YesNo,
                        noDeselect: true,
                        style: {
                            width: '100%',
                        },
                        name: 'yesno',
                        title: 'YesNo',
                        placeholder: 'yesno',
                        description: 'No deselect',
                    },
                ]
            },
        ]
    },
    {
        type: FieldType.Group,
        baseline: true,
        style: {
            width: '100%',
        },
        fields: [
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Radio
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Radio,
                        name: 'radio',
                        radioValue: '1',
                        title: 'Radio 1',
                    },
                    {
                        type: FieldType.Radio,
                        name: 'radio',
                        radioValue: '2',
                        title: 'Radio 2',
                    },
                    {
                        type: FieldType.Radio,
                        name: 'radio',
                        radioValue: '3',
                        title: 'Radio 3',
                    },
                ],
            },
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Switch
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Switch,
                        name: 'switch',
                    },
                    {
                        type: FieldType.Switch,
                        name: 'switch',
                    },
                    {
                        type: FieldType.Switch,
                        name: 'switch',
                    },
                ],
            },
            {
                type: FieldType.Group,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '25%',
                },
                fields: [
                    {
                        type: FieldType.Component,
                        style: {
                            width: '100%',
                        },
                        element: () => (
                            <Text category='h6'>
                                FieldType.Checkbox
                            </Text>
                        ),
                    },
                    {
                        type: FieldType.Checkbox,
                        name: 'checkbox1',
                    },
                    {
                        type: FieldType.Checkbox,
                        name: 'checkbox2',
                    },
                    {
                        type: FieldType.Checkbox,
                        name: 'checkbox2',
                    },
                ],
            },
        ]
    },
    {
        type: FieldType.Component,
        style: {
            justifyContent: 'center',
            width: '100%',
            height: 125,
        },
        element: () => (
            <Text category='h4'>
                Adaptive form
            </Text>
        ),
    },
    {
        type: FieldType.Group,
        style: {
            width: '100%',
        },
        fields: [
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                inputMultiline: true,
                name: 'text',
                title: 'Text',
                description: 'Multi line',
            },
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                name: 'text',
                title: 'Text',
                description: 'Single line',
            },
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                name: 'text',
                title: 'Text',
                description: 'Single line',
            },
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                name: 'text',
                title: 'Text',
                description: 'Single line',
            },
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                name: 'text',
                title: 'Text',
                description: 'Single line',
            },
            {
                type: FieldType.Text,
                phoneStyle: {
                    width: '100%',
                },
                tabletStyle: {
                    width: '50%',
                },
                desktopStyle: {
                    width: '33%',
                },
                name: 'text',
                title: 'Text',
                description: 'Single line',
            },
        ],
    },
];

export const MainPage = () => {
    return (
        <ScrollView>
            <One fields={fields} onChange={console.log} />
        </ScrollView>
    );
};

export default MainPage;