MCPcopy Index your code
hub / github.com/PatoSala/react-native-blocks

github.com/PatoSala/react-native-blocks @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
145 symbols 407 edges 41 files 7 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Frame 14.png

React Native Blocks

Inspired by the data model behind Notion's flexibility, React Native Blocks let's you create modular block-based text editors like Notion. Try it on Expo Snack.

drawing

Quick start

1. Install in your React Native Project.

npm install @react-native-blocks/core

2. Install a block-component library

@react-native-blocks/core by its own only provides the necessary tools to create a block-based text editors but does not provide the block components to render. Its up to you if you want to use an already existing set of blocks, create your own or even use both at the same time. Each block is a self-contained unit: it manages its own state and defines how it interacts with other blocks as long as they allow it. In this example we'll be using @react-native-blocks/blocks which provides a set of blocks similar to the ones present in Notion (Pages, Headings, Checkboxes, etc).

npm install @react-native-blocks/blocks

Usage

To see an example usage go to https://www.npmjs.com/package/@react-native-blocks/core or join me on Discord to get help.

Future Plans

  • Adding support for nested blocks.
  • Rich text support (working on it on react-native-rich-text).
  • Improve block extraction strategie.

Creating your own blocks.

Guide in progress.

Warning

This library is still a work in progress so expect breaking changes on future releases.

Contributing

See the contributing guide

Discord

Join me on Discord https://discord.gg/utxtAafD8n.

Disclaimer

This project is an independent open-source initiative and is not affiliated with, endorsed by, or connected to Notion Labs, Inc. in any way.

All trademarks, logos, and brand names used in this project are the property of their respective owners. Any references to “Notion” are for descriptive or comparative purposes only and do not imply any association or partnership.

Extension points exported contracts — how you extend this code

Props (Interface)
* It could be a good idea to create a way to define a block's strucuture (like an interface) and * use that structure t
packages/blocks/src/TextBlock.tsx
BlockRegistrationProviderProps (Interface)
(no doc)
packages/core/src/components/BlockRegistration.tsx
Props (Interface)
(no doc)
packages/blocks/src/CheckboxBlock.tsx
BlockMeasuresContext (Interface)
(no doc)
packages/core/src/components/BlocksMeasuresProvider.tsx
Props (Interface)
(no doc)
packages/blocks/src/BulletBlock.tsx
RenderTreeProps (Interface)
(no doc)
packages/core/src/components/Editor.tsx
Props (Interface)
(no doc)
packages/blocks/src/CalloutBlock.tsx
EditorProps (Interface)
(no doc)
packages/core/src/components/Editor.tsx

Core symbols most depended-on inside this repo

updateBlockV2
called by 31
packages/core/src/components/BlocksContext.tsx
insertBlock
called by 30
packages/core/src/components/BlocksContext.tsx
createBlock
called by 29
packages/core/src/interfaces/Block.interface.ts
useBlocksContext
called by 24
packages/core/src/components/BlocksContext.tsx
removeBlock
called by 19
packages/core/src/components/BlocksContext.tsx
useTextBlocksContext
called by 18
packages/core/src/components/TextBlocksProvider.tsx
updateBlockData
called by 18
packages/core/src/core/updateBlock.ts
useTextInput
called by 10
packages/core/src/hooks/useTextInput.ts

Shape

Function 117
Interface 25
Class 2
Method 1

Languages

TypeScript100%

Modules by API surface

packages/core/src/components/BlocksContext.tsx13 symbols
packages/core/src/components/DragProvider.tsx11 symbols
packages/blocks/src/PageBlock.tsx10 symbols
packages/core/src/hooks/useTextInput.ts8 symbols
packages/core/src/components/ScrollProvider.tsx7 symbols
packages/core/src/components/BlocksMeasuresProvider.tsx7 symbols
packages/blocks/src/components/Footer/Footer.tsx7 symbols
packages/core/src/components/Editor.tsx6 symbols
packages/core/src/core/updateBlock.ts5 symbols
packages/core/src/components/TextBlocksProvider.tsx5 symbols
packages/blocks/src/CalloutBlock.tsx5 symbols
packages/core/src/interfaces/Block.interface.ts4 symbols

For agents

$ claude mcp add react-native-blocks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact