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

Fix map preview not extended to full view #28922

Merged
merged 14 commits into from
Oct 19, 2023
2 changes: 1 addition & 1 deletion src/components/ConfirmedRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function ConfirmedRoute({mapboxAccessToken, transaction}) {
location: lodashGet(waypointMarkers, [0, 'coordinate'], CONST.MAPBOX.DEFAULT_COORDINATE),
}}
directionCoordinates={coordinates}
style={styles.mapView}
style={[styles.mapView, styles.br4]}
waypoints={waypointMarkers}
styleURL={CONST.MAPBOX.STYLE_URL}
/>
Expand Down
5 changes: 3 additions & 2 deletions src/components/DistanceRequest/DistanceRequestFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,16 @@ function DistanceRequestFooter({waypoints, transaction, mapboxAccessToken, navig
location: CONST.MAPBOX.DEFAULT_COORDINATE,
}}
directionCoordinates={lodashGet(transaction, 'routes.route0.geometry.coordinates', [])}
style={styles.mapView}
style={[styles.mapView, styles.mapEditView]}
waypoints={waypointMarkers}
styleURL={CONST.MAPBOX.STYLE_URL}
overlayStyle={styles.m4}
overlayStyle={styles.mapEditView}
/>
) : (
<PendingMapView
title={translate('distance.mapPending.title')}
subtitle={isOffline ? translate('distance.mapPending.subtitle') : translate('distance.mapPending.onlineSubtitle')}
style={styles.mapEditView}
/>
)}
</View>
Expand Down
3 changes: 0 additions & 3 deletions src/components/DistanceRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,4 @@ export default withOnyx({
transaction: {
key: ({transactionID}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID || 0}`,
},
mapboxAccessToken: {
key: ONYXKEYS.MAPBOX_ACCESS_TOKEN,
},
Comment on lines -279 to -281
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a cleanup change, discussed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

})(DistanceRequest);
4 changes: 4 additions & 0 deletions src/components/DraggableList/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import React from 'react';
import DraggableFlatList from 'react-native-draggable-flatlist';
import {FlatList} from 'react-native-gesture-handler';
import type {DraggableListProps} from './types';
import styles from '../../styles/styles';

function DraggableList<T>({renderClone, shouldUsePortal, ...viewProps}: DraggableListProps<T>, ref: React.ForwardedRef<FlatList<T>>) {
return (
<DraggableFlatList
ref={ref}
containerStyle={styles.flex1}
contentContainerStyle={styles.flexGrow1}
ListFooterComponentStyle={styles.flex1}
// eslint-disable-next-line react/jsx-props-no-spreading
{...viewProps}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/DraggableList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function DraggableList<T>(
<ScrollView
ref={ref}
style={styles.flex1}
contentContainerStyle={styles.flex1}
>
<DragDropContext onDragEnd={onDragEnd}>
<Droppable
Expand Down
3 changes: 3 additions & 0 deletions src/components/MapView/MapViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type PendingMapViewProps = {

/** Subtitle message below the title */
subtitle?: string;

/** Style applied to PendingMapView */
style?: StyleProp<ViewStyle>;
};

// Initial state of the map
Expand Down
4 changes: 2 additions & 2 deletions src/components/MapView/PendingMapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {PendingMapViewProps} from './MapViewTypes';
import BlockingView from '../BlockingViews/BlockingView';
import * as Expensicons from '../Icon/Expensicons';

function PendingMapView({title = '', subtitle = ''}: PendingMapViewProps) {
function PendingMapView({title = '', subtitle = '', style}: PendingMapViewProps) {
const hasTextContent = !_.isEmpty(title) || !_.isEmpty(subtitle);

return (
<View style={[styles.mapPendingView]}>
<View style={[styles.mapPendingView, style]}>
{hasTextContent ? (
<BlockingView
icon={Expensicons.EmptyStateRoutePending}
Expand Down
17 changes: 12 additions & 5 deletions src/styles/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import overflow from './utilities/overflow';
import positioning from './utilities/positioning';
import sizing from './utilities/sizing';
import spacing from './utilities/spacing';
import borders from './utilities/borders';
import textUnderline from './utilities/textUnderline';
import userSelect from './utilities/userSelect';
import visibility from './utilities/visibility';
Expand Down Expand Up @@ -213,6 +214,7 @@ const styles = (theme: ThemeDefault) =>
({
// Add all of our utility and helper styles
...spacing,
...borders,
...sizing,
...flex,
...display,
Expand Down Expand Up @@ -833,9 +835,9 @@ const styles = (theme: ThemeDefault) =>
cameraView: {
flex: 1,
overflow: 'hidden',
borderRadius: 28,
borderRadius: variables.componentBorderRadiusXLarge,
borderStyle: 'solid',
borderWidth: 8,
borderWidth: variables.componentBorderWidth,
backgroundColor: theme.highlightBG,
borderColor: theme.appBG,
display: 'flex',
Expand Down Expand Up @@ -3832,15 +3834,20 @@ const styles = (theme: ThemeDefault) =>

mapViewContainer: {
...flex.flex1,
...spacing.p4,
minHeight: 300,
maxHeight: 500,
},

mapView: {
flex: 1,
borderRadius: 16,
...flex.flex1,
overflow: 'hidden',
backgroundColor: theme.highlightBG,
},

mapEditView: {
borderRadius: variables.componentBorderRadiusXLarge,
borderWidth: variables.componentBorderWidth,
borderColor: theme.appBG,
},

mapViewOverlay: {
Expand Down
18 changes: 18 additions & 0 deletions src/styles/utilities/borders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {ViewStyle} from 'react-native';

/**
* All styles should be incremented by units of 4.
*/
export default {
br0: {
borderRadius: 0,
},

br2: {
borderRadius: 8,
},

br4: {
borderRadius: 16,
},
} satisfies Record<string, ViewStyle>;
2 changes: 2 additions & 0 deletions src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export default {
componentBorderRadiusMedium: 6,
componentBorderRadiusNormal: 8,
componentBorderRadiusLarge: 16,
componentBorderRadiusXLarge: 28,
componentBorderRadiusCard: 20,
componentBorderRadiusRounded: 24,
componentBorderWidth: 8,
appModalAppIconSize: 48,
buttonBorderRadius: 100,
avatarSizeLargeBordered: 88,
Expand Down
Loading