<commit_before>// @flow
import * as React from 'react'
import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'
import * as c from './colors'
import {Button} from './button'
import {Heading} from './markdown/heading'

const styles = StyleSheet.create({
	container: {
		flex: 1,
		paddingHorizontal: 16,
		justifyContent: 'center',
		alignItems: 'center',
		backgroundColor: c.white,
	},
	text: {
		textAlign: 'center',
	},
	spinner: {
		alignItems: 'center',
		justifyContent: 'center',
		padding: 8,
	},
})

type Props = {
	header?: string,
	text?: string,
	style?: any,
	spinner?: boolean,
	buttonText?: string,
	onPress?: () => any,
}

export function NoticeView({
	header,
	text,
	style,
	spinner,
	buttonText,
	onPress,
}: Props) {
	return (
		<View style={[styles.container, style]}>
			{spinner ? <ActivityIndicator style={styles.spinner} /> : null}

			<Heading level={1}>{header}</Heading>

			<Text selectable={true} style={styles.text}>
				{text || 'Notice!'}
			</Text>

			{buttonText ? <Button onPress={onPress} title={buttonText} /> : null}
		</View>
	)
}<commit_msg>don't output the Header if there's no heading text<commit_after>// @flow
import * as React from 'react'
import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'
import * as c from './colors'
import {Button} from './button'
import {Heading} from './markdown/heading'

const styles = StyleSheet.create({
	container: {
		flex: 1,
		paddingHorizontal: 16,
		justifyContent: 'center',
		alignItems: 'center',
		backgroundColor: c.white,
	},
	text: {
		textAlign: 'center',
	},
	spinner: {
		alignItems: 'center',
		justifyContent: 'center',
		padding: 8,
	},
})

type Props = {
	header?: string,
	text?: string,
	style?: any,
	spinner?: boolean,
	buttonText?: string,
	onPress?: () => any,
}

export function NoticeView({
	header,
	text,
	style,
	spinner,
	buttonText,
	onPress,
}: Props) {
	return (
		<View style={[styles.container, style]}>
			{spinner ? <ActivityIndicator style={styles.spinner} /> : null}

			{header ? <Heading level={1}>{header}</Heading> : null}

			<Text selectable={true} style={styles.text}>
				{text || 'Notice!'}
			</Text>

			{buttonText ? <Button onPress={onPress} title={buttonText} /> : null}
		</View>
	)
}
{'fraction_non_alphanumeric': 0.16896398399288573, 'fraction_numerical': 0.004446420631391729, 'mean_word_length': 4.196304849884527, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4312221', 'n_tokens_mistral': 847, 'n_tokens_neox': 781, 'n_words': 204}