michangarrito/apps/backend/node_modules/react-native/jest/mockNativeComponent.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

53 lines
1.4 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
import type {HostInstance} from '../src/private/types/HostInstance';
import * as React from 'react';
import {createElement} from 'react';
let nativeTag = 1;
type MockNativeComponent<TProps: {...}> = component(
ref?: ?React.RefSetter<HostInstance>,
...props: TProps
);
export default function mockNativeComponent<TProps: {...}>(
viewName: string,
): MockNativeComponent<TProps> {
const Component = class extends React.Component<TProps> {
_nativeTag: number = nativeTag++;
render(): React.Node {
// $FlowFixMe[not-a-function]
// $FlowFixMe[prop-missing]
return createElement(viewName, this.props, this.props.children);
}
// The methods that exist on host components
blur: () => void = jest.fn();
focus: () => void = jest.fn();
measure: () => void = jest.fn();
measureInWindow: () => void = jest.fn();
measureLayout: () => void = jest.fn();
setNativeProps: () => void = jest.fn();
};
if (viewName === 'RCTView') {
Component.displayName = 'View';
} else {
Component.displayName = viewName;
}
// $FlowFixMe[incompatible-type] - Error supressed during the migration of HostInstance to ReactNativeElement
return Component;
}