Worklet integration in Expo UI: synchronously controlling SwiftUI and Compose state
Blog post from Expo
Expo SDK 56 introduces a significant enhancement to the Expo UI by integrating UI runtime worklets, facilitated by react-native-worklets, which allows event callbacks to operate synchronously on the UI thread. This development enables seamless control of UI state without reverting to the JS thread, exemplified by synchronous input masking in TextFields, where each keystroke immediately updates the shared text state, allowing for flicker-free formatting like credit card numbers directly on the UI thread. The integration of worklets provides a native-feeling user experience and presents a synchronous alternative to existing asynchronous methods, applicable to various use cases such as phone numbers and currency formatting. This enhancement is compatible with both SwiftUI and Jetpack Compose, and while TextInput is the first component to feature synchronous callbacks, more components are expected to follow in future updates.