Skip to content

Commit 81844b9

Browse files
authored
Updating Example App to use React Native 0.81.1 (#3940)
* feat: Update example app to react-native 0.81.1 Updating expo optional dependency version Updating example app dependencies to latest versions Fixing yarn start command failing for example project Importing SafeAreaView from react-native-safe-area-context to get rid of deprecation warnings for importing it from 'react-native' * fix: examples UI and crashes and wrong behaviors Fixing Earthquakes example, which was always crashing when tapping clusters. Improving modal presentations Fixing examples: MapAndRNNavigation, TakeSnapshot, Yoyo, RestrictMapBounds, Compass, GeoJSONSource, QueryAtPoint, QueryWithRect, AnimatedLine, DriveTheLine, TakeSnapshot and DrawPolyline Fixing AnimatedPoint page title Fixing error in ShapeSourceIcon Updating debounce dependency in the root package.json because otherwise debounce wouldn't work in the example app's MapView * Fixing movePointShapeAnimatorModule create not a function error * Earthquakes Restoring Earthquakes in the examples docs Restoring earthquakes in the Symbol/Circle layer examples sublist * MapInModal component is presented both via react navigation and via react-native Modal component * chore: Prettier restoring prettier functionality and fixing a couple files * CacheManagement Making it a typescript-based component. Wrapping it into an example group and adding it to the examples in the docs * remove useless View wrapper from CacheManagement component * Fix "Cannot read property 'imageKey' of undefined" error in Shape Source Icons example * Turn ShapeSourceIcon.js to a tsx file. Running yarn generate to update docs
1 parent bc5e442 commit 81844b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+994
-763
lines changed

.eslintrc.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
module.exports = {
22
root: true,
33
parser: '@babel/eslint-parser',
4+
parserOptions: {
5+
ecmaFeatures: { jsx: true },
6+
ecmaVersion: 2021,
7+
sourceType: 'module',
8+
requireConfigFile: false,
9+
},
410
plugins: ['react', 'react-native', 'import'],
511
env: {
612
jest: true,
@@ -12,16 +18,10 @@ module.exports = {
1218
},
1319
'import/resolver': {
1420
node: {
15-
extensions: ['.js', '.jsx'],
21+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
1622
},
1723
},
1824
'import/ignore': ['react-native'],
19-
parserOptions: {
20-
ecmaFeatures: {
21-
jsx: true,
22-
modules: true,
23-
},
24-
},
2525
},
2626
globals: {
2727
fetch: true,
@@ -40,7 +40,7 @@ module.exports = {
4040
'plugin:react/recommended',
4141
'plugin:jest/recommended',
4242
'@react-native',
43-
'prettier',
43+
'plugin:prettier/recommended',
4444
],
4545
rules: {
4646
'react/no-deprecated': 'warn',
@@ -78,14 +78,26 @@ module.exports = {
7878
'no-unused-expressions': ['error', { allowTaggedTemplates: true }],
7979
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
8080
'react-native/no-inline-styles': 0,
81-
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
81+
// NOTE: @typescript-eslint rules are configured under the TS override below
82+
'jest/expect-expect': [
83+
'warn',
84+
{
85+
assertFunctionNames: [
86+
'expect',
87+
'verifyFilterItem',
88+
'verifyErrorFilterItem',
89+
'verifyErrorThrown',
90+
],
91+
},
92+
],
93+
'prettier/prettier': 'warn',
8294
},
8395
ignorePatterns: ['**/rnmapbox.web.symlink', 'plugin/build/', 'example/dist'],
8496
overrides: [
8597
{
8698
// Match TypeScript Files
8799
files: ['**/*.{ts,tsx}'],
88-
100+
parser: '@typescript-eslint/parser',
89101
parserOptions: {
90102
project: [
91103
'./tsconfig.json',
@@ -94,19 +106,26 @@ module.exports = {
94106
'./plugin/tsconfig.eslint.json',
95107
'./plugin/src/__tests__/tsconfig.eslint.json',
96108
],
109+
tsconfigRootDir: __dirname,
110+
sourceType: 'module',
97111
},
98112
plugins: ['@typescript-eslint'],
99113
extends: [
100114
'eslint:recommended',
101115
'plugin:react/recommended',
102116
'@react-native',
103117
'plugin:@typescript-eslint/recommended',
104-
'prettier',
118+
'plugin:prettier/recommended', // keep last
105119
],
106120
rules: {
107121
'no-shadow': 'off',
108122
'import/named': 'off',
109123
'react-native/no-inline-styles': 0,
124+
'@typescript-eslint/no-explicit-any': [
125+
'warn',
126+
{ ignoreRestArgs: true },
127+
],
128+
'prettier/prettier': 'warn',
110129
},
111130
},
112131
],

docs/examples.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
[
2+
{
3+
"groupName": "CacheManagement",
4+
"metadata": {
5+
"title": "CacheManagement"
6+
},
7+
"examples": [
8+
{
9+
"metadata": {
10+
"title": "CacheManagement",
11+
"tags": [
12+
"Cache",
13+
"Cache Management",
14+
"Offline Manager",
15+
"Offline Packs",
16+
"Validate Cache",
17+
"Invalidate Cache",
18+
"Get Cache Size",
19+
"Set Max Cache Size"
20+
],
21+
"docs": "\nManages map cache.\n\nUses the offline manager to manage the cache and the local storage in general. Shows how to invalidate cache to remove outdated tiles, how to clear the entire local storage from tiles and offline packs and to visualize the local storage usage amount.\n"
22+
},
23+
"fullPath": "example/src/examples/CacheManagement/CacheManagement.tsx",
24+
"relPath": "CacheManagement/CacheManagement.tsx",
25+
"name": "CacheManagement"
26+
}
27+
]
28+
},
229
{
330
"groupName": "SymbolCircleLayer",
431
"metadata": {
@@ -97,8 +124,8 @@
97124
],
98125
"docs": "\nRender icons with various methods.\n\n* pin-rn: Rendered with a React Native View\n* pin: Rendered with a native asset image\n* pin3: Resolved as a result of onImageMissing\n* example: Rendered with a js asset image (require)\n\n"
99126
},
100-
"fullPath": "example/src/examples/SymbolCircleLayer/ShapeSourceIcon.js",
101-
"relPath": "SymbolCircleLayer/ShapeSourceIcon.js",
127+
"fullPath": "example/src/examples/SymbolCircleLayer/ShapeSourceIcon.tsx",
128+
"relPath": "SymbolCircleLayer/ShapeSourceIcon.tsx",
102129
"name": "ShapeSourceIcon"
103130
}
104131
]

example/Gemfile.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.1.5.1)
8+
activesupport (7.1.5.2)
99
base64
1010
benchmark (>= 0.3)
1111
bigdecimal
@@ -24,9 +24,9 @@ GEM
2424
httpclient (~> 2.8, >= 2.8.3)
2525
json (>= 1.5.1)
2626
atomos (0.1.3)
27-
base64 (0.2.0)
28-
benchmark (0.4.0)
29-
bigdecimal (3.1.9)
27+
base64 (0.3.0)
28+
benchmark (0.4.1)
29+
bigdecimal (3.2.2)
3030
claide (1.1.0)
3131
cocoapods (1.15.2)
3232
addressable (~> 2.8)
@@ -67,10 +67,10 @@ GEM
6767
cocoapods-try (1.2.0)
6868
colored2 (3.1.2)
6969
concurrent-ruby (1.3.3)
70-
connection_pool (2.5.3)
71-
drb (2.2.1)
70+
connection_pool (2.5.4)
71+
drb (2.2.3)
7272
escape (0.0.4)
73-
ethon (0.16.0)
73+
ethon (0.15.0)
7474
ffi (>= 1.15.0)
7575
ffi (1.17.2)
7676
fourflusher (2.3.1)
@@ -80,7 +80,7 @@ GEM
8080
mutex_m
8181
i18n (1.14.7)
8282
concurrent-ruby (~> 1.0)
83-
json (2.11.3)
83+
json (2.13.2)
8484
logger (1.7.0)
8585
minitest (5.25.5)
8686
molinillo (0.8.0)
@@ -90,11 +90,11 @@ GEM
9090
netrc (0.11.0)
9191
nkf (0.2.0)
9292
public_suffix (4.0.7)
93-
rexml (3.4.1)
93+
rexml (3.4.2)
9494
ruby-macho (2.5.1)
9595
securerandom (0.3.2)
96-
typhoeus (1.4.1)
97-
ethon (>= 0.9.0)
96+
typhoeus (1.5.0)
97+
ethon (>= 0.9.0, < 0.16.0)
9898
tzinfo (2.0.6)
9999
concurrent-ruby (~> 1.0)
100100
xcodeproj (1.25.1)

example/__tests__/dumpExamplesJson.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import path from 'path';
55
import fs from 'fs';
66

7+
import * as CacheManagement from '../src/examples/CacheManagement';
78
import * as SymbolCircleLayer from '../src/examples/SymbolCircleLayer';
89
import * as UserLocation from '../src/examples/UserLocation';
910
import * as Map from '../src/examples/Map';
@@ -30,6 +31,7 @@ jest.mock('../src/assets/sportcar.glb', () => null, {
3031
});
3132

3233
const allTests = {
34+
CacheManagement,
3335
SymbolCircleLayer,
3436
UserLocation,
3537
Map,
@@ -51,11 +53,11 @@ function getExampleFullPath(
5153
const relPathBase = path.join(groupName, testName);
5254

5355
const existingExamplePaths = extensions
54-
.map((ext) => ({
56+
.map(ext => ({
5557
relPath: `${relPathBase}.${ext}`,
5658
fullPath: path.join(relExamplesPath, `${relPathBase}.${ext}`),
5759
}))
58-
.filter(({ relPath, fullPath }) =>
60+
.filter(({ relPath: _relPath, fullPath }) =>
5961
fs.existsSync(path.join(mapsRootPath, fullPath)),
6062
);
6163
if (existingExamplePaths.length === 0) {
@@ -81,7 +83,7 @@ type AllTestKeys = keyof typeof allTests;
8183

8284
const allTestKeys = Object.keys(allTests) as AllTestKeys[];
8385

84-
allTestKeys.forEach((groupName) => {
86+
allTestKeys.forEach(groupName => {
8587
const { metadata, ...tests } = allTests[groupName];
8688
const examples: Example[] = [];
8789
Object.entries(tests).forEach(([testName, test]) => {

example/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ buildscript {
2828
}
2929
}
3030

31-
buildToolsVersion = "35.0.0"
31+
buildToolsVersion = "36.0.0"
3232
minSdkVersion = 24
33-
compileSdkVersion = 35
34-
targetSdkVersion = 35
33+
compileSdkVersion = 36
34+
targetSdkVersion = 36
3535
kotlinVersion = "2.1.20"
3636
ndkVersion = "27.1.12297006"
3737
}

example/android/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ newArchEnabled=true
3939
# Use this property to enable or disable the Hermes JS engine.
4040
# If set to false, you will be using JSC instead.
4141
hermesEnabled=true
42+
43+
# Use this property to enable edge-to-edge display support.
44+
# This allows your app to draw behind system bars for an immersive UI.
45+
# Note: Only works with ReactActivity and should not be used with custom Activity.
46+
edgeToEdgeEnabled=false

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)