Commit 336042c
Fix RCTDevLoadingView dismiss button not appearing (#54696)
Summary:
Pull Request resolved: #54696
Changelog: [iOS][Fixed] - Fixed dismiss button not appearing consistently in dev loading view
D87465522 introduced lazy initialization to reuse views across multiple `showMessage` calls for better performance. However, this exposed two bugs:
1. **Missing button bug**: Button creation was inside the `if (self->_container == nullptr)` block, which now only executes once. If the first call had `dismissButton=NO`, subsequent calls with `dismissButton=YES` would skip button creation since the container already existed.
2. **Button text wrapping bug**: The button didn't have compression resistance priority set, so Auto Layout could compress it to fit the layout, causing the text to wrap.
This fixes both issues by:
- Moving button creation/removal logic outside the container initialization so it runs on every call and dynamically adds or removes the button based on the current `dismissButton` parameter
- Setting compression resistance and content hugging priorities on the button to prevent it from being compressed, forcing the message label to wrap instead
- Resetting all UI elements in `hide()` to ensure clean state between loading sessions
The performance optimization from D87465522 is preserved - views are still reused during rapid Metro progress updates.
Reviewed By: javache
Differential Revision: D87870932
fbshipit-source-id: 052d4a0685ee288e3b4bf974b203e4f29c6524361 parent ac31e96 commit 336042c
File tree
1 file changed
+44
-29
lines changed- packages/react-native/React/CoreModules
1 file changed
+44
-29
lines changedLines changed: 44 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
127 | | - | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 136 | | |
164 | 137 | | |
165 | 138 | | |
166 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
| |||
245 | 257 | | |
246 | 258 | | |
247 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
248 | 263 | | |
249 | 264 | | |
250 | 265 | | |
| |||
0 commit comments