logbox footer buttons fix safearea (#36427)

Summary:
The logbox buttons on iOS are not easy to reach since they draw in the safe area. This pr should fix that.

## Changelog

[IOS] [FIXED] - logbox footer buttons respect safe area

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

Test Plan:
| after  | before  |
|---|---|
| ![IMG_3296](https://user-images.githubusercontent.com/3705499/224150030-b2637977-9fbc-4a5e-9efb-86a42a62b31a.PNG) | ![IMG_9BF70BD03E1B-1](https://user-images.githubusercontent.com/3705499/224150681-dc84295b-134a-4840-9773-23c601b24e01.jpeg)

Reviewed By: NickGerleman

Differential Revision: D43957242

Pulled By: javache

fbshipit-source-id: 9d26bc52b45c110f7bc3b0d6c1da1ed2d31a154c
This commit is contained in:
Philip Heinser
2023-05-17 02:48:29 -07:00
committed by Facebook GitHub Bot
parent a3102175c5
commit 6d6b1fdc75
@@ -10,10 +10,10 @@
import type {LogLevel} from '../Data/LogBoxLog';
import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
import View from '../../Components/View/View';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Text from '../../Text/Text';
import DeviceInfo from '../../Utilities/DeviceInfo';
import LogBoxButton from './LogBoxButton';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
@@ -52,39 +52,21 @@ type ButtonProps = $ReadOnly<{|
function FooterButton(props: ButtonProps): React.Node {
return (
<LogBoxButton
backgroundColor={{
default: 'transparent',
pressed: LogBoxStyle.getBackgroundDarkColor(),
}}
onPress={props.onPress}
style={buttonStyles.safeArea}>
<View style={buttonStyles.content}>
<Text style={buttonStyles.label}>{props.text}</Text>
</View>
</LogBoxButton>
<SafeAreaView style={styles.button}>
<LogBoxButton
backgroundColor={{
default: 'transparent',
pressed: LogBoxStyle.getBackgroundDarkColor(),
}}
onPress={props.onPress}>
<View style={styles.buttonContent}>
<Text style={styles.buttonLabel}>{props.text}</Text>
</View>
</LogBoxButton>
</SafeAreaView>
);
}
const buttonStyles = StyleSheet.create({
safeArea: {
flex: 1,
// $FlowFixMe[sketchy-null-bool]
paddingBottom: DeviceInfo.getConstants().isIPhoneX_deprecated ? 30 : 0,
},
content: {
alignItems: 'center',
height: 48,
justifyContent: 'center',
},
label: {
color: LogBoxStyle.getTextColor(1),
fontSize: 14,
includeFontPadding: false,
lineHeight: 20,
},
});
const styles = StyleSheet.create({
root: {
backgroundColor: LogBoxStyle.getBackgroundColor(1),
@@ -97,6 +79,17 @@ const styles = StyleSheet.create({
button: {
flex: 1,
},
buttonContent: {
alignItems: 'center',
height: 48,
justifyContent: 'center',
},
buttonLabel: {
color: LogBoxStyle.getTextColor(1),
fontSize: 14,
includeFontPadding: false,
lineHeight: 20,
},
syntaxErrorText: {
textAlign: 'center',
width: '100%',