# react-native-linking-controller

> Manage actions that come from linking in React Native applications

Latest version **0.0.3** (published 2017-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-linking-controller
pnpm add react-native-linking-controller
yarn add react-native-linking-controller
bun add react-native-linking-controller
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-02-27 |
| First published | 2017-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Aleksandr Klimenkov |
| Maintainers | klimenkov |
| Keywords | react, react-native, linking |

## Links

- npm: https://www.npmjs.com/package/react-native-linking-controller
- Repository: https://github.com/anyx/react-native-linking-controller
- Homepage: https://github.com/anyx/react-native-linking-controller#readme
- Issues: https://github.com/anyx/react-native-linking-controller/issues
- npm.io page: https://npm.io/package/react-native-linking-controller

## Dependencies (4)

- [url](https://npm.io/package/url.md) ^0.11.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [jest-react-native](https://npm.io/package/jest-react-native.md) ^18.0.0
- [babel-preset-react-native](https://npm.io/package/babel-preset-react-native.md) ^1.9.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2017-02-27
- 0.0.2 — 2017-02-27

## README

[![Build Status](https://travis-ci.org/anyx/react-native-linking-controller.svg?branch=master)](https://travis-ci.org/anyx/react-native-linking-controller)

# react-native-linking-controller

Small library for manage actions that come from external urls. Created for more convenient work with
 [Linking](https://facebook.github.io/react-native/docs/linking.html) 

## Example

```javascript
import React from 'react';
import {
    View,
    Linking
} from 'react-native';
import {
    setTheme,
} from 'react-native-material-kit';
import LinkingController from 'react-native-linking-controller';

const linkingActions = {
    //using default matcher: runs if url contains correct parameter `action`
    //Example: http://some.com?action=first-action
    'first-action': (action, context) => {
        dispatch(actions.security.setPasswordResetToken(action.params.token));
    },
    //custom matcher
    'another-action': {
        match: (url) => {
            //should return object that contains action params in case match url
            //false otherwise
        },
        action: (action, context) => {
            //do some staff
        }
    }
};

export default class App extends React.Component {
    //...
    componentDidMount() {
        //Possible actions context. Passed in second action parameter
        let actionsContext = this.context;
        let linkingController = new LinkingController(actionsContext);
        
        _.each(linkingActions, (callback, action) => {
            linkingController.registerAction(action, callback);
        });

        linkingController.bindToLinking(Linking);
    }
}
```

More information you can get in [tests](/__tests__)

## License
[MIT](/LICENSE)

---
_Source: https://npm.io/package/react-native-linking-controller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
