Gathering detailed insights and metrics for @sishuguojixuefu/react-native-json-tree
Gathering detailed insights and metrics for @sishuguojixuefu/react-native-json-tree
Gathering detailed insights and metrics for @sishuguojixuefu/react-native-json-tree
Gathering detailed insights and metrics for @sishuguojixuefu/react-native-json-tree
npm install @sishuguojixuefu/react-native-json-tree
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
117 Stars
62 Commits
30 Forks
5 Watching
15 Branches
11 Contributors
Updated on 17 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-66.7%
1
Compared to previous day
Last week
90%
19
Compared to previous week
Last month
51.6%
47
Compared to previous month
Last year
-8.1%
466
Compared to previous year
React Native JSON Viewer Component, based on react-json-tree. Supports iterable objects, such as Immutable.js.
1import JSONTree from 'react-native-json-tree' 2// If you're using Immutable.js: `npm i --save immutable` 3import { Map } from 'immutable' 4 5// Inside a React component: 6const json = { 7 array: [1, 2, 3], 8 bool: true, 9 object: { 10 foo: 'bar' 11 } 12 immutable: Map({ key: 'value' }) 13} 14 15<JSONTree data={json} />
Check out the Example directory.
This component now uses react-base16-styling module, which allows to customize component via theme
property, which can be the following:
{ style, className }
and should return an object with the same structure. Other arguments depend on particular context (and should be described here). See createStylingFromTheme.js for the list of styling object keys. Also, this object can extend base16
theme via extend
property.Every theme has a light version, which is enabled with invertTheme
prop.
1const theme = { 2 scheme: 'monokai', 3 author: 'wimer hazenberg (http://www.monokai.nl)', 4 base00: '#272822', 5 base01: '#383830', 6 base02: '#49483e', 7 base03: '#75715e', 8 base04: '#a59f85', 9 base05: '#f8f8f2', 10 base06: '#f5f4f1', 11 base07: '#f9f8f5', 12 base08: '#f92672', 13 base09: '#fd971f', 14 base0A: '#f4bf75', 15 base0B: '#a6e22e', 16 base0C: '#a1efe4', 17 base0D: '#66d9ef', 18 base0E: '#ae81ff', 19 base0F: '#cc6633' 20}; 21 22<JSONTree data={data} theme={theme} invertTheme={false} /> 23
1<JSONTree data={data} theme={{ 2 extend: theme, 3 // underline keys for literal values 4 valueLabel: { 5 textDecoration: 'underline' 6 }, 7 // switch key for objects to uppercase when object is expanded. 8 // `nestedNodeLabel` receives additional arguments `expanded` and `keyPath` 9 nestedNodeLabel: ({ style }, nodeType, expanded) => ({ 10 style: { 11 ...style, 12 textTransform: expanded ? 'uppercase' : style.textTransform 13 } 14 }) 15}} />
You can pass getItemString
to customize the way arrays, objects, and iterable nodes are displayed (optional).
By default, it'll be:
1<JSONTree getItemString={(type, data, itemType, itemString) => 2 <Text>{itemType} {itemString}</Text>} 3/>
But if you pass the following:
1const getItemString = (type, data, itemType, itemString) => 2 <Text>{type}</Text>;
Then the preview of child elements now look like this:
You can pass the following properties to customize rendered labels and values:
1<JSONTree 2 labelRenderer={raw => <Text style={{ fontWeight: 'bold' }}>{raw}</Text>} 3 valueRenderer={raw => <Text style={{ fontStyle: 'italic' }}>{raw}</Text>} 4/>
In this example the label and value will be rendered with bold and italic text respectively.
For labelRenderer
, you can provide a full path - see this PR.
shouldExpandNode: (keyName, data, level) => boolean
- determines if node should be expanded (root is expanded by default)hideRoot: boolean
- if true
, the root node is hidden.sortObjectKeys: boolean | (a, b) => number
- sorts object keys with compare function (optional). Isn't applied to iterable maps like Immutable.Map
.MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 4 issue activity found in the last 90 days -- score normalized to 6
Reason
Found 10/21 approved changesets -- score normalized to 4
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
69 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More