Skip to content

Commit 4b0ac69

Browse files
authored
Merge pull request #31 from maximcoding/chore/rn-0.87-upgrade
React Native 0.82.1 → 0.87.0
2 parents 096e505 + 00c1c56 commit 4b0ac69

21 files changed

Lines changed: 2908 additions & 2828 deletions

File tree

.claude/CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Production-oriented React Native starter for mobile apps: feature-first architec
88

99
## Tech Stack
1010

11-
- **Framework:** React Native 0.82.1 (bare workflow)
11+
- **Framework:** React Native 0.87.0 (bare workflow)
1212
- **Language:** TypeScript (strict)
1313
- **State Management:** Zustand (`src/shared/stores/`); TanStack React Query for server state
1414
- **Navigation:** React Navigation v7; `src/navigation/routes.ts`, `root-param-list.ts`
@@ -164,7 +164,8 @@ Figma MCP is configured for design-to-code (get_design_context, etc.). Use for F
164164
## Common Pitfalls — Do NOT
165165

166166
- Do NOT add new npm packages without asking/RFC.
167-
- Do NOT change any package version in `package.json` or `package-lock.json`. Fix consuming code to match the installed version instead.
167+
- Do NOT change package versions on your own initiative — fix consuming code to match what is installed.
168+
A version bump is its own task, asked for by the owner, never a side effect of another change.
168169
- Do NOT use `fetch`; use project HTTP/transport only.
169170
- Do NOT put feature logic in `src/shared/components/ui/` or `src/shared/stores/`.
170171
- Do NOT use raw colors/spacing/fonts in UI; use theme tokens.

AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ Use path alias `@/` only (e.g. `@/navigation/`, `@/session/`, `@/config/`, `@/i1
6666
## Don'ts
6767

6868
- Do not add new dependencies without an agreed process.
69-
- **Never change package versions in `package.json` or `package-lock.json`.** Do not upgrade, downgrade, or replace any dependency. If a version mismatch is causing a bug, fix the consuming code to match the installed version — do not touch the package files.
69+
- **Never change package versions on your own initiative.** Do not upgrade, downgrade, or replace a dependency
70+
to work around a bug: fix the consuming code to match the installed version instead. Version changes happen
71+
only as their own deliberate piece of work, asked for by the owner — as the React Native 0.87 upgrade was —
72+
and never folded into an unrelated change, because a break that follows a mixed diff cannot be attributed.
7073
- No Tailwind, NativeWind, or Styled Components.
7174
- No `fetch`; use project HTTP/transport layer only.
7275
- No raw colors or spacing in UI; use theme tokens.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
[![Use this template](https://img.shields.io/badge/Use%20this%20template-2ea44f?logo=github&logoColor=white)](https://github.com/maximcoding/react-native-starter/generate)
44
![CI](https://github.com/maximcoding/react-native-starter/actions/workflows/ci.yml/badge.svg)
5-
![React Native](https://img.shields.io/badge/React%20Native-0.82.1-61DAFB?logo=react&logoColor=white)
5+
![React Native](https://img.shields.io/badge/React%20Native-0.87.0-61DAFB?logo=react&logoColor=white)
66
![TypeScript](https://img.shields.io/badge/TypeScript-5.8-3178C6?logo=typescript&logoColor=white)
77
![License](https://img.shields.io/badge/license-MIT-green)
88

99
React native starter project (no Expo) - modern state management, fast storage, and a production-minded foundation.
1010

1111
## ✨ Features Included
1212

13-
- **🧱 Bare React Native 0.82.1** — full native control, (no Expo lock-in)
13+
- **🧱 Bare React Native 0.87.0** — full native control, (no Expo lock-in)
1414
- **🧭 React Navigation 7.x** — stacks, tabs, modals, predefined presets and options
1515
- **📦 TanStack Query 5.x** — Framework agnostic powerful server data fetching library. Caching, updating, retries, invalidation, and persistence.
1616
- **🪶 Zustand 5.x** — A small 1KB size, fast state management hook-based API. Eliminating boilerplates and prop drilling.

android/app/build.gradle

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,42 @@ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
5454
def hermesEnabled = (project.findProperty("hermesEnabled") ?: "true")
5555

5656
android {
57-
ndkVersion rootProject.ext.ndkVersion
58-
buildToolsVersion rootProject.ext.buildToolsVersion
59-
compileSdk rootProject.ext.compileSdkVersion
57+
ndkVersion = rootProject.ext.ndkVersion
58+
buildToolsVersion = rootProject.ext.buildToolsVersion
59+
compileSdk = rootProject.ext.compileSdkVersion
6060

6161
buildFeatures {
6262
buildConfig = true
6363
}
6464

65-
namespace "com.reactnativestarter"
65+
namespace = "com.reactnativestarter"
6666
defaultConfig {
67-
applicationId "com.reactnativestarter"
68-
minSdkVersion rootProject.ext.minSdkVersion
69-
targetSdkVersion rootProject.ext.targetSdkVersion
70-
versionCode 1
71-
versionName "1.0"
67+
applicationId = "com.reactnativestarter"
68+
minSdk = rootProject.ext.minSdkVersion
69+
targetSdk = rootProject.ext.targetSdkVersion
70+
versionCode = 1
71+
versionName = "1.0"
7272
}
7373

7474
signingConfigs {
7575
debug {
76-
storeFile file('debug.keystore')
77-
storePassword 'android'
78-
keyAlias 'androiddebugkey'
79-
keyPassword 'android'
76+
storeFile = file('debug.keystore')
77+
storePassword = 'android'
78+
keyAlias = 'androiddebugkey'
79+
keyPassword = 'android'
8080
}
8181
}
8282

8383
buildTypes {
8484
debug {
85-
signingConfig signingConfigs.debug
85+
signingConfig = signingConfigs.debug
8686
}
8787
release {
88-
signingConfig signingConfigs.debug
89-
minifyEnabled enableProguardInReleaseBuilds
90-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
88+
signingConfig = signingConfigs.debug
89+
minifyEnabled = enableProguardInReleaseBuilds
90+
// AGP 9 запретил `proguard-android.txt`: он содержит `-dontoptimize`
91+
// и глушит оптимизации R8. Оптимизирующий вариант — замена по указанию AGP.
92+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
9193
}
9294
}
9395
}

android/build.gradle

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,56 @@
1-
plugins {
2-
id "com.android.application" version "8.13.2" apply false
3-
id "com.android.library" version "8.13.2" apply false
4-
id "org.jetbrains.kotlin.android" version "2.2.21" apply false
1+
/**
2+
* Структура взята из шаблона React Native 0.87 (`@react-native-community/template`).
3+
*
4+
* Версии AGP, Kotlin и react-native-gradle-plugin здесь намеренно **не задаются**:
5+
* ими управляет сам RN через composite build
6+
* `includeBuild("../node_modules/@react-native/gradle-plugin")`. Прежний вариант
7+
* прибивал AGP гвоздями в блоке `plugins { id "com.android.application" version … }`,
8+
* и с RN 0.87 это ломало сборку: RNGP всё равно подтягивал свой AGP 9, а объявленная
9+
* версия игнорировалась — конфликт вылезал как «plugin is no longer required» и
10+
* «does not specify compileSdk».
11+
*/
12+
buildscript {
13+
ext {
14+
compileSdkVersion = 36
15+
targetSdkVersion = 36
16+
minSdkVersion = 24
517

6-
// Provided by includeBuild("../node_modules/@react-native/gradle-plugin")
7-
id "com.facebook.react" apply false
18+
// Выровнено с шаблоном 0.87: более старые build-tools и NDK
19+
// AGP этой версии уже не обещает поддерживать.
20+
buildToolsVersion = "37.0.0"
21+
ndkVersion = "27.1.12297006"
22+
kotlinVersion = "2.2.0"
23+
}
24+
repositories {
25+
google()
26+
mavenCentral()
27+
}
28+
dependencies {
29+
classpath("com.android.tools.build:gradle")
30+
classpath("com.facebook.react:react-native-gradle-plugin")
31+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
32+
}
833
}
934

10-
ext {
11-
// Android SDK / Tools (AGP 8.13 supports API 36) :contentReference[oaicite:2]{index=2}
12-
compileSdkVersion = 36
13-
targetSdkVersion = 36
14-
minSdkVersion = 24
15-
16-
// As per AGP compatibility defaults (can be installed via SDK Manager) :contentReference[oaicite:3]{index=3}
17-
buildToolsVersion = "35.0.0"
18-
ndkVersion = "27.0.12077973"
19-
}
35+
apply plugin: "com.facebook.react.rootproject"
2036

2137
allprojects {
2238
repositories {
2339
google()
2440
mavenCentral()
2541
}
2642
}
43+
44+
allprojects {
45+
// AGP 9 требует, чтобы пространство имён было уникальным, а io.github.zhongwuzw
46+
// 2.4.0 отдаёт `com.tencent.mmkv` сразу из двух артефактов — mmkv и annotation,
47+
// из-за чего слияние манифестов падает. В 2.4.1 это разведено.
48+
//
49+
// Поднимается только нативный артефакт: npm-пакеты react-native-mmkv и
50+
// react-native-nitro-modules по решению владельца не трогаются вовсе.
51+
configurations.configureEach {
52+
resolutionStrategy {
53+
force "io.github.zhongwuzw:mmkv:2.4.1"
54+
}
55+
}
56+
}

android/gradle.properties

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ edgeToEdgeEnabled=false
2727

2828
# Additional Android settings (BuildConfig enabled in app/build.gradle buildFeatures)
2929
android.nonTransitiveRClass=false
30-
android.nonFinalResIds=false
30+
android.nonFinalResIds=false
31+
32+
# ── Флаги AGP 9, без которых сборка RN не заводится ─────────────────────────
33+
# Оба стоят в шаблоне React Native 0.87 и оба выключают новое поведение AGP 9:
34+
# builtInKotlin=false — AGP 9 иначе запрещает плагин org.jetbrains.kotlin.android,
35+
# а его применяют девять библиотек экосистемы (screens, safe-area-context,
36+
# gesture-handler, mmkv, nitro-modules и другие) даже в самых свежих версиях;
37+
# newDsl=false — оставляет прежний Gradle DSL, на котором написаны и наш
38+
# app/build.gradle, и все те же библиотеки.
39+
android.builtInKotlin=false
40+
android.newDsl=false

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-9.0.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

babel.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module.exports = {
1313
},
1414
},
1515
],
16-
'react-native-reanimated/plugin',
16+
// Плагин переехал в worklets: `react-native-reanimated/plugin` в 4.x —
17+
// лишь реэкспорт `react-native-worklets/plugin`. Держать последним.
18+
'react-native-worklets/plugin',
1719
],
1820
}

0 commit comments

Comments
 (0)