8 changed files with 386 additions and 402 deletions
@ -1,113 +0,0 @@
|
||||
# 已知问题和警告说明 |
||||
|
||||
## ⚠️ Web 平台警告 |
||||
|
||||
### 警告信息 |
||||
``` |
||||
λ WARN props.pointerEvents is deprecated. Use style.pointerEvents |
||||
``` |
||||
|
||||
### 原因 |
||||
这个警告来自 `[email protected]` 库内部,是该库在处理某些 React Native 组件时产生的弃用警告。具体来说: |
||||
|
||||
- React Native Web 正在从使用 `props.pointerEvents` 迁移到 `style.pointerEvents` |
||||
- 这是库内部的实现细节,不是我们应用代码的问题 |
||||
- 警告来自 `View` 组件在 Web 平台上的渲染过程 |
||||
|
||||
### 影响 |
||||
- ✅ **不影响应用功能** - 应用在 Web 平台上完全正常运行 |
||||
- ✅ **不影响性能** - 只是一个弃用提示 |
||||
- ✅ **不影响移动端** - 只在 Web 平台出现 |
||||
|
||||
### 解决方案 |
||||
|
||||
#### 方案 1:忽略警告(推荐) |
||||
这个警告是无害的,可以安全忽略。等待 `react-native-web` 库更新到新版本后会自动解决。 |
||||
|
||||
#### 方案 2:抑制警告 |
||||
如果你想在开发时隐藏这个警告,可以在 `app.json` 中添加配置: |
||||
|
||||
```json |
||||
{ |
||||
"expo": { |
||||
"web": { |
||||
"bundler": "metro", |
||||
"output": "static", |
||||
"favicon": "./assets/images/favicon.png" |
||||
} |
||||
} |
||||
} |
||||
``` |
||||
|
||||
或者在代码中添加警告过滤(不推荐): |
||||
|
||||
```typescript |
||||
// 在 app/_layout.tsx 顶部添加 |
||||
if (typeof window !== 'undefined') { |
||||
const originalWarn = console.warn; |
||||
console.warn = (...args) => { |
||||
if (args[0]?.includes?.('pointerEvents is deprecated')) { |
||||
return; |
||||
} |
||||
originalWarn(...args); |
||||
}; |
||||
} |
||||
``` |
||||
|
||||
#### 方案 3:等待库更新 |
||||
`react-native-web` 团队正在积极维护这个库,未来版本会解决这个警告。你可以: |
||||
|
||||
1. 关注 [react-native-web 更新日志](https://github.com/necolas/react-native-web/releases) |
||||
2. 定期运行 `pnpm update react-native-web` 更新到最新版本 |
||||
|
||||
### 相关信息 |
||||
|
||||
- **库版本**: [email protected] |
||||
- **Expo 版本**: ~54.0.22 |
||||
- **React Native 版本**: 0.81.5 |
||||
- **问题追踪**: 这是 react-native-web 库的已知问题,正在逐步迁移中 |
||||
|
||||
### 验证 |
||||
你可以通过以下方式验证应用功能正常: |
||||
|
||||
```bash |
||||
# 启动 Web 版本 |
||||
pnpm web |
||||
|
||||
# 在浏览器中打开 http://localhost:8081 |
||||
# 检查所有功能是否正常工作 |
||||
``` |
||||
|
||||
## 📝 其他注意事项 |
||||
|
||||
### 开发模式下的其他常见警告 |
||||
|
||||
#### 1. Metro Bundler 警告 |
||||
某些依赖可能会产生 Metro 打包警告,这些通常可以安全忽略。 |
||||
|
||||
#### 2. React 19 新特性警告 |
||||
由于使用了 React 19.1.0,某些旧的 API 可能会有弃用警告。 |
||||
|
||||
#### 3. Expo Router 类型警告 |
||||
TypeScript 可能会对某些 Expo Router 的动态路由产生类型警告,这是正常的。 |
||||
|
||||
### 生产构建 |
||||
在生产构建中,这些警告不会出现,因为: |
||||
- 生产构建会移除所有开发时的警告 |
||||
- 代码会被优化和压缩 |
||||
- 只有关键错误会被记录 |
||||
|
||||
### 如何报告问题 |
||||
如果你遇到其他问题: |
||||
|
||||
1. 检查是否是已知问题(查看本文档) |
||||
2. 查看 [Expo 文档](https://docs.expo.dev/) |
||||
3. 搜索 [Expo GitHub Issues](https://github.com/expo/expo/issues) |
||||
4. 在项目中创建 issue 或联系开发团队 |
||||
|
||||
## ✅ 总结 |
||||
|
||||
**当前的 `pointerEvents` 警告是安全的,可以忽略。** 应用在所有平台(iOS、Android、Web)上都能正常运行。这只是一个库内部的迁移提示,不影响你的开发和生产使用。 |
||||
|
||||
如果你想要一个完全没有警告的开发体验,可以等待 `react-native-web` 的下一个主要版本更新,或者使用上述方案 2 临时抑制警告。 |
||||
|
||||
@ -74,6 +74,9 @@ importers:
|
||||
react-native: |
||||
specifier: 0.81.5 |
||||
version: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected]) |
||||
react-native-paper: |
||||
specifier: ^5.14.5 |
||||
version: 5.14.5([email protected]([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]) |
||||
react-native-reanimated: |
||||
specifier: ~4.1.1 |
||||
version: 4.1.3(@babel/[email protected])([email protected](@babel/[email protected])([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]) |
||||
@ -622,6 +625,11 @@ packages:
|
||||
resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} |
||||
engines: {node: '>=6.9.0'} |
||||
|
||||
'@callstack/[email protected]': |
||||
resolution: {integrity: sha512-tTQ0uDSCL0ypeMa8T/E9wAZRGKWj8kXP7+6RYgPTfOPs9N07C9xM8P02GJ3feETap4Ux5S69D9nteq9mEj86NA==} |
||||
peerDependencies: |
||||
react: '>=16.3.0' |
||||
|
||||
'@expo/[email protected]': |
||||
resolution: {integrity: sha512-tgaKFeYNRjZssPueZMm1+2cRek6mxEsthPoBX6NzQeDlzIzYBBpnAR6xH95UO6A7r0vduBeL2acIAV1Y5aSGJQ==} |
||||
hasBin: true |
||||
@ -1517,6 +1525,9 @@ packages:
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==} |
||||
engines: {node: '>=12.5.0'} |
||||
@ -1614,6 +1625,10 @@ packages:
|
||||
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} |
||||
engines: {node: '>=4.0.0'} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-GRQOafGHwMHpjPx9iCvTgpu9NojZ49q794EEL94JVEw6VaeA8XTUyBKvAkOOjBX9oJNiV6G3P+T+tihFjo2TqA==} |
||||
engines: {node: '>=0.10.0'} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} |
||||
engines: {node: '>=0.10.0'} |
||||
@ -2059,6 +2074,9 @@ packages:
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-g4nBOWFpuiTqjR3LZdRxKUkij9iyveWeuks7INEsMX741f3r9xxrOe8TeQfUxtda0eXmiIFiMQzoeSQEno33Hw==} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} |
||||
engines: {node: ^16.14.0 || >=18.0.0} |
||||
@ -2770,6 +2788,9 @@ packages:
|
||||
peerDependencies: |
||||
react: ^16.8.0 || ^17 || ^18 || ^19 |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} |
||||
|
||||
@ -2782,6 +2803,13 @@ packages:
|
||||
react: '*' |
||||
react-native: '*' |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-eaIH5bUQjJ/mYm4AkI6caaiyc7BcHDwX6CqNDi6RIxfxfWxROsHpll1oBuwn/cFvknvA8uEAkqLk/vzVihI3AQ==} |
||||
peerDependencies: |
||||
react: '*' |
||||
react-native: '*' |
||||
react-native-safe-area-context: '*' |
||||
|
||||
[email protected]: |
||||
resolution: {integrity: sha512-GP8wsi1u3nqvC1fMab/m8gfFwFyldawElCcUSBJQgfrXeLmsPPUOpDw44lbLeCpcwUuLa05WTVePdTEwCLTUZg==} |
||||
peerDependencies: |
||||
@ -4069,6 +4097,12 @@ snapshots:
|
||||
'@babel/helper-string-parser': 7.27.1 |
||||
'@babel/helper-validator-identifier': 7.28.5 |
||||
|
||||
'@callstack/[email protected]([email protected])': |
||||
dependencies: |
||||
deepmerge: 3.3.0 |
||||
hoist-non-react-statics: 3.3.2 |
||||
react: 19.1.0 |
||||
|
||||
'@expo/[email protected]([email protected])([email protected])([email protected](@babel/[email protected])(@types/[email protected])([email protected]))': |
||||
dependencies: |
||||
'@0no-co/graphql.web': 1.2.0 |
||||
@ -5294,6 +5328,11 @@ snapshots:
|
||||
color-name: 1.1.4 |
||||
simple-swizzle: 0.2.4 |
||||
|
||||
[email protected]: |
||||
dependencies: |
||||
color-convert: 1.9.3 |
||||
color-string: 1.9.1 |
||||
|
||||
[email protected]: |
||||
dependencies: |
||||
color-convert: 2.0.1 |
||||
@ -5382,6 +5421,8 @@ snapshots:
|
||||
|
||||
[email protected]: {} |
||||
|
||||
[email protected]: {} |
||||
|
||||
[email protected]: {} |
||||
|
||||
[email protected]: |
||||
@ -5837,6 +5878,10 @@ snapshots:
|
||||
dependencies: |
||||
hermes-estree: 0.32.0 |
||||
|
||||
[email protected]: |
||||
dependencies: |
||||
react-is: 16.13.1 |
||||
|
||||
[email protected]: |
||||
dependencies: |
||||
lru-cache: 10.4.3 |
||||
@ -6733,6 +6778,8 @@ snapshots:
|
||||
dependencies: |
||||
react: 19.1.0 |
||||
|
||||
[email protected]: {} |
||||
|
||||
[email protected]: {} |
||||
|
||||
[email protected]: {} |
||||
@ -6742,6 +6789,15 @@ snapshots:
|
||||
react: 19.1.0 |
||||
react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected]) |
||||
|
||||
[email protected]([email protected]([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]): |
||||
dependencies: |
||||
'@callstack/react-theme-provider': 3.0.9([email protected]) |
||||
color: 3.2.1 |
||||
react: 19.1.0 |
||||
react-native: 0.81.5(@babel/[email protected])(@types/[email protected])([email protected]) |
||||
react-native-safe-area-context: 5.6.2([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]) |
||||
use-latest-callback: 0.2.6([email protected]) |
||||
|
||||
[email protected](@babel/[email protected])([email protected](@babel/[email protected])([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@types/[email protected])([email protected]))([email protected]): |
||||
dependencies: |
||||
'@babel/core': 7.28.5 |
||||
|
||||
Loading…
Reference in new issue