• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    JavaScript
  • Created about 1 year ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A drop-in replacement Text component for React Native that removes overhead

react-native-fast-text

A faster version of the React Native Text component that removes (for the most part) unnecessary overhead.

Why?

The native Text implementation includes additional *onPress props:

  • onLongPress
  • onPress
  • onPressIn
  • onPressOut
  • disabled
  • pressReactOffset

It also includes a state variable called isHighlighted, which causes unnecessary renders. Additionally, it wraps the Text with the <TextAncestor.Provider /> context provider, thereby polluting the React tree.

By removing this extra logic and going straight down into RCTText we have a much faster text component.

Notice

It's worth noting that removing the context provider has one downside: while nesting Text inside Text still works, each individual Text node must be styled independently since style inheritance is lost. The advantages outweigh the disadvantages though.

Installation

Install the module. Use it however you'd like.

There's a codmod in here that will convert all of your import { Text } from 'react-native to use import { Text } from 'react-native-fast-text.

npx jscodeshift -t node_modules/react-native-fast-text/codemods/transform-to-fast-text.js

Then when the time comes, you can also run a codemod to remove react-native-fast-text

npx jscodeshift -t node_modules/react-native-fast-text/codemods/transform-from-fast-text.js

Links

Read this Twitter thread by Nate

Here's the Text implementation from React Native

Thanks

All I did was create the package. The brains behind this is Nate from Tamagui (@natebirdman). Tamagui is an incredible cross platform library.

@FernandoTheRojo also had an awesome thread breaking down why this is happening.

More Repositories

1

react-native-face-pile

🙉👮🙎🤠 Face Piles (A group of overlapping round avatars) for React Native
JavaScript
105
star
2

apollo-tote

👜 A declarative approach to handling Apollo GraphQL queries in React
JavaScript
77
star
3

dotfiles

᠅ Dotfiles for zsh, tmux, fzf, neovim, git, zprezto, hammerspoon, kitty & more 🔥
Lua
72
star
4

react-gpt

✨ An experimental chat-gpt experience focused on React using LangChain & OpenAI
TypeScript
69
star
5

create-simple-icon

🎨 🔧 Download and colorize branded svg icons in a snap!
JavaScript
47
star
6

react-native-asyncstorage

📬 📫 🗄 Declarative AsyncStorage component for React Native
JavaScript
31
star
7

frontend-setup

🛠 OSX - Frontend Development Environment Setup & Utilities
18
star
8

reason-react-native-example

ReasonML React Native (Expo) example
OCaml
14
star
9

cloudinary-microurl

A tiny (346B), 0 dependency, fully-tested Cloudinary URL generator for JS
JavaScript
14
star
10

reason-conf-us-2019

Reason Conf US 2019 Website
OCaml
10
star
11

glamor-helpers

Helper functions for Glamor, the CSS-in-JS library
JavaScript
10
star
12

js-midi

Chrome Midi Api Bridge
JavaScript
10
star
13

sub-in

🥙 A tiny (115B) find-and-replace utility for strings in Javascript
JavaScript
8
star
14

tsdx-reason-example

Use tsdx with Reason
JavaScript
8
star
15

redux-crud-api-middleware

Redux Crud Api Middleware
5
star
16

codenames-deluxe

Codenames Deluxe: Play Codenames online with your friends & family across every device!
CSS
4
star
17

peterpme.github.io

TypeScript
3
star
18

bs-react-native-typography

OCaml
3
star
19

react-knob

React Knob
JavaScript
3
star
20

ng-google-sheets-cms

Pull in Google Docs data with Angular.
JavaScript
3
star
21

awesome-mac-automation

Guide to macOS / OSX Automation
3
star
22

react-midi

The Home of React Midi (WIP)
2
star
23

earth-moon-cosmos

2
star
24

create-node-app

JavaScript
2
star
25

tiny-js-libraries

A showcase of tiny js libraries ( < 1kb) and how developers were able to pull it off!
2
star
26

react-contest

A super tiny A/B (265 bytes!) testing platform for your components.
JavaScript
2
star
27

angular-accordion-tabs-directive

AngularJS directive that allows you to reuse components in order to create an accordion-to-tab approach seamlessly.
HTML
2
star
28

react-rally-schedule

React Rally Schedule
JavaScript
1
star
29

expo-av-example

TypeScript
1
star
30

chicagojs-conf-landing

CSS
1
star
31

tiny-isempty

A tiny implementation of isEmpty that works on strings, arrays & objects
JavaScript
1
star
32

react-native-new-arch-bignumber

Kotlin
1
star
33

ng-smooth-scroll

AngularJS directive that delivers smooth scrolling to your application
JavaScript
1
star
34

knowledge

Knowledge is Power
1
star
35

backpackmwa2

Kotlin
1
star
36

expo-react-navigation-sourcemap-issue

JavaScript
1
star
37

peterpme.github.io-backup

Home page for Peter Piekarczyk (https://www.peterp.me)
Shell
1
star
38

notion-blog

TypeScript
1
star
39

chat-gpt-results

OpenAI ChatGPT Results
1
star
40

peterpme

1
star
41

backpack-mwa-bindings

Java
1
star
42

xastro-dashboard

JavaScript
1
star
43

next-xastro-dashboard

TypeScript
1
star
44

ng-carousel

An AngularJS directive for a creating a simple carousel running in your application.
1
star