|
1 | 1 | import { Map } from 'immutable'; |
2 | 2 | import React, { Component } from 'react'; |
3 | | -import { StyleSheet,Text, View } from 'react-native'; |
| 3 | +import { ScrollView,StyleSheet, View } from 'react-native'; |
4 | 4 | import JSONTree from 'react-native-json-tree'; |
5 | 5 | import Heading from './Heading'; |
6 | 6 |
|
7 | 7 | const styles = StyleSheet.create({ |
8 | 8 | container: { |
9 | | - backgroundColor: '#F5FCFF', |
10 | 9 | flex: 1, |
11 | 10 | padding: 20, |
12 | 11 | }, |
13 | 12 | }); |
14 | 13 |
|
15 | | -// const exampleJson = { |
16 | | -// array: [1, 2, 3], |
17 | | -// emptyArray: [], |
18 | | -// bool: true, |
19 | | -// date: new Date(), |
20 | | -// object: { |
21 | | -// foo: { |
22 | | -// bar: 'baz', |
23 | | -// nested: { |
24 | | -// moreNested: { |
25 | | -// evenMoreNested: { |
26 | | -// veryNested: { |
27 | | -// insanelyNested: { |
28 | | -// ridiculouslyDeepValue: 'Hello', |
29 | | -// levels: 9, |
30 | | -// tooMany: true, |
31 | | -// }, |
32 | | -// }, |
33 | | -// }, |
34 | | -// }, |
35 | | -// }, |
36 | | -// }, |
37 | | -// baz: undefined, |
38 | | -// func: function User() {}, |
39 | | -// }, |
40 | | -// emptyObject: {}, |
41 | | -// immutable: Map({ key: 'value' }), // eslint-disable-line new-cap |
42 | | -// hugeArray: Array.from({ length: 100 }).map((_, i) => `item #${i}`), |
43 | | -// longString: 'Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor', |
44 | | -// }; |
45 | | - |
46 | 14 | const exampleJson = { |
47 | | - key: 'val', |
48 | | - secondDey: 2, |
49 | | - nestedArray: [1,2,3] |
| 15 | + array: [1, 2, 3], |
| 16 | + emptyArray: [], |
| 17 | + bool: true, |
| 18 | + date: new Date(), |
| 19 | + object: { |
| 20 | + foo: { |
| 21 | + bar: 'baz', |
| 22 | + nested: { |
| 23 | + moreNested: { |
| 24 | + evenMoreNested: { |
| 25 | + veryNested: { |
| 26 | + insanelyNested: { |
| 27 | + ridiculouslyDeepValue: 'Hello', |
| 28 | + levels: 9, |
| 29 | + tooMany: true, |
| 30 | + }, |
| 31 | + }, |
| 32 | + }, |
| 33 | + }, |
| 34 | + }, |
| 35 | + }, |
| 36 | + baz: undefined, |
| 37 | + func: function User() {}, |
| 38 | + }, |
| 39 | + emptyObject: {}, |
| 40 | + immutable: Map({ key: 'value' }), // eslint-disable-line new-cap |
| 41 | + hugeArray: Array.from({ length: 100 }).map((_, i) => `item #${i}`), |
| 42 | + longString: 'Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor', |
50 | 43 | }; |
51 | 44 |
|
| 45 | + |
52 | 46 | // eslint-disable-next-line |
53 | 47 | class Examples extends Component { |
54 | 48 | render() { |
55 | 49 | return ( |
56 | 50 | <View style={styles.container}> |
57 | | - <Heading>react-native-json-tree</Heading> |
58 | | - <JSONTree data={exampleJson} /> |
| 51 | + <ScrollView> |
| 52 | + <Heading>react-native-json-tree</Heading> |
| 53 | + <JSONTree data={exampleJson} /> |
| 54 | + </ScrollView> |
59 | 55 | </View> |
60 | 56 | ); |
61 | 57 | } |
|
0 commit comments