File tree Expand file tree Collapse file tree 4 files changed +26
-5
lines changed 
packages/react-native-renderer/src Expand file tree Collapse file tree 4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import type {
1313  MeasureInWindowOnSuccessCallback , 
1414  MeasureLayoutOnSuccessCallback , 
1515  MeasureOnSuccessCallback , 
16-   NativeMethods , 
16+   INativeMethods , 
1717  ViewConfig , 
1818  TouchedViewDataAtPoint , 
1919}  from  './ReactNativeTypes' ; 
@@ -109,7 +109,7 @@ const noop = () => {};
109109/** 
110110 * This is used for refs on host components. 
111111 */ 
112- class  ReactFabricHostComponent  implements  NativeMethods  { 
112+ class  ReactFabricHostComponent  implements  INativeMethods  { 
113113  _nativeTag : number ; 
114114  viewConfig : ViewConfig ; 
115115  currentProps : Props ; 
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import type {
1313  MeasureInWindowOnSuccessCallback , 
1414  MeasureLayoutOnSuccessCallback , 
1515  MeasureOnSuccessCallback , 
16-   NativeMethods , 
16+   INativeMethods , 
1717  ViewConfig , 
1818}  from  './ReactNativeTypes' ; 
1919import  type  { Instance }  from  './ReactNativeHostConfig' ; 
@@ -30,7 +30,7 @@ import {
3030  warnForStyleProps , 
3131}  from  './NativeMethodsMixinUtils' ; 
3232
33- class  ReactNativeFiberHostComponent  implements  NativeMethods  { 
33+ class  ReactNativeFiberHostComponent  implements  INativeMethods  { 
3434  _children : Array < Instance  |  number > ; 
3535  _nativeTag : number ; 
3636  _internalFiberInstanceHandleDEV : Object ; 
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
6868    hostInstance  =  findHostInstance ( componentOrHandle ) ; 
6969  } 
7070
71+   // $FlowFixMe[incompatible-exact] we need to fix the definition of `HostComponent` to use NativeMethods as an interface, not as a type. 
7172  return  hostInstance ; 
7273} 
7374
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ export type PartialViewConfig = $ReadOnly<{
9595  validAttributes ?: PartialAttributeConfiguration , 
9696} > ; 
9797
98- export  interface  NativeMethods  { 
98+ /** 
99+  * Current usages should migrate to this definition 
100+  */ 
101+ export  interface  INativeMethods  { 
99102  blur ( ) : void ; 
100103  focus ( ) : void ; 
101104  measure ( callback : MeasureOnSuccessCallback ) : void ; 
@@ -108,6 +111,23 @@ export interface NativeMethods {
108111  setNativeProps ( nativeProps  : { ...} ) : void ; 
109112} 
110113
114+ export  type  NativeMethods  =  $ReadOnly < { | 
115+   blur ( ) : void , 
116+   focus ( ) : void , 
117+   measure ( callback : MeasureOnSuccessCallback ) : void , 
118+   measureInWindow ( callback : MeasureInWindowOnSuccessCallback ) : void , 
119+   measureLayout ( 
120+     relativeToNativeNode : number  |  ElementRef < HostComponent < mixed >> , 
121+     onSuccess : MeasureLayoutOnSuccessCallback , 
122+     onFail ?: ( )  =>  void , 
123+   ) : void , 
124+   setNativeProps ( nativeProps  : { ...} ) : void , 
125+ | } > ; 
126+ 
127+ // This validates that INativeMethods and NativeMethods stay in sync using Flow! 
128+ declare  var  ensureNativeMethodsAreSynced : NativeMethods ; 
129+ ( ensureNativeMethodsAreSynced : INativeMethods ) ; 
130+ 
111131export  type  HostComponent < T >  =  AbstractComponent < T ,  $ReadOnly < NativeMethods >> ; 
112132
113133type  SecretInternalsType  =  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments