mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52129 This remove all the usages of SafeAreaView from RNTester. The problem is that we introduced a warning that SafEAreaView is deprecated and, therefore, we had a warning in debug mode. This was causing a yellow bubble to appear and the OSS E2E test started failing. ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D76978227 fbshipit-source-id: c45a31bae1602bc307e4fbbd71e7987a8ed78858
129 lines
2.7 KiB
JavaScript
129 lines
2.7 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
|
|
* @format
|
|
*/
|
|
|
|
import RNTesterDocumentationURL from './RNTesterDocumentationURL';
|
|
import {type RNTesterTheme} from './RNTesterTheme';
|
|
import * as React from 'react';
|
|
import {Platform, StyleSheet, Text, View} from 'react-native';
|
|
|
|
const HeaderIOS = ({
|
|
children,
|
|
title,
|
|
documentationURL,
|
|
theme,
|
|
}: {
|
|
children?: React.Node,
|
|
title: string,
|
|
documentationURL?: string,
|
|
theme: RNTesterTheme,
|
|
}) => {
|
|
return (
|
|
<View
|
|
style={[styles.header, {backgroundColor: theme.SystemBackgroundColor}]}>
|
|
<View style={styles.headerCenter}>
|
|
<Text style={{...styles.title, color: theme.LabelColor}}>{title}</Text>
|
|
{documentationURL && (
|
|
<RNTesterDocumentationURL documentationURL={documentationURL} />
|
|
)}
|
|
</View>
|
|
{children != null && <View>{children}</View>}
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const HeaderAndroid = ({
|
|
children,
|
|
title,
|
|
documentationURL,
|
|
theme,
|
|
}: {
|
|
children?: React.Node,
|
|
title: string,
|
|
documentationURL?: string,
|
|
theme: RNTesterTheme,
|
|
}) => {
|
|
return (
|
|
<View style={[styles.toolbar, {backgroundColor: theme.BackgroundColor}]}>
|
|
<View style={styles.toolbarCenter}>
|
|
<Text style={[styles.title, {color: theme.LabelColor}]}>{title}</Text>
|
|
{documentationURL && (
|
|
<RNTesterDocumentationURL documentationURL={documentationURL} />
|
|
)}
|
|
</View>
|
|
{children != null && <View>{children}</View>}
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default function RNTTitleBar({
|
|
children,
|
|
title,
|
|
documentationURL,
|
|
theme,
|
|
}: {
|
|
children?: React.Node,
|
|
title: string,
|
|
documentationURL?: string,
|
|
theme: RNTesterTheme,
|
|
...
|
|
}): React.Node {
|
|
return Platform.OS === 'ios' ? (
|
|
<HeaderIOS
|
|
documentationURL={documentationURL}
|
|
title={title}
|
|
children={children}
|
|
theme={theme}
|
|
/>
|
|
) : (
|
|
<HeaderAndroid
|
|
documentationURL={documentationURL}
|
|
title={title}
|
|
children={children}
|
|
theme={theme}
|
|
/>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
headerContainer: {
|
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
},
|
|
header: {
|
|
height: 40,
|
|
flexDirection: 'row',
|
|
marginTop: Platform.OS === 'ios' ? 50 : 0,
|
|
},
|
|
headerCenter: {
|
|
flex: 1,
|
|
position: 'absolute',
|
|
top: 7,
|
|
left: 0,
|
|
right: 0,
|
|
alignItems: 'center',
|
|
},
|
|
title: {
|
|
fontSize: 19,
|
|
fontWeight: '600',
|
|
textAlign: 'center',
|
|
},
|
|
toolbar: {
|
|
height: 56,
|
|
flexDirection: 'row',
|
|
},
|
|
toolbarCenter: {
|
|
flex: 1,
|
|
position: 'absolute',
|
|
top: 12,
|
|
left: 0,
|
|
right: 0,
|
|
alignItems: 'center',
|
|
},
|
|
});
|