Skip to content

Commit

Permalink
feat(web): make example start in web mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed May 10, 2024
1 parent 739a631 commit e3074ad
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 34 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Some notes about example app:
```
On android change `newArchEnabled=true` in `example/android/gralde.properties`

### Running example app for Web

```
npx expo start -c --web
```


## Best practices for PR's
- If you plan to work on a bigger feature, please open a discussion, to discuss the best way to address it
Expand Down
10 changes: 8 additions & 2 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"name": "RNMapboxGLExample",
"displayName": "RNMapboxGLExample"
"expo": {
"name": "RNMapboxGLExample",
"displayName": "RNMapboxGLExample",
"web": {
"bundler": "metro",
"output": "single"
}
}
}
24 changes: 21 additions & 3 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [['@babel/plugin-transform-private-methods', { loose: true }]],
const path = require('path');
const pak = require('../package.json');

module.exports = function (api) {
api.cache(true);

return {
presets: ['babel-preset-expo'],
plugins: [
[
'module-resolver',
{
extensions: ['.tsx', '.ts', '.js', '.json'],
alias: {
// For development, we want to alias the library to the source
[pak.name]: path.join(__dirname, '..', pak.source),
},
},
],
],
};
};
6 changes: 5 additions & 1 deletion example/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { AppRegistry } from 'react-native';

import App from './src/App';
import { name as appName } from './app.json';
import appConfig from './app.json';

const {
expo: { name: appName },
} = appConfig;

AppRegistry.registerComponent(appName, () => App);
20 changes: 11 additions & 9 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"name": "RNMapboxGLExample",
"main": "expo/AppEntry.js",
"version": "1.0.0",
"private": true,
"scripts": {
"android": "yarn react-native run-android",
"ios": "yarn react-native run-ios --simulator=\"iPhone SE (3rd generation)\"",
"web": "expo start -c --web",
"pod:install": "cd ios && pod install",
"start": "yarn react-native start",
"postinstall": "node ./scripts/set_access_token.js",
Expand Down Expand Up @@ -35,37 +37,37 @@
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "18.2.0",
"react-native": "0.74.0",
"react-native": "0.74.1",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-vector-icons": "9.2.0",
"@rnmapbox/maps": "link:../"
},
"optionalDependencies": {
"@expo/webpack-config": "^0.17.2",
"@expo/metro-runtime": "3.2.1",
"@types/responselike": "1.0.0",
"expo": "46.0.0",
"mapbox-gl": "^2.9.2",
"react-dom": "^18.2.0",
"react-native-web": "0.18.7"
"expo": "~51.0.1",
"mapbox-gl": "^3.3.0",
"react-dom": "18.2.0",
"react-native-web": "~0.19.10"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/core": "^7.24.0",
"@babel/plugin-transform-private-methods": "^7.23.3",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "^0.74.2",
"@react-native/eslint-config": "^0.74.1",
"@react-native/metro-config": "^0.74.2",
"@react-native/typescript-config": "^0.74.1",
"@types/react": "^18.2.6",
"@types/react": "^18.2.45",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "^2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "^5.0.4",
"typescript": "^5.3.3",
"detox": "^20.12.1",
"glob-to-regexp": "^0.4.0",
"babel-plugin-module-resolver": "^5.0.0",
Expand Down
1 change: 0 additions & 1 deletion example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"baseUrl": ".",
"paths": {
"@rnmapbox/maps": ["../src"],
"react": ["./node_modules/@types/react"],
}
},
"include": ["global.d.ts", "index.js", "./__tests__/dumpExamplesJson.ts", "jest.config.ts", "jest.setup.ts"]
Expand Down
17 changes: 0 additions & 17 deletions example/webpack.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion rnmapbox-maps.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def $RNMapboxMaps.pre_install(installer)
end

## RNMapboxMapsDownloadToken
# expo does not supports `.netrc`, so we need to patch curl commend used by cocoapods to pass the credentials
# expo does not support `.netrc`, so we need to patch curl command used by cocoapods to pass the credentials

if $RNMapboxMapsDownloadToken
module AddCredentialsToCurlWhenDownloadingMapbox
Expand Down

0 comments on commit e3074ad

Please sign in to comment.