- Notifications
You must be signed in to change notification settings - Fork62
React Native render for draft.js model
License
globocom/react-native-draftjs-render
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A React Native render forDraft.js model.
Join the#react-native-render channel on DraftJS Slack team.
InstallReact Native Draft.js Render on your React Native project, using NPM or Yarn:
yarn add react-native-draftjs-render# or...npm i -S react-native-draftjs-render
Just import and insert your Draft.js model on getRNDraftJSBlocks:
importReactfrom'react';import{ScrollView,AppRegistry,}from'react-native';importgetRNDraftJSBlocksfrom'react-native-draftjs-render';importcontentStatefrom'DraftJs/contentState';constMyApp=()=>{constblocks=getRNDraftJSBlocks({ contentState});return(<ScrollViewstyle={{flex:1}}>{blocks}</ScrollView>);};AppRegistry.registerComponent('MyApp',()=>MyApp);
See oursample
folder for more details.
RNDraftJSRender comes with default styles, but you can use your own:
importReactfrom'react';import{AppRegistry,ScrollView,StyleSheet,}from'react-native';importgetRNDraftJSBlocksfrom'react-native-draftjs-render';importcontentStatefrom'DraftJs/contentState';conststyles=StyleSheet.flatten({paragraph:{color:'pink',fontSize:18,},link:{color:'blue',fontWeight:'bold',},});constMyApp=()=>{constblocks=getRNDraftJSBlocks({ contentState,customStyles:styles});return(<ScrollViewstyle={{flex:1}}>{blocks}</ScrollView>);};AppRegistry.registerComponent('MyApp',()=>MyApp);
See more atCustom Styles documentation.
To develop using example react-native project:
git clone git@github.com:globocom/react-native-draftjs-render.gitcd 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
About
React Native render for draft.js model
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors13
Uh oh!
There was an error while loading.Please reload this page.