An open API service indexing awesome lists of open source software.

https://github.com/jopemachine-playground/rn-text-with-link

Create simple text component with hyperlink in React Native
https://github.com/jopemachine-playground/rn-text-with-link

hyperlink react-native

Last synced: 8 months ago
JSON representation

Create simple text component with hyperlink in React Native

Awesome Lists containing this project

README

          

# rn-text-with-link
License

Create simple text component with hyperlink in React Native

## Install

```
npm i rn-text-with-link
```

## Example

Check [App.js](https://github.com/jopemachine/rn-text-with-link/blob/main/Example/App.js) in the Example folder.

## API

### TextWithLink

#### text: `string`

Enter text through this.

urls could be represented by like this way. `[label](url)`

Example:

```js
import TextWithLink from 'rn-text-with-link';

...

```

#### style?: `StyleProp`

Style of normal text which not contains hyperlink

#### linkStyle?: `StyleProp`

The style of hyperlink text.

#### callback?: `(url: string) => void | CallbackTable`

1) `Function` type : Callback function of onPressEvent of hyperlink.

You can simply put `!` in the url's place if you don't need to use url in your custom callback.

```js
import TextWithLink from 'rn-text-with-link';

...

const gotoSignUpScreen = () => {
...
};

...

```

2) `CallbackTable` type (Object type)

It could be useful when you want to bind a different callback function to a particular "link".

You can simply put `!` in the url's place if you don't need to use url in your custom callback.

Example:

```js
import TextWithLink from 'rn-text-with-link';

...

const handleSignIn = () => {
...
};

const gotoSignUpScreen = () => {
...
};

...

```