Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into offline-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
caspg committed Sep 24, 2024
2 parents 8d11e05 + 2671381 commit ac81cb7
Show file tree
Hide file tree
Showing 19 changed files with 5,017 additions and 3,425 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,8 @@ coverage
/plugin/build

.env
.yarn
.yarn

# Expo
packages/expo-app/ios
packages/expo-app/android
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ PR Title ([#123](link to my pr))
```

## 10.0.0-alpha.17

fix: [add generic expo plugin to remove Duplicated Signature in Xcode 15/16](<[#453](https://github.com/maplibre/maplibre-react-native/pull/453)>)

## 10.0.0-alpha.16

fix: [another attempt to disable code signing](<[#451](https://github.com/maplibre/maplibre-react-native/pull/451)>)

## 10.0.0-alpha.15

fix: [disable code signing for release builds](<[#450](https://github.com/maplibre/maplibre-react-native/pull/450)>)

## 10.0.0-alpha.14

fix: [disable library code signing](<[#447](https://github.com/maplibre/maplibre-react-native/pull/447)>)

feat: [feat: yarn monorepo](<[#441](https://github.com/maplibre/maplibre-react-native/pull/441)>)
fix: Call requestProgress when getting pack status on IOS + example improvement [#445](https://github.com/maplibre/maplibre-react-native/pull/445)

Expand Down
2 changes: 1 addition & 1 deletion android/rctmln/.settings/org.eclipse.buildship.core.prefs
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
6 changes: 5 additions & 1 deletion package.json
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"
},
Expand Down Expand Up @@ -100,6 +100,9 @@
"react-test-renderer": "^18.2.0",
"typescript": "^5.3.3"
},
"resolutions": {
"typescript": "5.5.3"
},
"jest": {
"preset": "react-native",
"collectCoverageFrom": [
Expand Down Expand Up @@ -139,6 +142,7 @@
},
"packageManager": "[email protected]",
"workspaces": [
"apps/*",
"packages/*"
]
}
45 changes: 40 additions & 5 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,47 @@
"src",
"!**/__tests__"
],
"peerDependencies": {
"@maplibre/maplibre-react-native": "*",
"react": "*",
"react-native": "*"
"dependencies": {
"@mapbox/geo-viewport": "^0.5.0",
"@react-native-masked-view/masked-view": "^0.3.1",
"@react-navigation/native": "^6.1.8",
"@react-navigation/stack": "^6.3.25",
"@turf/along": "^6.5.0",
"@turf/bbox-polygon": "^6.5.0",
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/length": "^6.5.0",
"@turf/nearest-point-on-line": "6.5.0",
"@types/geojson": "7946.0.14",
"debounce": "^2.0.0",
"fbjs": "^3.0.5",
"moment": "^2.30.1",
"prop-types": "^15.7.2",
"react": "18.2.0",
"react-native": "0.74.5",
"react-native-elements": "^3.4.3",
"react-native-gesture-handler": "~2.16.1",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-svg": "15.2.0",
"react-native-vector-icons": "10.0.0"
},
"devDependencies": {
"@maplibre/maplibre-react-native": "workspace:^"
"@babel/core": "^7.24.0",
"@babel/plugin-transform-private-methods": "^7.25.4",
"@babel/preset-typescript": "7.22.5",
"@babel/runtime": "^7.23.1",
"@react-native/metro-config": "^0.75.2",
"@types/react": "^18.2.61",
"@types/react-native": "^0.72.2",
"babel-plugin-module-resolver": "^4.1.0",
"detox": "^20.17.0",
"glob-to-regexp": "^0.4.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"jetifier": "^2.0.0",
"metro-react-native-babel-preset": "^0.77.0",
"typescript": "^5.3.3"
}
}
69 changes: 69 additions & 0 deletions packages/expo-app/App.js
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;
38 changes: 38 additions & 0 deletions packages/expo-app/app.json
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"
]
}
}
Binary file added packages/expo-app/assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/expo-app/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/expo-app/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/expo-app/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/expo-app/babel.config.js
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'
},
]
]
};
};
70 changes: 70 additions & 0 deletions packages/expo-app/metro.config.js
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)
);
46 changes: 46 additions & 0 deletions packages/expo-app/package.json
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
}
17 changes: 17 additions & 0 deletions packages/expo-app/tsconfig.json
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"
]
}
Loading

0 comments on commit ac81cb7

Please sign in to comment.