feat(mobile): PinInput component — 6-digit numeric pad
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Vitest cannot transform React Native's Flow-typed source. We monkey-patch
|
||||
// Node's CommonJS resolver so every bare `react-native` request returns our
|
||||
// minimal host-component shim. This file is referenced by `setupFiles` in
|
||||
// vitest.config.ts and runs before any test file imports execute.
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const Module = require('node:module');
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
const shimPath = path.join(here, 'vitest.rn-shim.ts');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const originalResolve = (Module as any)._resolveFilename;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(Module as any)._resolveFilename = function patched(
|
||||
request: string,
|
||||
parent: unknown,
|
||||
...rest: unknown[]
|
||||
): string {
|
||||
if (request === 'react-native' || request.startsWith('react-native/')) {
|
||||
return shimPath;
|
||||
}
|
||||
return originalResolve.call(this, request, parent, ...rest);
|
||||
};
|
||||
Reference in New Issue
Block a user