-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into offline-improvements
- Loading branch information
Showing
19 changed files
with
5,017 additions
and
3,425 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,4 +123,8 @@ coverage | |
/plugin/build | ||
|
||
.env | ||
.yarn | ||
.yarn | ||
|
||
# Expo | ||
packages/expo-app/ios | ||
packages/expo-app/android |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
connection.project.dir=../../example/android | ||
connection.project.dir=../../packages/react-native-app/android | ||
eclipse.preferences.version=1 |
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,7 +1,7 @@ | ||
{ | ||
"name": "@maplibre/maplibre-react-native", | ||
"description": "A MapLibre GL Native plugin for creating maps in React Native", | ||
"version": "10.0.0-alpha.13", | ||
"version": "10.0.0-alpha.17", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
|
@@ -100,6 +100,9 @@ | |
"react-test-renderer": "^18.2.0", | ||
"typescript": "^5.3.3" | ||
}, | ||
"resolutions": { | ||
"typescript": "5.5.3" | ||
}, | ||
"jest": { | ||
"preset": "react-native", | ||
"collectCoverageFrom": [ | ||
|
@@ -139,6 +142,7 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"workspaces": [ | ||
"apps/*", | ||
"packages/*" | ||
] | ||
} |
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,69 @@ | ||
import React from 'react'; | ||
import MapLibreGL from '@maplibre/maplibre-react-native'; | ||
import {StyleSheet, Text, View, LogBox, SafeAreaView} from 'react-native'; | ||
import Icon from 'react-native-vector-icons/MaterialIcons'; | ||
|
||
import { sheet, colors } from '@maplibre-react-native/examples'; | ||
import { default as Home } from '@maplibre-react-native/examples/src/scenes/Examples'; | ||
import { IS_ANDROID } from '@maplibre-react-native/examples/src/utils'; | ||
|
||
LogBox.ignoreLogs([ | ||
'Warning: isMounted(...) is deprecated', | ||
'Module RCTImageLoader', | ||
]); | ||
|
||
const styles = StyleSheet.create({ | ||
noPermissionsText: { | ||
fontSize: 18, | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
MapLibreGL.setAccessToken(null); | ||
Icon.loadFont(); | ||
|
||
class App extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isFetchingAndroidPermission: IS_ANDROID, | ||
isAndroidPermissionGranted: false, | ||
activeExample: -1, | ||
}; | ||
} | ||
|
||
async componentDidMount() { | ||
if (IS_ANDROID) { | ||
const isGranted = await MapLibreGL.requestAndroidLocationPermissions(); | ||
this.setState({ | ||
isAndroidPermissionGranted: isGranted, | ||
isFetchingAndroidPermission: false, | ||
}); | ||
} | ||
} | ||
|
||
render() { | ||
if (IS_ANDROID && !this.state.isAndroidPermissionGranted) { | ||
if (this.state.isFetchingAndroidPermission) { | ||
return null; | ||
} | ||
return ( | ||
<SafeAreaView | ||
style={[sheet.matchParent, {backgroundColor: colors.primary.blue}]} | ||
forceInset={{top: 'always'}}> | ||
<View style={sheet.matchParent}> | ||
<Text style={styles.noPermissionsText}> | ||
You need to accept location permissions in order to use this | ||
example applications | ||
</Text> | ||
</View> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
return <Home />; | ||
} | ||
} | ||
|
||
export default 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"expo": { | ||
"name": "expo-app", | ||
"slug": "expo-app", | ||
"version": "1.0.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/icon.png", | ||
"userInterfaceStyle": "light", | ||
"splash": { | ||
"image": "./assets/splash.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"ios": { | ||
"supportsTablet": true, | ||
"bundleIdentifier": "org.maplibre.expoapp" | ||
}, | ||
"android": { | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/adaptive-icon.png", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"package": "org.maplibre.react_native_expo_app" | ||
}, | ||
"web": { | ||
"favicon": "./assets/favicon.png" | ||
}, | ||
"plugins": [ | ||
[ | ||
"expo-dev-launcher", | ||
{ | ||
"launchMode": "most-recent" | ||
} | ||
], | ||
"@maplibre/maplibre-react-native" | ||
] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,13 @@ | ||
module.exports = function (api) { | ||
api.cache(false); | ||
return { | ||
presets: [ | ||
[ | ||
'babel-preset-expo', | ||
{ | ||
jsxRuntime: 'automatic' | ||
}, | ||
] | ||
] | ||
}; | ||
}; |
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,70 @@ | ||
// Learn more https://docs.expo.io/guides/customizing-metro | ||
/** @type {import('expo/metro-config').MetroConfig} */ | ||
|
||
|
||
const { getDefaultConfig } = require('expo/metro-config'); | ||
const { FileStore } = require('metro-cache'); | ||
const path = require('path'); | ||
|
||
const projectRoot = __dirname; | ||
const workspaceRoot = path.resolve(projectRoot, '../..'); | ||
|
||
require('@expo/env').load(workspaceRoot, { force: true }); | ||
|
||
const config = getDefaultConfig(__dirname); | ||
|
||
function withAssets(config) { | ||
const { transformer, resolver } = config; | ||
config.transformer = { | ||
...transformer, | ||
//babelTransformerPath: require.resolve('react-native-svg-transformer'), | ||
}; | ||
config.resolver = { | ||
...resolver, | ||
// assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'), | ||
// sourceExts: [...resolver.sourceExts, 'mjs', 'cjs', 'svg'], | ||
}; | ||
// Remove console logs | ||
config.transformer.minifierConfig.compress.drop_console = true; | ||
return config; | ||
} | ||
|
||
/** | ||
* Add the monorepo paths to the Metro config. | ||
* This allows Metro to resolve modules from the monorepo. | ||
* | ||
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config | ||
* @param {import('expo/metro-config').MetroConfig} config | ||
* @returns {import('expo/metro-config').MetroConfig} | ||
*/ | ||
function withMonorepoPaths(config) { | ||
// #1 - Watch all files in the monorepo | ||
config.watchFolders = [workspaceRoot]; | ||
config.resolver.nodeModulesPaths = [ | ||
path.resolve(projectRoot, 'node_modules'), | ||
path.resolve(workspaceRoot, 'node_modules'), | ||
]; | ||
|
||
// #3 - Force resolving nested modules to the folders below | ||
config.resolver.disableHierarchicalLookup = true; | ||
|
||
return config; | ||
} | ||
|
||
/** | ||
* Move the Metro cache to the `node_modules/.cache/metro` folder. | ||
* This repository configured Turborepo to use this cache location as well. | ||
* If you have any environment variables, you can configure Turborepo to invalidate it when needed. | ||
* | ||
* @see https://turbo.build/repo/docs/reference/configuration#env | ||
* @param {import('expo/metro-config').MetroConfig} config | ||
* @returns {import('expo/metro-config').MetroConfig} | ||
*/ | ||
function withTurborepoManagedCache(config) { | ||
config.cacheStores = [new FileStore({ root: path.join(__dirname, 'node_modules/.cache/metro') })]; | ||
return config; | ||
} | ||
|
||
module.exports = withMonorepoPaths( | ||
withAssets(config) | ||
); |
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,46 @@ | ||
{ | ||
"name": "expo-app", | ||
"version": "1.0.0", | ||
"main": "expo/AppEntry.js", | ||
"scripts": { | ||
"build": "expo prebuild", | ||
"start": "expo start", | ||
"android": "expo run:android", | ||
"ios": "expo run:ios", | ||
"web": "expo start --web" | ||
}, | ||
"dependencies": { | ||
"@mapbox/geo-viewport": "*", | ||
"@maplibre-react-native/examples": "*", | ||
"@maplibre/maplibre-react-native": "workspace:*", | ||
"@react-native-masked-view/masked-view": "*", | ||
"@react-navigation/native": "*", | ||
"@react-navigation/stack": "*", | ||
"@turf/along": "*", | ||
"@turf/bbox-polygon": "*", | ||
"@turf/distance": "*", | ||
"@turf/helpers": "*", | ||
"@turf/length": "*", | ||
"@turf/nearest-point-on-line": "*", | ||
"@types/geojson": "*", | ||
"debounce": "*", | ||
"expo": "~51.0.28", | ||
"expo-dev-client": "^4.0.26", | ||
"expo-status-bar": "~1.12.1", | ||
"fbjs": "*", | ||
"moment": "*", | ||
"prop-types": "*", | ||
"react": "*", | ||
"react-native": "*", | ||
"react-native-elements": "*", | ||
"react-native-gesture-handler": "*", | ||
"react-native-safe-area-context": "*", | ||
"react-native-screens": "*", | ||
"react-native-svg": "*", | ||
"react-native-vector-icons": "*" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.0" | ||
}, | ||
"private": true | ||
} |
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,17 @@ | ||
{ | ||
"extends": "expo/tsconfig.base", | ||
"compilerOptions": { | ||
"strict": true, | ||
"jsx": "preserve", | ||
"paths": { | ||
"@/*": [ | ||
"./src/*" | ||
], | ||
"@maplibre/maplibre-react-native": ["../../javascript"], | ||
} | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
"**/*.tsx" | ||
] | ||
} |
Oops, something went wrong.