What happened?
I noticed a discrepancy in how styles are parsed and applied on iOS vs Android. The issue appears to originate in the UniwindStoreBuilder class, specifically within the getStyles method.
Expected behavior
The expected execution order during style resolution is:
1. Resolve styles
2. Subscribe to cache
3. Subscribe to re-render
4. Invoke Uniwind methods if present (updateCSSVariables, updateInsets, etc.)
5. Run subscribed events during the re-render
6. Complete
• Trigger additional re-renders if any Uniwind method notifies event dependencies
This flow works correctly on iOS.
Actual behavior on Android
On Android, events are fired before the re-render subscription is established. As a result, Uniwind methods that are expected to notify event dependencies (such as updateInsets) do not trigger the intended downstream updates.
In short:
• Event callbacks execute too early
• Re-render listeners are not yet subscribed
• Dependency notifications from Uniwind methods are missed
Steps to Reproduce
- iOS follows the expected subscription and execution order
- Android triggers events before re-render subscriptions are in place
- This prevents Uniwind methods from correctly notifying event dependencies
- The issue appears isolated to the execution order within getStyles
To reproduce:
- Log at
src/core/native/store.ts#L38
- Log at
src/components/native/useStyle.ts#L25
- Log at
src/core/listener.ts#L43
- Log before you call eg.
Uniwind.updateInsets
Snack or Repository Link
https://gist.github.com/divineniiquaye/cec774b3b6867769254ae75592b533c1
Uniwind version
1.2.2
React Native Version
0.81.5
Platforms
Android
Expo
Yes
Additional information
What happened?
I noticed a discrepancy in how styles are parsed and applied on iOS vs Android. The issue appears to originate in the UniwindStoreBuilder class, specifically within the getStyles method.
Expected behavior
The expected execution order during style resolution is:
1. Resolve styles
2. Subscribe to cache
3. Subscribe to re-render
4. Invoke Uniwind methods if present (updateCSSVariables, updateInsets, etc.)
5. Run subscribed events during the re-render
6. Complete
• Trigger additional re-renders if any Uniwind method notifies event dependencies
This flow works correctly on iOS.
Actual behavior on Android
On Android, events are fired before the re-render subscription is established. As a result, Uniwind methods that are expected to notify event dependencies (such as updateInsets) do not trigger the intended downstream updates.
In short:
• Event callbacks execute too early
• Re-render listeners are not yet subscribed
• Dependency notifications from Uniwind methods are missed
Steps to Reproduce
To reproduce:
src/core/native/store.ts#L38src/components/native/useStyle.ts#L25src/core/listener.ts#L43Uniwind.updateInsetsSnack or Repository Link
https://gist.github.com/divineniiquaye/cec774b3b6867769254ae75592b533c1
Uniwind version
1.2.2
React Native Version
0.81.5
Platforms
Android
Expo
Yes
Additional information