Git Product home page Git Product logo

Comments (6)

theycallmejpo avatar theycallmejpo commented on August 18, 2024 1

Facing same issue

from react-linkify.

shihanng avatar shihanng commented on August 18, 2024 1

Adding on top of what @teddybee mentioned above, linkify is used in the match decorator:

import LinkifyIt from 'linkify-it';
import tlds from 'tlds';
const linkify = new LinkifyIt();
linkify.tlds(tlds);
export default (text: string): Array<Object> => {
return linkify.match(text);
};

Therefore if we want to use a customized version of linkify, we can create a custom match decorator with a new LinkifyIt instance,

import Linkify from "react-linkify";
import LinkifyIt, { Match } from "linkify-it";

const linkify = new LinkifyIt();
linkify.tlds(tlds);
linkify.add("@", {
  // Add custom feature here
});

const matchDecorator = (text: string): Match[] | null => {
  return linkify.match(text);
};

and use Linkify component with the decorator:

        <Linkify
          matchDecorator={matchDecorator}
        >
          ...
        </Linkify>

from react-linkify.

Gr8z avatar Gr8z commented on August 18, 2024

You need to import it like so:

import Linkify from 'react-linkify'

from react-linkify.

vractal avatar vractal commented on August 18, 2024

@Gr8z this is not the same thing

from react-linkify.

teddybee avatar teddybee commented on August 18, 2024

The typedef declaration is missing for that export, and it is using linkify-it package. If you want to customize something, probably should use the componentDecorator property and look at the package's defaultComponentDecorator.js.

from react-linkify.

FluorescentHallucinogen avatar FluorescentHallucinogen commented on August 18, 2024

See #108. 😉

from react-linkify.

Related Issues (20)

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.