Giter Club home page Giter Club logo

react-native-draftjs-render's Introduction

React Native Draft.js Render

Build Status Coverage Status npm version license

bitHound Overall Score bitHound Dependencies bitHound Code

A React Native render for Draft.js model.

Discussion and Support

Join the #react-native-render channel on DraftJS Slack team.

Getting Started

Install React Native Draft.js Render on your React Native project, using NPM or Yarn:

npm i -S react-native-draftjs-render
# or...
yarn add react-native-draftjs-render

Using

Just import and insert your Draft.js model on getRNDraftJSBlocks:

import React from 'react';
import {
  AppRegistry,
} from 'react-native';

import getRNDraftJSBlocks from 'react-native-draftjs-render';
import contentState from 'DraftJs/contentState';

const MyApp = () => {
  const blocks = getRNDraftJSBlocks({ contentState });
  return (
    <View style={{ flex: 1 }}>{blocks}</View>
  );
};

AppRegistry.registerComponent('MyApp', () => MyApp);

See our sample folder for more details.

Adding custom styles

RNDraftJSRender comes with default styles, but you can use your own:

import React from 'react';
import {
  AppRegistry,
  StyleSheet,
} from 'react-native';

import getRNDraftJSBlocks from 'react-native-draftjs-render';
import contentState from 'DraftJs/contentState';

const styles = StyleSheet.flatten({
  paragraph: {
    color: 'pink',
    fontSize: 18,
  },
  link: {
    color: 'blue',
    fontWeight: 'bold',
  },
});

const MyApp = () => {
  const blocks = getRNDraftJSBlocks({ contentState, customStyles: styles });
  return (
    <View style={{ flex: 1 }}>{blocks}</View>
  );
};

AppRegistry.registerComponent('MyApp', () => MyApp);

See more at Custom Styles documentation.

Contributing

To develop using example react-native project:

git clone [email protected]:globocom/react-native-draftjs-render.git
cd react-native-draftjs-render/
make setup

To run tests:

make test

To watch lib changes appearing on Sample App:

make watch

To run sample app in iOS:

make ios

To run sample app in Android:

make android

react-native-draftjs-render's People

Contributors

canedo avatar darlenedms avatar emilianoeloi avatar govi avatar lucassansilva avatar marcelometal avatar raphaelpor avatar rebecabordini avatar scorphus avatar

Watchers

 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.