expo-modules-core 57.0.21 → 57.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 57.0.22 — 2026-10-12
14
+
15
+ ### 🎉 New features
16
+
17
+ - Lay out `RNHostView` hosted content at the size SwiftUI or Compose gives it on an axis that `matchContents` does not match. ([#50674](https://github.com/expo/expo/pull/50674) by [@nishan](https://github.com/intergalacticspacehighway))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - [Android] Fix views sized by Jetpack Compose, such as `RNHostView` in a `ModalBottomSheet`, that kept their old size until the keyboard animation ended when the keyboard was dismissed with the predictive back gesture. ([#51083](https://github.com/expo/expo/pull/51083) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
22
+
13
23
  ## 57.0.21 — 2026-10-06
14
24
 
15
25
  ### 🐛 Bug fixes
@@ -27,7 +27,7 @@ if (shouldIncludeCompose) {
27
27
  }
28
28
 
29
29
  group = 'host.exp.exponent'
30
- version = '57.0.21'
30
+ version = '57.0.22'
31
31
 
32
32
  def isExpoModulesCoreTests = {
33
33
  Gradle gradle = getGradle()
@@ -94,7 +94,7 @@ android {
94
94
  defaultConfig {
95
95
  consumerProguardFiles 'proguard-rules.pro'
96
96
  versionCode 1
97
- versionName "57.0.21"
97
+ versionName "57.0.22"
98
98
  buildConfigField "String", "EXPO_MODULES_CORE_VERSION", "\"${versionName}\""
99
99
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"
100
100
 
@@ -1,7 +1,9 @@
1
1
  package expo.modules.kotlin.views
2
2
 
3
3
  import android.view.ViewTreeObserver
4
+ import androidx.annotation.UiThread
4
5
  import expo.modules.kotlin.jni.fabric.NativeStatePropsGetter
6
+ import kotlinx.coroutines.launch
5
7
  import java.lang.ref.WeakReference
6
8
 
7
9
  class ShadowNodeProxy(expoView: ExpoView) {
@@ -10,18 +12,24 @@ class ShadowNodeProxy(expoView: ExpoView) {
10
12
 
11
13
  private var pendingFlush: ((stateWrapper: Any) -> Unit)? = null
12
14
  private var preDrawListener: ViewTreeObserver.OnPreDrawListener? = null
13
- private val flushRunnable = Runnable { drainPendingFlush() }
15
+ private var flushPosted = false
16
+ private val flushRunnable = Runnable {
17
+ flushPosted = false
18
+ drainPendingFlush()
19
+ }
14
20
 
15
21
  // Schedule in predraw listener to avoid early return in re-entrancy
16
22
  // We have a proper fix [here](https://github.com/facebook/react-native/pull/56311)
17
23
  // but it needs to be merged in RN
18
24
  // TODO: Remove the workaround when RN PR gets merged.
25
+ @UiThread
19
26
  fun setViewSize(width: Double, height: Double) {
20
27
  scheduleFlush { stateWrapper ->
21
28
  stateUpdater.updateViewSizeImmediate(stateWrapper, width, height)
22
29
  }
23
30
  }
24
31
 
32
+ @UiThread
25
33
  fun setStyleSize(width: Double?, height: Double?) {
26
34
  scheduleFlush { stateWrapper ->
27
35
  stateUpdater.updateStyleSizeImmediate(stateWrapper, width ?: Double.NaN, height ?: Double.NaN)
@@ -68,8 +76,18 @@ class ShadowNodeProxy(expoView: ExpoView) {
68
76
 
69
77
  // Predraw listener do not get called for each keyboard transition event so we add a fallback flush to be called here
70
78
  // https://github.com/expo/expo/issues/47778
71
- view.removeCallbacks(flushRunnable)
72
- view.post(flushRunnable)
79
+ // Async and posted once, so it still runs during animations.
80
+ // `Dispatchers.Main` posts async messages, which skip the traversal sync barriers.
81
+ // https://github.com/expo/expo/issues/51034
82
+ if (!flushPosted) {
83
+ flushPosted = true
84
+ if (view.isAttachedToWindow) {
85
+ view.appContext.mainQueue.launch { flushRunnable.run() }
86
+ } else {
87
+ // `view.post` keeps the runnable until the view attaches.
88
+ view.post(flushRunnable)
89
+ }
90
+ }
73
91
  }
74
92
 
75
93
  private fun drainPendingFlush() {
@@ -61,17 +61,47 @@ public:
61
61
 
62
62
  const auto snode = dynamic_cast<ShadowNodeType *>(&shadowNode);
63
63
  const auto state = snode->getStateData();
64
+ auto const &sharedProps = snode->getProps();
65
+ auto &style = const_cast<facebook::yoga::Style &>(
66
+ static_cast<const facebook::react::ViewProps &>(*sharedProps).yogaStyle);
67
+ bool propsStyleChanged = false;
64
68
 
69
+ if (isRNHostView(sharedProps)) {
70
+ // If RNHostView has align self set to auto or stretch, we should override it to flex-start so that the node can size itself to its content
71
+ auto const alignSelf = style.alignSelf();
72
+
73
+ if (alignSelf == facebook::yoga::Align::Auto || alignSelf == facebook::yoga::Align::Stretch) {
74
+ style.setAlignSelf(facebook::yoga::Align::FlexStart);
75
+ propsStyleChanged = true;
76
+ }
77
+ }
78
+
79
+ // handle layout style prop update
80
+ if (!isnan(state._styleWidth)) {
81
+ style.setDimension(facebook::yoga::Dimension::Width,
82
+ facebook::yoga::StyleSizeLength::points(state._styleWidth));
83
+ propsStyleChanged = true;
84
+ }
85
+
86
+ if (!isnan(state._styleHeight)) {
87
+ style.setDimension(facebook::yoga::Dimension::Height,
88
+ facebook::yoga::StyleSizeLength::points(state._styleHeight));
89
+ propsStyleChanged = true;
90
+ }
91
+
92
+ if (propsStyleChanged) {
93
+ // Updates yoga style from props and sets the node dirty
94
+ snode->updateYogaProps();
95
+ }
96
+
97
+ // Writes the node style directly, so it runs last.
65
98
  auto width = state._width;
66
99
  auto height = state._height;
67
100
 
68
101
  if (!isnan(width) || !isnan(height)) {
69
- auto const &props = *std::static_pointer_cast<const facebook::react::ViewProps>(
70
- snode->getProps());
71
-
72
102
  // The node has width and/or height set as style props, so we should not override it
73
- auto widthProp = props.yogaStyle.dimension(facebook::yoga::Dimension::Width);
74
- auto heightProp = props.yogaStyle.dimension(facebook::yoga::Dimension::Height);
103
+ auto widthProp = style.dimension(facebook::yoga::Dimension::Width);
104
+ auto heightProp = style.dimension(facebook::yoga::Dimension::Height);
75
105
 
76
106
  if (widthProp.value().isDefined()) {
77
107
  // view has fixed dimension size set in props, so we should not autosize it in that axis
@@ -84,44 +114,6 @@ public:
84
114
  snode->setSize({width, height});
85
115
  }
86
116
 
87
- // handle layout style prop update
88
- auto styleWidth = state._styleWidth;
89
- auto styleHeight = state._styleHeight;
90
-
91
- if (!isnan(styleWidth) || !isnan(styleHeight)) {
92
- auto const &props = *std::static_pointer_cast<const facebook::react::ViewProps>(
93
- snode->getProps());
94
-
95
- auto &style = const_cast<facebook::yoga::Style &>(props.yogaStyle);
96
-
97
- if (!isnan(styleWidth)) {
98
- style.setDimension(facebook::yoga::Dimension::Width,
99
- facebook::yoga::StyleSizeLength::points(styleWidth));
100
- }
101
-
102
- if (!isnan(styleHeight)) {
103
- style.setDimension(facebook::yoga::Dimension::Height,
104
- facebook::yoga::StyleSizeLength::points(styleHeight));
105
- }
106
-
107
- // Updates yoga style from props and sets the node dirty
108
- snode->updateYogaProps();
109
- }
110
-
111
- if (isRNHostView(snode->getProps())) {
112
- auto const &props = *std::static_pointer_cast<const facebook::react::ViewProps>(
113
- snode->getProps());
114
- auto &style = const_cast<facebook::yoga::Style &>(props.yogaStyle);
115
-
116
- // If RNHostView has align self set to auto or stretch, we should override it to flex-start so that the node can size itself to its content
117
- auto const alignSelf = style.alignSelf();
118
-
119
- if (alignSelf == facebook::yoga::Align::Auto || alignSelf == facebook::yoga::Align::Stretch) {
120
- style.setAlignSelf(facebook::yoga::Align::FlexStart);
121
- snode->updateYogaProps();
122
- }
123
- }
124
-
125
117
  facebook::react::ConcreteComponentDescriptor<ShadowNodeType>::adopt(shadowNode);
126
118
  }
127
119
  };
@@ -163,6 +163,20 @@ private:
163
163
  }
164
164
 
165
165
  react::LayoutConstraints hostedContentConstraints(const react::ShadowNode &content) const {
166
+ auto constraints = contentStyleConstraints(content);
167
+
168
+ // An unmatched axis has the size SwiftUI or Compose gave the host (from `setViewSize`), so lay
169
+ // the content out at exactly that size. This overrides the content's own min/max on that axis.
170
+ auto const &ownStyle = this->yogaNode_.style();
171
+ constrainExactlyToPoints(ownStyle.dimension(facebook::yoga::Dimension::Width),
172
+ constraints.minimumSize.width, constraints.maximumSize.width);
173
+ constrainExactlyToPoints(ownStyle.dimension(facebook::yoga::Dimension::Height),
174
+ constraints.minimumSize.height, constraints.maximumSize.height);
175
+
176
+ return constraints;
177
+ }
178
+
179
+ react::LayoutConstraints contentStyleConstraints(const react::ShadowNode &content) const {
166
180
  react::LayoutConstraints constraints{};
167
181
  constraints.layoutDirection = resolvedLayoutDirection();
168
182
 
@@ -186,6 +200,14 @@ private:
186
200
  return constraints;
187
201
  }
188
202
 
203
+ static void constrainExactlyToPoints(facebook::yoga::StyleSizeLength length,
204
+ react::Float &minimum,
205
+ react::Float &maximum) {
206
+ if (length.isPoints() && length.value().isDefined()) {
207
+ minimum = maximum = std::max<react::Float>(0, length.value().unwrap());
208
+ }
209
+ }
210
+
189
211
  static void constrainToPoints(facebook::yoga::StyleSizeLength length, react::Float &constraint) {
190
212
  if (length.isPoints() && length.value().isDefined()) {
191
213
  constraint = std::max<react::Float>(0, length.value().unwrap());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "57.0.21",
3
+ "version": "57.0.22",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@expo/expo-modules-macros-plugin": "0.6.1",
50
- "expo-modules-jsi": "~57.1.1",
50
+ "expo-modules-jsi": "~57.1.2",
51
51
  "invariant": "^2.2.4"
52
52
  },
53
53
  "peerDependencies": {
@@ -66,7 +66,7 @@
66
66
  "@types/invariant": "^2.2.33",
67
67
  "expo-module-scripts": "56.0.3"
68
68
  },
69
- "gitHead": "50ac74f1ab5682c8e32b24da6e5e97dd4dbbb80f",
69
+ "gitHead": "58da4edafcb043872c3ed9bf8f5957e6544d0a9c",
70
70
  "scripts": {
71
71
  "build": "expo-module build",
72
72
  "clean": "expo-module clean",