Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

React Native render for draft.js model

License

NotificationsYou must be signed in to change notification settings

globocom/react-native-draftjs-render

Repository files navigation

Build StatusCoverage Statusnpm versionlicense

A React Native render forDraft.js model.

Discussion and Support

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

Documentation

Getting Started

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

Using

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.

Adding custom styles

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.

Contributing

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

Stars

Watchers

Forks

Packages

No packages published

Contributors13


[8]ページ先頭

©2009-2025 Movatter.jp