99
1010'use strict' ;
1111
12- import type {
13- ReactNativeBaseComponentViewConfig ,
14- ViewConfigGetter ,
15- } from './ReactNativeTypes' ;
12+ import { type ViewConfig } from './ReactNativeTypes' ;
1613
1714// Event configs
18- const customBubblingEventTypes = { } ;
19- const customDirectEventTypes = { } ;
20- const eventTypes = { } ;
21-
22- exports . customBubblingEventTypes = customBubblingEventTypes ;
23- exports . customDirectEventTypes = customDirectEventTypes ;
24- exports . eventTypes = eventTypes ;
15+ export const customBubblingEventTypes = { } ;
16+ export const customDirectEventTypes = { } ;
2517
2618const viewConfigCallbacks = new Map ( ) ;
2719const viewConfigs = new Map ( ) ;
2820
29- function processEventTypes (
30- viewConfig : ReactNativeBaseComponentViewConfig < > ,
31- ) : void {
21+ function processEventTypes ( viewConfig : ViewConfig ) : void {
3222 const { bubblingEventTypes, directEventTypes} = viewConfig ;
3323
3424 if ( __DEV__ ) {
@@ -46,7 +36,7 @@ function processEventTypes(
4636 if ( bubblingEventTypes != null ) {
4737 for ( const topLevelType in bubblingEventTypes ) {
4838 if ( customBubblingEventTypes [ topLevelType ] == null ) {
49- eventTypes [ topLevelType ] = customBubblingEventTypes [ topLevelType ] =
39+ customBubblingEventTypes [ topLevelType ] =
5040 bubblingEventTypes [ topLevelType ] ;
5141 }
5242 }
@@ -55,8 +45,7 @@ function processEventTypes(
5545 if ( directEventTypes != null ) {
5646 for ( const topLevelType in directEventTypes ) {
5747 if ( customDirectEventTypes [ topLevelType ] == null ) {
58- eventTypes [ topLevelType ] = customDirectEventTypes [ topLevelType ] =
59- directEventTypes [ topLevelType ] ;
48+ customDirectEventTypes [ topLevelType ] = directEventTypes [ topLevelType ] ;
6049 }
6150 }
6251 }
@@ -66,9 +55,8 @@ function processEventTypes(
6655 * Registers a native view/component by name.
6756 * A callback is provided to load the view config from UIManager.
6857 * The callback is deferred until the view is actually rendered.
69- * This is done to avoid causing Prepack deopts.
7058 */
71- exports . register = function ( name : string , callback : ViewConfigGetter ) : string {
59+ export function register ( name : string , callback : ( ) = > ViewConfig ) : string {
7260 if ( viewConfigCallbacks . has ( name ) ) {
7361 throw new Error ( `Tried to register two views with the same name ${ name } ` ) ;
7462 }
@@ -83,14 +71,14 @@ exports.register = function (name: string, callback: ViewConfigGetter): string {
8371
8472 viewConfigCallbacks . set ( name , callback ) ;
8573 return name ;
86- } ;
74+ }
8775
8876/**
8977 * Retrieves a config for the specified view.
9078 * If this is the first time the view has been used,
9179 * This configuration will be lazy-loaded from UIManager.
9280 */
93- exports . get = function ( name : string ) : ReactNativeBaseComponentViewConfig < > {
81+ export function get ( name : string ) : ViewConfig {
9482 let viewConfig ;
9583 if ( ! viewConfigs . has ( name ) ) {
9684 const callback = viewConfigCallbacks . get ( name ) ;
@@ -121,4 +109,4 @@ exports.get = function (name: string): ReactNativeBaseComponentViewConfig<> {
121109 }
122110
123111 return viewConfig ;
124- } ;
112+ }
0 commit comments