Coder Social home page Coder Social logo

pachocha / react-native-highlightable-text Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cisiwen/react-native-highlightable-text

0.0 0.0 0.0 6.7 MB

Support highlighting text in React Native

License: MIT License

Ruby 5.57% Objective-C 46.98% Java 20.80% TypeScript 26.65%

react-native-highlightable-text's Introduction

react-native-highlightable-text

Highlightable React native Text View component, supports text selection and showing highlights.

Demo

Usage

import { HighlightableText } from '@vikalp_p/react-native-highlightable-text';

// Use normally, it is a drop-in replacement for react-native/Text
<HighlightableText
  value={`Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint voluptatibus officiis nisi molestiae officia iure, magnam provident, perspiciatis fugiat ex dolorem! Commodi animi corporis dicta possimus ducimus perferendis, sequi consequuntur?`}
  style={contentStyle}
  highlights={highlights}
  highlightColor={'red'}
  onHighlightPress={onHighlightPress}
  onSelectionChange={onSelectionChange}
/>;

Getting started

$ npm install @vikalp_p/react-native-highlightable-text $ cd ios && pod install

Props

name description type default
value text content string ""
style additional styles to be applied to text Object
highlights array of text ranges that should be highlighted with an optional id array({ id: string, start: int, end: int }) []
highlightColor highlight color string
onSelectionChange Called when the text selection changes (event: Selection) => void
onHighlightPress called when the user taps the highlight (id: string) => void
appendToChildren element to be added in the last line of text ReactNode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.