Control SwiftUI and Compose State Synchronously with Worklets in Expo UI
Expo UI has introduced worklet integration in SDK 56, allowing developers to control SwiftUI and Compose state directly on the UI thread. This eliminates the need for JavaScript round-trips, resulting in smoother user interactions. The new feature enhances input masking and opens up more synchronous alternatives for React Native developers.
- ▪Expo UI's worklet integration allows for direct control of SwiftUI and Compose state on the UI thread.
- ▪Developers can now achieve input masking without visible delays or corrections during typing.
- ▪The useNativeState function creates an ObservableState that is observed by both SwiftUI and Compose.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 1258232) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Dan for Expo Posted on May 28 • Originally published at expo.dev Control SwiftUI and Compose State Synchronously with Worklets in Expo UI #expo #reactnative #javascript #mobile React Native developers have long dealt with the friction of bridging JavaScript with native UI threads. Every time you need to update native state, you send a message across the bridge, wait for the round-trip, and hope the user doesn't notice the delay.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).