File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
packages/react-native-renderer/src Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import {
40
40
sendAccessibilityEvent ,
41
41
getNodeFromInternalInstanceHandle ,
42
42
} from './ReactNativePublicCompat' ;
43
+ import { getPublicInstanceFromInternalInstanceHandle } from './ReactFabricHostConfig' ;
43
44
44
45
// $FlowFixMe[missing-local-annot]
45
46
function onRecoverableError ( error ) {
@@ -124,6 +125,10 @@ export {
124
125
// This method allows it to acess the most recent shadow node for
125
126
// the instance (it's only accessible through it).
126
127
getNodeFromInternalInstanceHandle ,
128
+ // Fabric native methods to traverse the host tree return the same internal
129
+ // instance handles we use to dispatch events. This provides a way to access
130
+ // the public instances we created from them (potentially created lazily).
131
+ getPublicInstanceFromInternalInstanceHandle ,
127
132
} ;
128
133
129
134
injectIntoDevTools ( {
Original file line number Diff line number Diff line change @@ -241,6 +241,13 @@ export function getPublicInstance(instance: Instance): null | PublicInstance {
241
241
return null ;
242
242
}
243
243
244
+ export function getPublicInstanceFromInternalInstanceHandle (
245
+ internalInstanceHandle : Object ,
246
+ ) : null | PublicInstance {
247
+ const instance : Instance = internalInstanceHandle . stateNode ;
248
+ return getPublicInstance ( instance ) ;
249
+ }
250
+
244
251
export function prepareForCommit ( containerInfo : Container ) : null | Object {
245
252
// Noop
246
253
return null ;
Original file line number Diff line number Diff line change @@ -213,6 +213,8 @@ export type ReactNativeType = {
213
213
} ;
214
214
215
215
export opaque type Node = mixed ;
216
+ type InternalInstanceHandle = mixed ;
217
+ type PublicInstance = mixed ;
216
218
217
219
export type ReactFabricType = {
218
220
findHostInstance_DEPRECATED < TElementType : ElementType > (
@@ -237,7 +239,12 @@ export type ReactFabricType = {
237
239
concurrentRoot : ?boolean ,
238
240
) : ?ElementRef < ElementType > ,
239
241
unmountComponentAtNode ( containerTag : number ) : void ,
240
- getNodeFromInternalInstanceHandle ( internalInstanceHandle : mixed ) : ?Node ,
242
+ getNodeFromInternalInstanceHandle (
243
+ internalInstanceHandle : InternalInstanceHandle ,
244
+ ) : ?Node ,
245
+ getPublicInstanceFromInternalInstanceHandle (
246
+ internalInstanceHandle : InternalInstanceHandle ,
247
+ ) : PublicInstance ,
241
248
...
242
249
} ;
243
250
You can’t perform that action at this time.
0 commit comments