# react-native-object-view

> Rendering JSON-object as react-native component. It can be helpful for dev-menu.

Latest version **1.1.2** (published 2023-02-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-object-view
pnpm add react-native-object-view
yarn add react-native-object-view
bun add react-native-object-view
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-02-28 |
| First published | 2023-02-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kirill Tarasenko |
| Maintainers | ocaxapprivet |

## Links

- npm: https://www.npmjs.com/package/react-native-object-view
- Repository: https://github.com/KirillTarasenko/react-native-object-view
- Homepage: https://github.com/KirillTarasenko/react-native-object-view#readme
- Issues: https://github.com/KirillTarasenko/react-native-object-view/issues
- npm.io page: https://npm.io/package/react-native-object-view

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.16.6

## Recent versions

- 1.1.2 (latest) — 2023-02-28
- 1.1.1 — 2023-02-28
- 1.1.0 — 2023-02-28
- 1.0.2 — 2023-02-28
- 1.0.1 — 2023-02-28
- 1.0.0 — 2023-02-28

## README

# react-native-object-view
Rendering JSON-object as react-native component. It can be helpful for dev-menu.

## Installation
```npm install react-native-object-view``` or ```yarn add react-native-object-view```


# react-native-object-view
![](https://github.com/KirillTarasenko/react-native-object-view/blob/main/example/ex.gif)


## How to use

### Example
```js
import DevObjectView from 'react-native-object-view';

...
<DevObjectView
        keyName={'root'} // optional
        devObject={{}} // require: any object
      />
```

### Example use with Alert
```js
import DevObjectView from 'react-native-object-view';
import { Alert } from 'react-native';

...

const FAKE_DATA = {
  arrayExm: [1, 2, 3],
  booleanExm: true,
  stringExm: 'test string',
  func: () => {},
  objectExm: { b: { c: { d: 'hello world' }, f: { h: false } } },
};

  handleSaveKey = props => {
    Alert.alert('Callback onLongPressKey', JSON.stringify(props));
  };
  handleSaveValue = props => {
    Alert.alert('Callback onLongPressValue', JSON.stringify(props));
  };

...
<DevObjectView
        devObject={FAKE_DATA}
        autoExpandDepth={1}
        keyName={'root'}
        onLongPressKey={this.handleSaveKey}
        onLongPressValue={this.handleSaveValue}
      />
```
### Props

```devObject``` - The array or object that you want to be rendered.

```onLongPressKey``` - onLongPress by keyName. Callback param: ```({ key?: string; value: any; info: string })```

```onLongPressValue``` - onLongPress by value. Callback param: ```({ key?: string; value: any; info: string })```

```keyName``` - The key name that will be displayed. Only the initial keyName is relevant to you. Default is 'object'.

```marginLeft``` - The margin between nested objects. Adjusting this may make it more or less readable for you. Default is 5.

```value``` - The array or object that you want to be rendered.

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