Layout, involving negative margin, changes between debug and release builds
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- bun, react, react-native, typescript
调研方向
从 issue 中描述的最小复现应用开始,比较 Windows debug 和 release 构建的命令。检查 App 组件的图像和负边距布局;如果能够复现差异,则继续跟踪 React Native Windows 的 release 行为。两种构建配置下的布局一致即表示完成。
由索引模型根据 Issue 内容生成。
描述
Problem Description
The following layout, involving negative margin, changes between debug mode and release mode:
import { StatusBar } from "expo-status-bar";
import { Image, StyleSheet, Text, View } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<Image
accessibilityLabel="Windows logo"
resizeMode="contain"
source={require("./assets/windows-logo-2.png")}
style={styles.logo}
/>
<Text style={styles.text}>Developers, developers, developers!</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
text: {
color: "#000",
},
logo: {
marginLeft: 40,
marginTop: -40,
marginBottom: -40,
width: 220,
height: 220,
},
});
Here's the windows-logo-2.png asset referenced:
And here's how the layout changed between the two build configurations (ignore the fact that the window size is different - resizing the window to the same size does not fix the layout):
Debug mode
This is the intended layout that I developed against. By using negative margins, I can subtract for the excessive padding that the logo image has.
Release mode
Here's the surprising appearance in a release-mode build:
Given that the image shifts down significantly and claims extra space above itself, it feels like it's rendering something like this in practice:
logo: {
marginLeft: 40,
- marginTop: -40,
+ marginTop: 40,
- marginBottom: -40,
+ marginBottom: -80,
width: 220,
height: 220,
},
... but that's just a guess. I see it's also moving somewhat towards the right, and the image has become 25% larger. So maybe rather than a margin problem, it's a scaling and transform origin problem? Or a little bit of both?
Steps To Reproduce
git clone [email protected]:shirakaba/rnw-layout-change-repro.gitcd rnw-layout-change-reprobun install(I used Bun v1.3.14), or install with your preferred package manager.- Compare the results of a debug-mode build vs. a release-mode build. In my case, I passed
--msbuildprops PreferredToolArchitecture=x64because otherwise it ran out of memory trying to build on my VM with 8 GB RAM:
-
# The debug-mode build node --run windows -- --msbuildprops PreferredToolArchitecture=x64 -
# The release-mode build node --run windows -- --msbuildprops PreferredToolArchitecture=x64 --release
Expected Results
The layout should be the same between both debug mode and release mode.
CLI version
20.2.0
Environment
'dotnet.exe' is not recognized as an internal or external command,
operable program or batch file.
'dotnet.exe' is not recognized as an internal or external command,
operable program or batch file.
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26100
CPU: (4) arm64 Apple Silicon
Memory: 881.42 MB / 7.99 GB
Binaries:
Node:
version: 26.8.1
path: C:\Users\jamie\AppData\Local\mise\installs\node\26.8.1\node.EXE
Yarn: Not Found
npm:
version: 12.0.2
path: C:\Users\jamie\AppData\Local\mise\installs\npm\12.0.2\node_modules\.bin\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
Versions:
- 10.0.19041.0
- 10.0.22621.0
- 10.0.26100.0
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.14.37614.0 (Visual Studio Community 2022)
- 18.9.12112.369 (Visual Studio Community 2026)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: ^20.1.3
react:
installed: 19.1.4
wanted: 19.1.4
react-native:
installed: 0.81.6
wanted: 0.81.6
react-native-windows:
installed: 0.81.35
wanted: 0.81.35
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.87.1 is now available (your project is running on v0.81.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.87.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.81.6&to=0.87.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".
Community Modules
It's an Expo Windows project:
"expo": "~54.0.35",
"expo-desktop-modules-core": "~54.0.14-beta.0",
"expo-desktop-prebuild-config": "~1.1.0-beta.0",
"expo-desktop-stubs": "~54.0.14-beta.0",
"expo-status-bar": "~3.0.9",
"react": "19.1.4",
"react-native": "0.81.6",
"react-native-macos": "0.81.7",
"react-native-windows": "0.81.35"
Target React Native Architecture
New Architecture (WinAppSDK) Only
Target Platform Version
10.0.26100
Visual Studio Version
Visual Studio 2026
Build Configuration
No response
Snack, code example, screenshot, or link to a repository
See "Steps to Reproduce" for minimal code example, and "Problem Description" for screenshots.
- 主要语言
- C++
- 星标
- 17.4k
- 派生
- 1.2k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 13
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/react-native-windows 的其他 Issue
-
Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/react-native-windows#16340 ·
维护者通常 2 天内回复
-
bug Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/react-native-windows#16321 · 1 条评论 ·
维护者通常 2 天内回复
-
Needs: Triage :mag:
难度 5/5 一周以上 新手友好度 30/100
microsoft/react-native-windows#16442 · 1 条评论 ·
维护者通常 2 天内回复
-
Fabric: activating the window doesn't announce the window or the focused control to a screen reader未关闭Needs: Triage :mag:
难度 4/5 3-5 天 新手友好度 48/100
microsoft/react-native-windows#16435 ·
维护者通常 2 天内回复
-
bug Invalid Triage Needs: Triage :mag:
难度 4/5 3-5 天 新手友好度 55/100
microsoft/react-native-windows#16368 ·
维护者通常 2 天内回复
查看 microsoft/react-native-windows 的全部 Issue
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
flashinfer-ai/flashinfer#6212 ·
维护者通常 1 天内回复
-
bug graphics
难度 2/5 1-3 小时 新手友好度 76/100
FlaxEngine/FlaxEngine#4295 · 2 条评论 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
Algorithmiq/monoprop#390 ·
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
8-membered-ring atrop stereo lost in 2026.09.1可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 半天 新手友好度 86/100
维护者通常 2 天内回复