Migrate rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js to function components (#48695)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48695

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152232

fbshipit-source-id: 918236f8c9789efab9cc43b85e53fa398909808c
This commit is contained in:
Fabrizio Cucci
2025-01-15 06:11:21 -08:00
committed by Facebook GitHub Bot
parent 00d272fb3b
commit c33954c80d
@@ -12,15 +12,15 @@
import type {ExtendedError} from 'react-native/Libraries/Core/ExtendedError';
const React = require('react');
const ReactNative = require('react-native');
const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
const {View} = ReactNative;
import * as React from 'react';
import {useEffect} from 'react';
import {NativeModules, View} from 'react-native';
import parseErrorStack from 'react-native/Libraries/Core/Devtools/parseErrorStack';
const {TestModule} = ReactNative.NativeModules;
const {TestModule} = NativeModules;
class GlobalEvalWithSourceUrlTest extends React.Component<{...}> {
componentDidMount(): void {
function GlobalEvalWithSourceUrlTest(): React.Node {
useEffect(() => {
if (typeof global.globalEvalWithSourceUrl !== 'function') {
throw new Error(
'Expected to find globalEvalWithSourceUrl function on global object but found ' +
@@ -75,13 +75,9 @@ class GlobalEvalWithSourceUrlTest extends React.Component<{...}> {
);
}
TestModule.markTestCompleted();
}
}, []);
render(): React.Node {
return <View />;
}
return <View />;
}
GlobalEvalWithSourceUrlTest.displayName = 'GlobalEvalWithSourceUrlTest';
module.exports = GlobalEvalWithSourceUrlTest;
export default GlobalEvalWithSourceUrlTest;