Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@

'use strict';

import type {
ReactNativeBaseComponentViewConfig,
ViewConfigGetter,
} from './ReactNativeTypes';

const invariant = require('invariant');
import {type ViewConfig} from './ReactNativeTypes';
import invariant from 'invariant';

// Event configs
const customBubblingEventTypes: {
Expand All @@ -42,9 +38,7 @@ exports.customDirectEventTypes = customDirectEventTypes;
const viewConfigCallbacks = new Map();
const viewConfigs = new Map();

function processEventTypes(
viewConfig: ReactNativeBaseComponentViewConfig<>,
): void {
function processEventTypes(viewConfig: ViewConfig): void {
const {bubblingEventTypes, directEventTypes} = viewConfig;

if (__DEV__) {
Expand Down Expand Up @@ -82,7 +76,7 @@ function processEventTypes(
* A callback is provided to load the view config from UIManager.
* The callback is deferred until the view is actually rendered.
*/
exports.register = function(name: string, callback: ViewConfigGetter): string {
exports.register = function(name: string, callback: () => ViewConfig): string {
invariant(
!viewConfigCallbacks.has(name),
'Tried to register two views with the same name %s',
Expand All @@ -103,7 +97,7 @@ exports.register = function(name: string, callback: ViewConfigGetter): string {
* If this is the first time the view has been used,
* This configuration will be lazy-loaded from UIManager.
*/
exports.get = function(name: string): ReactNativeBaseComponentViewConfig<> {
exports.get = function(name: string): ViewConfig {
let viewConfig;
if (!viewConfigs.has(name)) {
const callback = viewConfigCallbacks.get(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
'use strict';

import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';

import type {ViewConfigGetter} from './ReactNativeTypes';
import {type ViewConfig} from './ReactNativeTypes';

const {register} = ReactNativeViewConfigRegistry;

Expand All @@ -26,7 +25,7 @@ const {register} = ReactNativeViewConfigRegistry;
*/
const createReactNativeComponentClass = function(
name: string,
callback: ViewConfigGetter,
callback: () => ViewConfig,
): string {
return register(name, callback);
};
Expand Down