Commit 8097087
Fix PaywallView styling timing issue with safe forced layout updates
Fixes an issue where styles applied to RevenueCatUI.Paywall component
were not being applied immediately. The problem was that the paywall's
native view setup was deferred until layoutSubviews, causing a timing
issue with React Native's style application.
This solution preserves the original view hierarchy timing while forcing
immediate layout updates when React Native applies style changes, with
robust protection against infinite layout loops.
Changes:
- Override reactSetFrame, setBounds, and setFrame methods
- Call setNeedsLayout + layoutIfNeeded to force immediate layout updates
- Add isInLayoutUpdate flag to prevent infinite layout loops
- Use dispatch_async to break synchronous recursion chains
- Only trigger layout for actual frame/bounds changes
- Preserve original view controller hierarchy setup timing
This approach is safer than restructuring the view hierarchy timing as it:
- Maintains SwiftUI environment context
- Preserves safe area and layout guide behavior
- Works with React Native's layout system
- Protected against infinite layout loops
Fixes #1366
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent a718688 commit 8097087
1 file changed
+48
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
47 | 88 | | |
48 | 89 | | |
49 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
50 | 94 | | |
51 | 95 | | |
52 | 96 | | |
| |||
74 | 118 | | |
75 | 119 | | |
76 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
77 | 124 | | |
78 | 125 | | |
79 | 126 | | |
| |||
0 commit comments