callstack / callstack/react-native-paper

Better performance by enabling the React Compiler (standard memoization of components)

未关闭
#4,788 1 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看
feature request
主要语言
TypeScript
星标
14.5k
派生
2.2k
平均合并
5 天 23 小时
30 天内合并 PR
12

描述

**Is your feature request related to a problem? Please describe.**
The React Native Paper components do have a performance impact on the app when they render. I think we can improve the performance by a lot if we output compiled code of this library with the React Compiler enabled. So they don't re-render at all when the props are stable (which happens a lot with react compiler)

**Describe the solution you'd like**
1. [Enable the React Compiler](https://react.dev/reference/react-compiler/compiling-libraries)
2. Optimize compiled code

**Describe alternatives you've considered**
We are trying this out on our fork:

package.json
```
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
[
"module",
{
"esm": true,
"configFile": true
}
],
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]
}
```

babel.config.js
```
module.exports = {
plugins: [
[
'babel-plugin-react-compiler',
{
logLevel: 'verbose',

// compilationMode: 'all',
// panicThreshold: 'all_errors',
logger: {
logEvent(filename, event) {
if (event.kind === 'CompileSuccess') {
console.log('✔ Compiled:', filename);
} else {
console.warn('ℹ Compilation error in:', filename, event.reason);
}
},
},
},
],
],
presets: ['module:@react-native/babel-preset'],
};

```

**Additional context**
https://react.dev/learn/react-compiler

贡献指南

打开贡献指南

调研方向

先从 package.json 和 babel.config.js 开始,然后阅读链接的有关编译库的 React Compiler 文档。为库输出启用编译器,调查任何编译问题,并验证组件是否能在实现预期性能改进的情况下成功构建。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native, typescript
领域
build-system, mobile, performance
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。