@@ -9,7 +9,6 @@ import ItemRange from './ItemRange';
99/**
1010 * Renders nested values (eg. objects, arrays, lists, etc.)
1111 */
12-
1312function renderChildNodes ( props , from , to ) {
1413 const {
1514 nodeType,
@@ -20,6 +19,7 @@ function renderChildNodes(props, from, to) {
2019 postprocessValue,
2120 sortObjectKeys,
2221 } = props ;
22+
2323 const childNodes = [ ] ;
2424
2525 getCollectionEntries ( nodeType , data , sortObjectKeys , collectionLimit , from , to ) . forEach ( entry => {
@@ -92,7 +92,7 @@ export default class JSONNestedNode extends React.Component {
9292
9393 // calculate individual node expansion if necessary
9494 const expanded = props . shouldExpandNode && ! props . isCircular ?
95- props . shouldExpandNode ( props . keyPath , props . data , props . level ) : false ;
95+ props . shouldExpandNode ( props . keyPath , props . data , props . level ) : false ;
9696 this . state = {
9797 expanded,
9898 createdChildNodes : false ,
@@ -134,6 +134,8 @@ export default class JSONNestedNode extends React.Component {
134134 ) ;
135135 const stylingArgs = [ keyPath , nodeType , expanded , expandable ] ;
136136
137+ const onPressItemString = expandable ? this . handlePress : ( ) => { } ;
138+
137139 return hideRoot ? (
138140 < View { ...styling ( 'rootNode' , ...stylingArgs ) } >
139141 < View { ...styling ( 'rootNodeChildren' , ...stylingArgs ) } >
@@ -152,19 +154,21 @@ export default class JSONNestedNode extends React.Component {
152154 }
153155 < Text
154156 { ...styling ( [ 'label' , 'nestedNodeLabel' ] , ...stylingArgs ) }
155- onPress = { expandable && this . handlePress }
157+ onPress = { onPressItemString }
156158 >
157159 { labelRenderer ( ...stylingArgs ) }
158160 </ Text >
159161 < Text
160162 { ...styling ( 'nestedNodeItemString' , ...stylingArgs ) }
161- onPress = { expandable && this . handlePress }
163+ onPress = { onPressItemString }
162164 >
163165 { renderedItemString }
164166 </ Text >
165- < View { ...styling ( 'nestedNodeChildren' , ...stylingArgs ) } >
166- { renderedChildren }
167- </ View >
167+ { expanded ?
168+ < View { ...styling ( 'nestedNodeChildren' , ...stylingArgs ) } >
169+ { renderedChildren }
170+ </ View > :
171+ null }
168172 </ View >
169173 ) ;
170174 }
0 commit comments