File tree Expand file tree Collapse file tree 3 files changed +7
-26
lines changed
packages/react-native-renderer/src Expand file tree Collapse file tree 3 files changed +7
-26
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ injectIntoDevTools({
137
137
version : ReactVersion ,
138
138
rendererPackageName : 'react-native-renderer' ,
139
139
rendererConfig : {
140
+ getInspectorDataForInstance,
140
141
getInspectorDataForViewTag : getInspectorDataForViewTag ,
141
142
getInspectorDataForViewAtPoint : getInspectorDataForViewAtPoint . bind (
142
143
null ,
Original file line number Diff line number Diff line change @@ -117,9 +117,11 @@ function getInspectorDataForInstance(
117
117
selectedIndex,
118
118
source,
119
119
} ;
120
- } else {
121
- return ( null : any ) ;
122
120
}
121
+
122
+ throw new Error (
123
+ 'getInspectorDataForInstance() is not available in production' ,
124
+ ) ;
123
125
}
124
126
125
127
function getOwnerHierarchy ( instance : any ) {
@@ -157,30 +159,7 @@ function getInspectorDataForViewTag(viewTag: number): Object {
157
159
if ( __DEV__ ) {
158
160
const closestInstance = getClosestInstanceFromNode ( viewTag ) ;
159
161
160
- // Handle case where user clicks outside of ReactNative
161
- if ( ! closestInstance ) {
162
- return {
163
- hierarchy : [ ] ,
164
- props : emptyObject ,
165
- selectedIndex : null ,
166
- source : null ,
167
- } ;
168
- }
169
-
170
- const fiber = findCurrentFiberUsingSlowPath ( closestInstance ) ;
171
- const fiberHierarchy = getOwnerHierarchy ( fiber ) ;
172
- const instance = lastNonHostInstance ( fiberHierarchy ) ;
173
- const hierarchy = createHierarchy ( fiberHierarchy ) ;
174
- const props = getHostProps ( instance ) ;
175
- const source = instance . _debugSource ;
176
- const selectedIndex = fiberHierarchy . indexOf ( instance ) ;
177
-
178
- return {
179
- hierarchy,
180
- props,
181
- selectedIndex,
182
- source,
183
- } ;
162
+ return getInspectorDataForInstance ( closestInstance ) ;
184
163
} else {
185
164
throw new Error (
186
165
'getInspectorDataForViewTag() is not available in production' ,
Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ injectIntoDevTools({
145
145
version : ReactVersion ,
146
146
rendererPackageName : 'react-native-renderer' ,
147
147
rendererConfig : {
148
+ getInspectorDataForInstance,
148
149
getInspectorDataForViewTag : getInspectorDataForViewTag ,
149
150
getInspectorDataForViewAtPoint : getInspectorDataForViewAtPoint . bind (
150
151
null ,
You can’t perform that action at this time.
0 commit comments