Files
react-native/packages/helloworld/App.tsx
Alex HuntandFacebook GitHub Bot c937439e87 Add a basic Jest test to helloworld (#51534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51534

Aims to give us CI coverage of React Native's Jest preset, preventing future bugs like https://github.com/facebook/react-native/pull/51525.

Changes:
- Add a basic "it renders" Jest test to helloworld
- Add "Run Helloworld tests" step to `test-ios-helloworld` job in CI
- Also convert helloworld's `App.tsx` to TypeScript, as easiest way to unblock Jest JSX behaviour.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D75218901

fbshipit-source-id: 601155c59c4483696971df4c29d51549d97f49f2
2025-05-22 09:44:15 -07:00

44 lines
870 B
TypeScript

/**
* 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.
*
* @format
*/
import * as React from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
View,
useColorScheme,
} from 'react-native';
function App(): React.ReactNode {
const isDarkMode = useColorScheme() === 'dark';
return (
<SafeAreaView>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<ScrollView contentInsetAdjustmentBehavior="automatic">
<View>
<Text style={styles.title}>Hello, World!</Text>
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
title: {
fontSize: 24,
fontWeight: '600',
},
});
export default App;