-
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.
🗺 Added & Implemented Device Location Screen
- Loading branch information
Showing
29 changed files
with
311 additions
and
10 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
rootProject.name = 'GPSLineRNDemo' | ||
apply from: '../node_modules/react-native-unimodules/gradle.groovy'; includeUnimodulesProjects() | ||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||
// include ':@react-native-mapbox-gl_maps' | ||
// project(':@react-native-mapbox-gl_maps').projectDir = new File(rootProject.projectDir, '../node_modules/mapir-mapbox/android/rctmgl') | ||
include ':app' |
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,102 @@ | ||
import { Button, Card, Icon, Text, View } from 'native-base'; | ||
import React from 'react'; | ||
import { | ||
StyleSheet, | ||
useWindowDimensions, | ||
Image, | ||
Linking, | ||
Platform, | ||
TouchableNativeFeedback, | ||
} from 'react-native'; | ||
import { env } from '../constants/env'; | ||
import Colors from '../constants/Colors'; | ||
|
||
const LocationCard = ({ style, lat, lng, name }) => { | ||
const window = useWindowDimensions(); | ||
const mapImageUri = `https://map.ir/static?width=700&height=1200&zoom_level=16&markers=color:skyblue|label:${name}|${lng},${lat}`; | ||
const mapImageHeaders = { | ||
accept: 'image/png', | ||
'x-api-key': env.mapIrApiKey, | ||
}; | ||
|
||
const openGoogleMapsHandler = () => { | ||
const scheme = Platform.select({ | ||
ios: 'maps:0,0?q=', | ||
android: 'geo:0,0?q=', | ||
}); | ||
const latLng = `${lat},${lng}`; | ||
const label = { name }; | ||
const url = Platform.select({ | ||
ios: `${scheme}${label}@${latLng}`, | ||
android: `${scheme}${latLng}(${label})`, | ||
}); | ||
Linking.openURL(url); | ||
}; | ||
|
||
return ( | ||
<Card style={{ ...styles.card, ...style }}> | ||
<TouchableNativeFeedback | ||
onPress={openGoogleMapsHandler} | ||
style={{ flex: 1 }}> | ||
<Image | ||
style={styles.image} | ||
source={{ uri: mapImageUri, headers: mapImageHeaders }} | ||
/> | ||
</TouchableNativeFeedback> | ||
<View style={styles.cardItem}> | ||
<Text>طول جغرافیایی:</Text> | ||
<Text style={{ writingDirection: 'ltr' }}>{lat}</Text> | ||
</View> | ||
<View style={styles.cardItem}> | ||
<Text>عرض جغرافیایی:</Text> | ||
<Text style={{ writingDirection: 'ltr' }}>{lng}</Text> | ||
</View> | ||
<View style={styles.cardItem}> | ||
<Text>نمایش نقشه در گوگل:</Text> | ||
<Icon | ||
type="Ionicons" | ||
name="md-open-outline" | ||
style={styles.icon} | ||
onPress={openGoogleMapsHandler} | ||
/> | ||
</View> | ||
</Card> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
card: { | ||
overflow: 'hidden', | ||
borderRadius: 10, | ||
}, | ||
map: { | ||
height: 800, | ||
width: 600, | ||
}, | ||
image: { | ||
resizeMode: 'cover', | ||
flex: 1, | ||
}, | ||
cardItem: { | ||
alignSelf: 'stretch', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
paddingHorizontal: 16, | ||
paddingVertical: 8, | ||
borderBottomColor: '#ccc', | ||
borderBottomWidth: StyleSheet.hairlineWidth, | ||
}, | ||
button: { | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
marginTop: 0, | ||
marginBottom: 0, | ||
}, | ||
icon: { | ||
color: Colors.primary, | ||
fontSize: 36, | ||
}, | ||
}); | ||
|
||
export default LocationCard; |
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
Oops, something went wrong.