forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix Map Panning behavior * Add screen focus state props to MapView Added new props to avoid introducing unnecessary dependencies ('@react-navigation/native') to the 'react-native-x-maps' library. * feat: Move code from react-native-x-maps to the App * fix: rename mapbox consts * fix: Fix app crashing on waypoint delete * Remove unnecessary re exports * Fix react duplicate keys Expensify#35 * Fix Not Found Page appearing issue and add comment * Fix panning issue * fix: add PropTypes import which is mised during conflict resolution
- Loading branch information
1 parent
64c65ff
commit 065a6dd
Showing
14 changed files
with
413 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Mapbox from '@rnmapbox/maps'; | ||
import {DirectionProps} from './MapViewTypes'; | ||
import styles from '../../styles/styles'; | ||
|
||
function Direction({coordinates}: DirectionProps) { | ||
if (coordinates.length < 1) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Mapbox.ShapeSource | ||
id="routeSource" | ||
shape={{ | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: { | ||
type: 'LineString', | ||
coordinates, | ||
}, | ||
}} | ||
> | ||
<Mapbox.LineLayer | ||
id="routeFill" | ||
style={styles.mapDirection} | ||
/> | ||
</Mapbox.ShapeSource> | ||
); | ||
} | ||
|
||
export default Direction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Explanation: Different Mapbox libraries are required for web and native mobile platforms. | ||
// This is why we have separate components for web and native to handle the specific implementations. | ||
// For the web version, we use the Mapbox Web library called react-map-gl, while for the native mobile version, | ||
// we utilize a different Mapbox library @rnmapbox/maps tailored for mobile development. | ||
|
||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {Layer, Source} from 'react-map-gl'; | ||
import {DirectionProps} from './MapViewTypes'; | ||
|
||
import styles from '../../styles/styles'; | ||
|
||
function Direction({coordinates}: DirectionProps) { | ||
const layerLayoutStyle: Record<string, string> = styles.mapDirectionLayer.layout; | ||
const layerPointStyle: Record<string, string | number> = styles.mapDirectionLayer.paint; | ||
|
||
if (coordinates.length < 1) { | ||
return null; | ||
} | ||
return ( | ||
<View> | ||
{coordinates && ( | ||
<Source | ||
id="route" | ||
type="geojson" | ||
data={{ | ||
type: 'Feature', | ||
properties: {}, | ||
geometry: { | ||
type: 'LineString', | ||
coordinates, | ||
}, | ||
}} | ||
> | ||
<Layer | ||
id="route" | ||
type="line" | ||
source="route" | ||
paint={layerPointStyle} | ||
layout={layerLayoutStyle} | ||
/> | ||
</Source> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
export default Direction; |
Oops, something went wrong.