Giter Club home page Giter Club logo

react-native-web-components-boilerplate's Introduction

react-native-web-components-boilerplate

This is a project for building component libraries with react-native-web, its ready with storybook, jest, and exports a UMD library that you can import to your other projects.

Available Scripts

In the project directory, you can run:

npm start or npm run storybook

Run storybook with HMR and auto update, use this to develop your components.

npm test

Runs tests with jest (currently broken react-native-web/issues/1284).

npm run build

Builds the component library change the main property in package.json to set the output file.

npm run build-storybook

Builds the storybook as a static website, great for documentation.

develop locally

In this project run npm link, and in the react-native/web project run npm link my-library-name.

3rd party requirements:

This project uses react-native, react-art and react as peer dependencies (for web also react-dom).

Web

You will need to have react-native-web aliased as react-native (comes built in with react CRA), react-art (used by react native web), react, and react-dom.

Native

You should be good to go with react and react-native.

example

// for web it should import "react-native-web" under the alias "react-native".
import 'react-native';
// or
import { View } from 'react-native';

import {ActionTextInput} from 'react-native-web-components-boilerplate';

const MyComponent = () => {
    return (
        <ActionTextInput
             onAction={(event) => console.log('onAction', event)}
             onChange={(text) => console.log('onChange', text)}
             label="Send Email" 
        />
    )
}

Structure

In order to keep the directory structure clean, you should follow this schema:

/src
    index.js - the index file that exports all others
    /lib
        /<Component-Name>
            <Component-Name>.jsx - the component
            <Component-Name>.story.jsx - tests
            <Component-Name>.test.jsx - documentation

react-native-web-components-boilerplate's People

Contributors

liron-navon avatar

Stargazers

ManAnRuck avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.