File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,14 @@ export default class NodeView extends React.PureComponent {
1818 }
1919
2020 onNodePressed = ( node : any ) => {
21- const newState = rootChildren = this . state . data . map ( ( child , index ) => {
22- return this . props . searchTree ( this . state . data [ index ] , node )
23- } )
24-
25- this . setState ( { data : newState } )
21+ if ( this . state . data ) {
22+ const newState = rootChildren = this . state . data . map ( ( child , index ) => {
23+ return this . props . searchTree ( this . state . data [ index ] , node )
24+ } )
25+
26+ this . setState ( { data : newState } )
27+ }
28+
2629 this . props . onNodePressed ( node )
2730 }
2831
@@ -32,7 +35,7 @@ export default class NodeView extends React.PureComponent {
3235
3336 return (
3437 < View onLayout = { onLayout } >
35- < TouchableOpacity onPress = { ( ) => onNodePressed ( node ) } >
38+ < TouchableOpacity onPress = { ( ) => this . onNodePressed ( node ) } >
3639 { renderNode ( ) }
3740 </ TouchableOpacity >
3841 { node . opened && this . state . data
You can’t perform that action at this time.
0 commit comments