-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { linkify } from "react-linkify" gives undefined #89
Comments
Facing same issue |
You need to import it like so: import Linkify from 'react-linkify' |
@Gr8z this is not the same thing |
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. |
See #108. 😉 |
Adding on top of what @teddybee mentioned above, linkify is used in the match decorator: react-linkify/src/decorators/defaultMatchDecorator.js Lines 3 to 11 in 325cb5e
Therefore if we want to use a customized version of linkify, we can create a custom match decorator with a new 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> |
In 0.2.2
import { linkify } from "react-linkify"
resulted inlinkify
referencing global LinkifyIt instance. In 1.0.0-alphalinkify
is undefinedThe text was updated successfully, but these errors were encountered: