Menu

1 / 5

How to set up Lexical editor in React Native

DEV Community: reactnative·Dragoș Străinu·21 days ago
#H0xNf63m
#devtoreactnative#devto#dev#code#lexical
Reading 0:00
15s threshold

So you have a web app that uses Lexical editor and now you want to build the same editor on React Native, or maybe you just want to build a rich text editor in React Native using Lexical.

But unfortunately lexical does not support React Native at the moment.

So the idea that comes to mind is to try Lexical editor in a react-native-webview. There are similar solutions like react-native-cn-quill and react-native-rich-editor .

But as expo docs say:

If you need more configurability, you can build a similar library with an existing web-only editor.

So let's implement a lexical editor in an Expo app.

(This is a demo project but you can follow the steps to add the editor to an existing React Native app)

Create the expo app

npx create-expo-app -t expo-template-blank-typescript

Enter fullscreen mode

Exit fullscreen mode

Now let's install react-native-webview .

npm i react-native-webview

Enter fullscreen mode

Exit fullscreen mode

And make some changes in App.tsx , to display the WebView with…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.