Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] Add SafeAreaView to Help & Support view #35570

Merged
merged 1 commit into from
Oct 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 116 additions & 110 deletions packages/editor/src/components/editor-help/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { kebabCase } from 'lodash';
import { Text, ScrollView, StyleSheet, View } from 'react-native';
import { Text, SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
import { TransitionPresets } from '@react-navigation/stack';

/**
Expand Down Expand Up @@ -86,119 +86,125 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
contentStyle={ styles.contentContainer }
testID="editor-help-modal"
>
<BottomSheet.NavigationContainer
animate
main
style={ styles.navigationContainer }
>
<BottomSheet.NavigationScreen
isScrollable
fullScreen
name="help-topics"
<SafeAreaView>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiding whitespace changes may make this review a little simpler.

<BottomSheet.NavigationContainer
animate
main
style={ styles.navigationContainer }
>
<View style={ styles.container }>
<BottomSheet.NavBar>
<BottomSheet.NavBar.DismissButton
onPress={ close }
iosText={ __( 'Close' ) }
/>
<BottomSheet.NavBar.Heading>
{ title }
</BottomSheet.NavBar.Heading>
</BottomSheet.NavBar>
<BottomSheetConsumer>
{ ( { listProps } ) => {
const contentContainerStyle = StyleSheet.flatten(
listProps.contentContainerStyle
);
return (
<ScrollView
{ ...listProps }
contentContainerStyle={ {
...contentContainerStyle,
paddingBottom: Math.max(
listProps.safeAreaBottomInset,
contentContainerStyle.paddingBottom
),
/**
* Remove margin set via `hideHeader`. Combining a header
* and navigation in this bottom sheet is at odds with the
* current `BottomSheet` implementation.
*/
marginTop: 0,
} }
>
<PanelBody>
<Text style={ sectionTitle }>
{ __( 'The basics' ) }
</Text>
{ /* Print out help topics */ }
{ HELP_TOPICS.map(
( { label, icon } ) => {
const labelSlug = kebabCase(
label
);
return (
<HelpTopicRow
key={ labelSlug }
label={ label }
icon={ icon }
screenName={
labelSlug
}
/>
);
}
) }
{
<BottomSheet.NavigationScreen
isScrollable
fullScreen
name="help-topics"
>
<View style={ styles.container }>
<BottomSheet.NavBar>
<BottomSheet.NavBar.DismissButton
onPress={ close }
iosText={ __( 'Close' ) }
/>
<BottomSheet.NavBar.Heading>
{ title }
</BottomSheet.NavBar.Heading>
</BottomSheet.NavBar>
<BottomSheetConsumer>
{ ( { listProps } ) => {
const contentContainerStyle = StyleSheet.flatten(
listProps.contentContainerStyle
);
return (
<ScrollView
{ ...listProps }
contentContainerStyle={ {
...contentContainerStyle,
paddingBottom: Math.max(
listProps.safeAreaBottomInset,
contentContainerStyle.paddingBottom
),
/**
* Remove margin set via `hideHeader`. Combining a header
* and navigation in this bottom sheet is at odds with the
* current `BottomSheet` implementation.
*/
marginTop: 0,
} }
>
<PanelBody>
<Text style={ sectionTitle }>
{ __( 'Get support' ) }
{ __( 'The basics' ) }
</Text>
}
{
<HelpGetSupportButton
title={ __(
'Contact support'
) }
onPress={
requestContactCustomerSupport
{ /* Print out help topics */ }
{ HELP_TOPICS.map(
( { label, icon } ) => {
const labelSlug = kebabCase(
label
);
return (
<HelpTopicRow
key={
labelSlug
}
label={ label }
icon={ icon }
screenName={
labelSlug
}
/>
);
}
/>
}
{
<HelpGetSupportButton
title={ __(
'More support options'
) }
onPress={
requestGotoCustomerSupportOptions
}
/>
}
</PanelBody>
</ScrollView>
);
} }
</BottomSheetConsumer>
</View>
</BottomSheet.NavigationScreen>
{ /* Print out help detail screens */ }
{ HELP_TOPICS.map( ( { view, label } ) => {
const labelSlug = kebabCase( label );
return (
<HelpDetailNavigationScreen
key={ labelSlug }
name={ labelSlug }
content={ view }
label={ label }
options={ {
gestureEnabled: true,
...TransitionPresets.DefaultTransition,
} }
/>
);
} ) }
</BottomSheet.NavigationContainer>
) }
{
<Text
style={ sectionTitle }
>
{ __( 'Get support' ) }
</Text>
}
{
<HelpGetSupportButton
title={ __(
'Contact support'
) }
onPress={
requestContactCustomerSupport
}
/>
}
{
<HelpGetSupportButton
title={ __(
'More support options'
) }
onPress={
requestGotoCustomerSupportOptions
}
/>
}
</PanelBody>
</ScrollView>
);
} }
</BottomSheetConsumer>
</View>
</BottomSheet.NavigationScreen>
{ /* Print out help detail screens */ }
{ HELP_TOPICS.map( ( { view, label } ) => {
const labelSlug = kebabCase( label );
return (
<HelpDetailNavigationScreen
key={ labelSlug }
name={ labelSlug }
content={ view }
label={ label }
options={ {
gestureEnabled: true,
...TransitionPresets.DefaultTransition,
} }
/>
);
} ) }
</BottomSheet.NavigationContainer>
</SafeAreaView>
</BottomSheet>
);
}
Expand Down