@expo/ui 58.0.23 → 58.0.24
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 +16 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +6 -4
- package/android/src/main/java/expo/modules/ui/HostView.kt +33 -7
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +138 -2
- package/android/src/main/java/expo/modules/ui/SliderView.kt +5 -4
- package/android/src/main/java/expo/modules/ui/VerticalSliderView.kt +5 -4
- package/build/community/bottom-sheet/BottomSheet.android.js +2 -0
- package/build/community/bottom-sheet/BottomSheet.android.js.map +1 -1
- package/build/community/menu/MenuView.ios.js +2 -1
- package/build/community/menu/MenuView.ios.js.map +1 -1
- package/build/jetpack-compose/Text/index.js +5 -4
- package/build/jetpack-compose/Text/index.js.map +1 -1
- package/build/swift-ui/ContentUnavailableView/index.d.ts +5 -0
- package/build/swift-ui/ContentUnavailableView/index.js +7 -2
- package/build/swift-ui/ContentUnavailableView/index.js.map +1 -1
- package/build/swift-ui/RNHostView.d.ts +7 -1
- package/build/swift-ui/RNHostView.js +2 -1
- package/build/swift-ui/RNHostView.js.map +1 -1
- package/build/swift-ui/Text/index.js +2 -1
- package/build/swift-ui/Text/index.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +18 -0
- package/build/swift-ui/modifiers/index.js +9 -0
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/build/universal/BottomSheet/index.android.js +5 -5
- package/build/universal/BottomSheet/index.android.js.map +1 -1
- package/build/utils/flattenFragments.d.ts +7 -0
- package/build/utils/flattenFragments.js +17 -0
- package/build/utils/flattenFragments.js.map +1 -0
- package/ios/ContentUnavailableView.swift +9 -1
- package/ios/Modifiers/FontModifier.swift +27 -0
- package/ios/Modifiers/SectionIndexLabelModifier.swift +21 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +22 -0
- package/ios/RNHostView.swift +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.23/expo.modules.ui-58.0.23-sources.jar → 58.0.24/expo.modules.ui-58.0.24-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.23/expo.modules.ui-58.0.23.module → 58.0.24/expo.modules.ui-58.0.24.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.23/expo.modules.ui-58.0.23.pom → 58.0.24/expo.modules.ui-58.0.24.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha512 +1 -0
- package/package.json +1 -1
- package/src/community/bottom-sheet/BottomSheet.android.tsx +2 -1
- package/src/community/menu/MenuView.ios.tsx +3 -2
- package/src/jetpack-compose/Text/index.tsx +5 -4
- package/src/swift-ui/ContentUnavailableView/index.tsx +19 -4
- package/src/swift-ui/RNHostView.tsx +8 -1
- package/src/swift-ui/Text/index.tsx +2 -1
- package/src/swift-ui/modifiers/index.ts +19 -0
- package/src/universal/BottomSheet/index.android.tsx +3 -1
- package/src/utils/flattenFragments.ts +22 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Fix a crash when dragging `Slider` or `VerticalSlider` in release builds. Their `onValueChange` and `onValueChangeFinished` events are now declared with `Event<T>()` in the view definition, as `ToggleButton` and `TextField` already do. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
8
|
+
- [Android] Fix the Jetpack Compose `Text` dropping nested `Text` spans and strings that are inside a React fragment. Move the fragment flattening helper to a shared util used by both the SwiftUI and Jetpack Compose `Text`. ([#52227](https://github.com/expo/expo/pull/52227) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
9
|
+
- [iOS] Add an `actions` prop to `ContentUnavailableView`, which shows controls below the description. ([#52190](https://github.com/expo/expo/pull/52190) by [@drewvolz](https://github.com/drewvolz))
|
|
10
|
+
- [iOS] Add `smallCaps` and `leading` options to the `font` modifier, which apply SwiftUI's `Font.smallCaps()` and `Font.leading(_:)`. ([#52189](https://github.com/expo/expo/pull/52189) by [@drewvolz](https://github.com/drewvolz))
|
|
11
|
+
- [Android] Fix an `@expo/ui` control inside a `Pressable` losing taps to the `Pressable`. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
12
|
+
- [iOS] Apply the `underline` and `strikethrough` modifiers to a nested `Text`. Before, a nested `Text` dropped them, and a debug build showed a "not supported for nested Text" warning. ([#52112](https://github.com/expo/expo/pull/52112) by [@drewvolz](https://github.com/drewvolz))
|
|
13
|
+
- [iOS] Fix the SwiftUI `Text` dropping nested `Text` spans and strings that are inside a React fragment. `Text` now flattens fragment children before it concatenates them. ([#52225](https://github.com/expo/expo/pull/52225) by [@expo-bot](https://github.com/expo-bot))
|
|
14
|
+
- [iOS] Fix `MenuView` triggers that fill their parent, so text in them wraps and they resize on rotation. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
15
|
+
- [Android] Fix a tap on plain React Native content in `RNHostView` not reaching a parent Compose `clickable`. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
16
|
+
- [iOS] Add the `sectionIndexLabel` modifier, which sets the label a list's section index shows for a `Section` on iOS 26 and later. ([#52186](https://github.com/expo/expo/pull/52186) by [@drewvolz](https://github.com/drewvolz))
|
|
17
|
+
- [Android] Fix the universal `BottomSheet` and the community `BottomSheet` / `BottomSheetModal` not opening inside a `FlatList` (or another view with `removeClippedSubviews`). ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
|
|
18
|
+
|
|
3
19
|
## 58.0.23
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '58.0.
|
|
15
|
+
version = '58.0.24'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "58.0.
|
|
21
|
+
versionName "58.0.24"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -359,18 +359,20 @@ class ExpoUIModule : Module() {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
ExpoUIView<SliderProps>("SliderView") {
|
|
362
|
-
|
|
362
|
+
val onValueChange by Event<SliderValueChangedEvent>()
|
|
363
|
+
val onValueChangeFinished by Event<Unit>()
|
|
363
364
|
|
|
364
365
|
Content { props ->
|
|
365
|
-
SliderContent(props)
|
|
366
|
+
SliderContent(props, { onValueChange(it) }, { onValueChangeFinished(it) })
|
|
366
367
|
}
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
ExpoUIView<VerticalSliderProps>("VerticalSliderView") {
|
|
370
|
-
|
|
371
|
+
val onValueChange by Event<SliderValueChangedEvent>()
|
|
372
|
+
val onValueChangeFinished by Event<Unit>()
|
|
371
373
|
|
|
372
374
|
Content { props ->
|
|
373
|
-
VerticalSliderContent(props)
|
|
375
|
+
VerticalSliderContent(props, { onValueChange(it) }, { onValueChangeFinished(it) })
|
|
374
376
|
}
|
|
375
377
|
}
|
|
376
378
|
|
|
@@ -40,6 +40,7 @@ import androidx.compose.ui.unit.Density
|
|
|
40
40
|
import androidx.compose.ui.unit.IntSize
|
|
41
41
|
import androidx.compose.ui.unit.LayoutDirection
|
|
42
42
|
import androidx.compose.ui.unit.dp
|
|
43
|
+
import com.facebook.react.uimanager.events.NativeGestureUtil
|
|
43
44
|
import expo.modules.kotlin.AppContext
|
|
44
45
|
import expo.modules.kotlin.records.Field
|
|
45
46
|
import expo.modules.kotlin.records.Record
|
|
@@ -136,16 +137,41 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
136
137
|
internal var isDispatchingCancelFromParent = false
|
|
137
138
|
private set
|
|
138
139
|
|
|
140
|
+
// Set by a hosted `RNHostView` under the down. That content handles its touches in JS.
|
|
141
|
+
internal var reactNativeContentHit = false
|
|
142
|
+
private var ownsNativeGesture = false
|
|
143
|
+
|
|
139
144
|
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
|
140
|
-
if (ev.actionMasked
|
|
141
|
-
|
|
145
|
+
if (ev.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
146
|
+
reactNativeContentHit = false
|
|
147
|
+
ownsNativeGesture = false
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
val handled = if (ev.actionMasked != MotionEvent.ACTION_CANCEL) {
|
|
151
|
+
super.dispatchTouchEvent(ev)
|
|
152
|
+
} else {
|
|
153
|
+
isDispatchingCancelFromParent = true
|
|
154
|
+
try {
|
|
155
|
+
super.dispatchTouchEvent(ev)
|
|
156
|
+
} finally {
|
|
157
|
+
isDispatchingCancelFromParent = false
|
|
158
|
+
}
|
|
142
159
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
|
|
161
|
+
when (ev.actionMasked) {
|
|
162
|
+
// Compose only handles a down that a touch handler is under, like a native view.
|
|
163
|
+
// Then cancel the JS touch, so a JS responder around this view can't take the gesture.
|
|
164
|
+
MotionEvent.ACTION_DOWN -> if (handled && !reactNativeContentHit) {
|
|
165
|
+
ownsNativeGesture = true
|
|
166
|
+
NativeGestureUtil.notifyNativeGestureStarted(this, ev)
|
|
167
|
+
}
|
|
168
|
+
// On a cancel, a native parent like a scroll view took over and ends the gesture itself.
|
|
169
|
+
MotionEvent.ACTION_UP -> if (ownsNativeGesture) {
|
|
170
|
+
ownsNativeGesture = false
|
|
171
|
+
NativeGestureUtil.notifyNativeGestureEnded(this, ev)
|
|
172
|
+
}
|
|
148
173
|
}
|
|
174
|
+
return handled
|
|
149
175
|
}
|
|
150
176
|
|
|
151
177
|
@Composable
|
|
@@ -2,6 +2,8 @@ package expo.modules.ui
|
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.content.Context
|
|
5
|
+
import android.text.Spanned
|
|
6
|
+
import android.text.style.ClickableSpan
|
|
5
7
|
import android.util.Log
|
|
6
8
|
import android.view.MotionEvent
|
|
7
9
|
import android.view.View
|
|
@@ -24,6 +26,8 @@ import androidx.compose.runtime.key
|
|
|
24
26
|
import androidx.compose.runtime.mutableStateOf
|
|
25
27
|
import androidx.compose.ui.Alignment
|
|
26
28
|
import androidx.compose.ui.Modifier
|
|
29
|
+
import androidx.compose.ui.input.pointer.PointerEventPass
|
|
30
|
+
import androidx.compose.ui.input.pointer.pointerInput
|
|
27
31
|
import androidx.compose.ui.layout.onGloballyPositioned
|
|
28
32
|
import androidx.compose.ui.layout.onSizeChanged
|
|
29
33
|
import androidx.compose.ui.layout.positionInRoot
|
|
@@ -31,6 +35,7 @@ import androidx.compose.ui.platform.AbstractComposeView
|
|
|
31
35
|
import androidx.compose.ui.platform.LocalDensity
|
|
32
36
|
import androidx.compose.ui.unit.IntSize
|
|
33
37
|
import androidx.compose.ui.viewinterop.AndroidView
|
|
38
|
+
import androidx.core.view.NestedScrollingChild
|
|
34
39
|
import androidx.core.view.NestedScrollingChild3
|
|
35
40
|
import androidx.core.view.NestedScrollingChildHelper
|
|
36
41
|
import androidx.core.view.ViewCompat
|
|
@@ -39,10 +44,16 @@ import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
|
39
44
|
import com.facebook.react.config.ReactFeatureFlags
|
|
40
45
|
import com.facebook.react.uimanager.JSPointerDispatcher
|
|
41
46
|
import com.facebook.react.uimanager.JSTouchDispatcher
|
|
47
|
+
import com.facebook.react.uimanager.ReactCompoundView
|
|
48
|
+
import com.facebook.react.uimanager.ReactCompoundViewGroup
|
|
42
49
|
import com.facebook.react.uimanager.RootView
|
|
43
50
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
51
|
+
import com.facebook.react.uimanager.TouchTargetHelper
|
|
44
52
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
45
53
|
import com.facebook.react.uimanager.events.EventDispatcher
|
|
54
|
+
import com.facebook.react.views.image.ReactImageView
|
|
55
|
+
import com.facebook.react.views.text.ReactTextView
|
|
56
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
46
57
|
import expo.modules.kotlin.AppContext
|
|
47
58
|
import expo.modules.kotlin.views.ComposableScope
|
|
48
59
|
import expo.modules.kotlin.views.ComposeProps
|
|
@@ -204,6 +215,7 @@ internal class RNHostView(context: Context, appContext: AppContext) :
|
|
|
204
215
|
val modifiers = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, scope, globalEventDispatcher)
|
|
205
216
|
.then(sizingModifier)
|
|
206
217
|
.then(publishContentOriginModifier())
|
|
218
|
+
.then(reportComposeClaimModifier(wrapper))
|
|
207
219
|
|
|
208
220
|
// `addView` creates a new wrapper for each mounted child, and `AndroidView` only calls `factory` once.
|
|
209
221
|
key(wrapper) {
|
|
@@ -296,6 +308,23 @@ internal class RNHostView(context: Context, appContext: AppContext) :
|
|
|
296
308
|
}
|
|
297
309
|
}
|
|
298
310
|
|
|
311
|
+
// After every handler has run, a consumed change means Compose claimed the gesture.
|
|
312
|
+
private fun reportComposeClaimModifier(wrapper: TouchDispatchingRootViewGroup): Modifier =
|
|
313
|
+
Modifier.pointerInput(wrapper) {
|
|
314
|
+
awaitPointerEventScope {
|
|
315
|
+
while (true) {
|
|
316
|
+
val event = awaitPointerEvent(PointerEventPass.Final)
|
|
317
|
+
if (event.changes.any { it.isConsumed }) {
|
|
318
|
+
wrapper.onComposeClaimedGesture()
|
|
319
|
+
}
|
|
320
|
+
// Also covers gestures whose down never reached the wrapper.
|
|
321
|
+
if (event.changes.all { !it.pressed }) {
|
|
322
|
+
wrapper.clearGestureLeftToCompose()
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
299
328
|
// Sets Yoga node size from Compose view size
|
|
300
329
|
// Listens to Compose view size changes and updates the Yoga node size
|
|
301
330
|
@Composable
|
|
@@ -440,6 +469,9 @@ private class TouchDispatchingRootViewGroup(
|
|
|
440
469
|
*/
|
|
441
470
|
var dispatchesTouchesToJS: Boolean = false
|
|
442
471
|
|
|
472
|
+
// The down of a gesture this view left to Compose, until Compose claims it or the next gesture.
|
|
473
|
+
private var gestureLeftToCompose: MotionEvent? = null
|
|
474
|
+
|
|
443
475
|
private val reactContext: ThemedReactContext
|
|
444
476
|
get() = context as ThemedReactContext
|
|
445
477
|
|
|
@@ -478,7 +510,23 @@ private class TouchDispatchingRootViewGroup(
|
|
|
478
510
|
composeOwnerView?.let { keepLastForTouchTargeting(it, hostedViewsContainer) }
|
|
479
511
|
}
|
|
480
512
|
|
|
513
|
+
override fun onDetachedFromWindow() {
|
|
514
|
+
super.onDetachedFromWindow()
|
|
515
|
+
clearGestureLeftToCompose()
|
|
516
|
+
}
|
|
517
|
+
|
|
481
518
|
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
|
519
|
+
if (ev.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
520
|
+
// This view handles the JS side of its gestures, so the `Host` must not cancel them.
|
|
521
|
+
findAncestorHostView()?.reactNativeContentHit = true
|
|
522
|
+
// Like a native view that doesn't handle touches, plain hosted content lets the Compose
|
|
523
|
+
// parent handle the gesture. Only a host that dispatches to JavaScript must own its gestures.
|
|
524
|
+
clearGestureLeftToCompose()
|
|
525
|
+
if (!dispatchesTouchesToJS && !hasNativeTouchTarget(ev.x, ev.y)) {
|
|
526
|
+
gestureLeftToCompose = MotionEvent.obtain(ev)
|
|
527
|
+
return false
|
|
528
|
+
}
|
|
529
|
+
}
|
|
482
530
|
if (
|
|
483
531
|
ev.actionMasked == MotionEvent.ACTION_CANCEL &&
|
|
484
532
|
!dispatchesTouchesToJS &&
|
|
@@ -544,14 +592,102 @@ private class TouchDispatchingRootViewGroup(
|
|
|
544
592
|
* reporting it as a native one would cancel the press it belongs to.
|
|
545
593
|
*/
|
|
546
594
|
private fun isCancelFromReactNative(): Boolean {
|
|
595
|
+
return findAncestorHostView()?.isDispatchingCancelFromParent ?: false
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Whether a view under the point handles touches natively, like a scroll view, a text input, a
|
|
600
|
+
* switch, or a nested `Host`. Plain views, text and images only reach JavaScript through the
|
|
601
|
+
* ancestor root, so they don't count.
|
|
602
|
+
*/
|
|
603
|
+
private fun hasNativeTouchTarget(x: Float, y: Float): Boolean {
|
|
604
|
+
// React Native's own hit test, so `hitSlop`, transforms, `zIndex`, `pointerEvents` and children
|
|
605
|
+
// drawn outside their parent pick the same target that JavaScript gets.
|
|
606
|
+
// `targetPoint` ends up relative to the deepest view under the point.
|
|
607
|
+
val targetPoint = FloatArray(2)
|
|
608
|
+
val path = TouchTargetHelper.findTargetPathAndCoordinatesForTouch(x, y, this, targetPoint)
|
|
609
|
+
val targetView = path.firstNotNullOfOrNull { it.getView() }
|
|
610
|
+
return path.any { target ->
|
|
611
|
+
val view = target.getView()
|
|
612
|
+
val localPoint = targetPoint.takeIf { view === targetView }
|
|
613
|
+
view != null && view !== this && handlesTouchesNatively(view, localPoint)
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
private fun handlesTouchesNatively(view: View, localPoint: FloatArray?): Boolean {
|
|
618
|
+
return when {
|
|
619
|
+
// React Native makes a `Pressable` clickable. `accessible` alone only makes a view focusable.
|
|
620
|
+
view is ReactViewGroup || view is ReactImageView -> view.isClickable || view.isLongClickable
|
|
621
|
+
// A `Text` with `onPress` is focusable on Android, and a nested one is a link span.
|
|
622
|
+
view is ReactTextView ->
|
|
623
|
+
view.isClickable ||
|
|
624
|
+
view.isLongClickable ||
|
|
625
|
+
view.isFocusable ||
|
|
626
|
+
hasLinkSpanAt(view, localPoint)
|
|
627
|
+
// `PreparedLayoutTextView` is internal, so it's matched as React Native's other text view type.
|
|
628
|
+
view is ReactCompoundView && view !is ReactCompoundViewGroup ->
|
|
629
|
+
view.isClickable || view.isLongClickable || view.isFocusable
|
|
630
|
+
// A nested `Host` can hold Compose controls.
|
|
631
|
+
view is ExpoComposeView<*> -> true
|
|
632
|
+
// Other native views: controls, text inputs and scroll views handle touches. Views that only
|
|
633
|
+
// draw, like an image or a gradient, don't.
|
|
634
|
+
else ->
|
|
635
|
+
view.isClickable ||
|
|
636
|
+
view.isLongClickable ||
|
|
637
|
+
view.isFocusable ||
|
|
638
|
+
view.isScrollContainer ||
|
|
639
|
+
view is NestedScrollingChild ||
|
|
640
|
+
view.canScrollVertically(1) || view.canScrollVertically(-1) ||
|
|
641
|
+
view.canScrollHorizontally(1) || view.canScrollHorizontally(-1)
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Only a link under the point counts, so the rest of the text still lets the parent handle it.
|
|
646
|
+
private fun hasLinkSpanAt(view: ReactTextView, localPoint: FloatArray?): Boolean {
|
|
647
|
+
if (localPoint == null) {
|
|
648
|
+
return false
|
|
649
|
+
}
|
|
650
|
+
val text = view.text as? Spanned ?: return false
|
|
651
|
+
val layout = view.layout ?: return false
|
|
652
|
+
val lineX = localPoint[0] - view.totalPaddingLeft + view.scrollX
|
|
653
|
+
val lineY = (localPoint[1] - view.totalPaddingTop + view.scrollY).toInt()
|
|
654
|
+
if (lineY < 0 || lineY > layout.height) {
|
|
655
|
+
return false
|
|
656
|
+
}
|
|
657
|
+
val line = layout.getLineForVertical(lineY)
|
|
658
|
+
if (lineX < layout.getLineLeft(line) || lineX > layout.getLineRight(line)) {
|
|
659
|
+
return false
|
|
660
|
+
}
|
|
661
|
+
val offset = layout.getOffsetForHorizontal(line, lineX)
|
|
662
|
+
return text.getSpans(offset, offset, ClickableSpan::class.java).isNotEmpty()
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* A gesture this view left to Compose reaches JavaScript through the ancestor root. When Compose
|
|
667
|
+
* takes it, for example a `clickable` press or a `LazyColumn` scroll, tell the root, so JavaScript
|
|
668
|
+
* cancels its touch the same way it does for a native child that claims a gesture.
|
|
669
|
+
*/
|
|
670
|
+
fun onComposeClaimedGesture() {
|
|
671
|
+
val down = gestureLeftToCompose ?: return
|
|
672
|
+
gestureLeftToCompose = null
|
|
673
|
+
notifyAncestorRootViews { it.onChildStartedNativeGesture(null, down) }
|
|
674
|
+
down.recycle()
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
fun clearGestureLeftToCompose() {
|
|
678
|
+
gestureLeftToCompose?.recycle()
|
|
679
|
+
gestureLeftToCompose = null
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
private fun findAncestorHostView(): HostView? {
|
|
547
683
|
var current: ViewParent? = parent
|
|
548
684
|
while (current != null) {
|
|
549
685
|
if (current is HostView) {
|
|
550
|
-
return current
|
|
686
|
+
return current
|
|
551
687
|
}
|
|
552
688
|
current = current.parent
|
|
553
689
|
}
|
|
554
|
-
return
|
|
690
|
+
return null
|
|
555
691
|
}
|
|
556
692
|
|
|
557
693
|
private inline fun notifyAncestorRootViews(block: (RootView) -> Unit) {
|
|
@@ -14,7 +14,6 @@ import androidx.compose.runtime.remember
|
|
|
14
14
|
import androidx.compose.runtime.setValue
|
|
15
15
|
import expo.modules.kotlin.records.Field
|
|
16
16
|
import expo.modules.kotlin.records.Record
|
|
17
|
-
import expo.modules.kotlin.viewevent.getValue
|
|
18
17
|
import expo.modules.kotlin.views.ComposeProps
|
|
19
18
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
20
19
|
import expo.modules.kotlin.types.OptimizedRecord
|
|
@@ -58,9 +57,11 @@ data class SliderValueChangedEvent(
|
|
|
58
57
|
|
|
59
58
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
60
59
|
@Composable
|
|
61
|
-
fun FunctionalComposableScope.SliderContent(
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
fun FunctionalComposableScope.SliderContent(
|
|
61
|
+
props: SliderProps,
|
|
62
|
+
onValueChange: (SliderValueChangedEvent) -> Unit,
|
|
63
|
+
onValueChangeFinished: (Unit) -> Unit
|
|
64
|
+
) {
|
|
64
65
|
val interactionSource = remember { MutableInteractionSource() }
|
|
65
66
|
|
|
66
67
|
val effectiveLower = maxOf(props.min, props.lowerLimit ?: Float.NEGATIVE_INFINITY)
|
|
@@ -12,7 +12,6 @@ import androidx.compose.runtime.getValue
|
|
|
12
12
|
import androidx.compose.runtime.mutableFloatStateOf
|
|
13
13
|
import androidx.compose.runtime.remember
|
|
14
14
|
import androidx.compose.runtime.setValue
|
|
15
|
-
import expo.modules.kotlin.viewevent.getValue
|
|
16
15
|
import expo.modules.kotlin.views.ComposeProps
|
|
17
16
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
18
17
|
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
@@ -33,9 +32,11 @@ data class VerticalSliderProps(
|
|
|
33
32
|
|
|
34
33
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
|
35
34
|
@Composable
|
|
36
|
-
fun FunctionalComposableScope.VerticalSliderContent(
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
fun FunctionalComposableScope.VerticalSliderContent(
|
|
36
|
+
props: VerticalSliderProps,
|
|
37
|
+
onValueChange: (SliderValueChangedEvent) -> Unit,
|
|
38
|
+
onValueChangeFinished: (Unit) -> Unit
|
|
39
|
+
) {
|
|
39
40
|
val interactionSource = remember { MutableInteractionSource() }
|
|
40
41
|
|
|
41
42
|
val effectiveLower = maxOf(props.min, props.lowerLimit ?: Float.NEGATIVE_INFINITY)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["community/bottom-sheet/BottomSheet.android.tsx"],"sourcesContent":[null],"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","StyleSheet","useWindowDimensions","View","Host","ModalBottomSheet","RNHostView","BottomSheetContext","BottomSheetInternalContext","SheetScrollContextReset","parseSnapPoint","useBottomSheet","extractBackgroundColor","backgroundStyle","undefined","flatten","backgroundColor","findNearestSnapPointIndex","snapPoints","position","length","parsedTarget","nearestIndex","nearestDistance","Infinity","forEach","snapPoint","index","parsedSnapPoint","type","distance","Math","abs","value","BottomSheet","props","ref","snapPointsProp","indexProp","onChange","onClose","onDismiss","enablePanDownToClose","enableDynamicSizing","handleComponent","children","width","hasMultipleSnapPoints","fitToContents","skipPartially","maxIndex","containerColor","internalContextValue","clampIndex","min","max","isOpen","setIsOpen","isOpenRef","current","pendingIndexRef","sheetRef","closedRef","onChangeRef","onCloseRef","onDismissRef","fireCloseCallbacks","handleDismiss","methods","snapToIndex","hide","then","clampedIndex","expand","partialExpand","close","snapToPosition","collapse","forceClose","present","dismiss","Provider","style","pointerEvents","onDismissRequest","skipPartiallyExpanded","initialFullyExpanded","showDragHandle","sheetGesturesEnabled","properties","shouldDismissOnBackPress","shouldDismissOnClickOutside","matchContents","flexGrow","height"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/F,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,eAAe;AAErE,SAASC,IAAI,QAAQ,6BAA6B;AAClD,SAASC,gBAAgB,QAAkC,yCAAyC;AACpG,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,YAAY;AAC3E,SAASC,uBAAuB,QAAQ,uBAAuB;AAE/D,SAASC,cAAc,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AGpD;IAEA,qBACE,KAAC5D,2BAA2ByE,QAAQ;QAAChD,OAAOmB;kBAC1C,cAAA,KAAC7C,mBAAmB0E,QAAQ;YAAChD,OAAOmC;
|
|
1
|
+
{"version":3,"sources":["community/bottom-sheet/BottomSheet.android.tsx"],"sourcesContent":[null],"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","StyleSheet","useWindowDimensions","View","Host","ModalBottomSheet","RNHostView","BottomSheetContext","BottomSheetInternalContext","SheetScrollContextReset","parseSnapPoint","useBottomSheet","extractBackgroundColor","backgroundStyle","undefined","flatten","backgroundColor","findNearestSnapPointIndex","snapPoints","position","length","parsedTarget","nearestIndex","nearestDistance","Infinity","forEach","snapPoint","index","parsedSnapPoint","type","distance","Math","abs","value","BottomSheet","props","ref","snapPointsProp","indexProp","onChange","onClose","onDismiss","enablePanDownToClose","enableDynamicSizing","handleComponent","children","width","hasMultipleSnapPoints","fitToContents","skipPartially","maxIndex","containerColor","internalContextValue","clampIndex","min","max","isOpen","setIsOpen","isOpenRef","current","pendingIndexRef","sheetRef","closedRef","onChangeRef","onCloseRef","onDismissRef","fireCloseCallbacks","handleDismiss","methods","snapToIndex","hide","then","clampedIndex","expand","partialExpand","close","snapToPosition","collapse","forceClose","present","dismiss","Provider","style","top","bottom","pointerEvents","onDismissRequest","skipPartiallyExpanded","initialFullyExpanded","showDragHandle","sheetGesturesEnabled","properties","shouldDismissOnBackPress","shouldDismissOnClickOutside","matchContents","flexGrow","height"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/F,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,eAAe;AAErE,SAASC,IAAI,QAAQ,6BAA6B;AAClD,SAASC,gBAAgB,QAAkC,yCAAyC;AACpG,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,kBAAkB,EAAEC,0BAA0B,QAA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AC1C,cAAA,KAAC7C,mBAAmB0E,QAAQ;gBAAChD,OAAOmC;0BAAU;;;IAGpD;IAEA,qBACE,KAAC5D,2BAA2ByE,QAAQ;QAAChD,OAAOmB;kBAC1C,cAAA,KAAC7C,mBAAmB0E,QAAQ;YAAChD,OAAOmC;sBAElC,cAAA,KAAChE;gBAAK8E,OAAO;oBAAE/D,UAAU;oBAAYgE,KAAK;oBAAGC,QAAQ;oBAAGtC;gBAAM;gBAAGuC,eAAc;0BAC7E,cAAA,KAAChF;oBACC+B,KAAKyB;oBACLyB,kBAAkBnB;oBAClBoB,uBAAuBtC;oBACvBuC,sBAAsBzC,yBAAyBa,gBAAgBD,OAAO,KAAKT;oBAC3EuC,gBAAgB7C,oBAAoB;oBACpC8C,sBAAsBhD;oBACtBS,gBAAgBA;oBAChBwC,YAAY;wBACVC,0BAA0BlD;wBAC1BmD,6BAA6BnD;oBAC/B;8BACA,cAAA,KAACpC;wBAAWwF,eAAe9C;kCAKzB,cAAA,KAAC7C;4BAAK+E,OAAOlC,gBAAgB;gCAAEF;4BAAM,IAAI;gCAAEiD,UAAU;gCAAGC,QAAQ;4BAAE;sCAChE,cAAA,KAACvF;0CAAyBoC;;;;;;;;AAQ1C"}
|
|
@@ -100,12 +100,13 @@ let warnedShowNoop = false;
|
|
|
100
100
|
// can pass any `ReactNode` (string, array, etc.).
|
|
101
101
|
const trigger = /*#__PURE__*/ _jsx(RNHostView, {
|
|
102
102
|
matchContents: true,
|
|
103
|
+
boundedByHost: true,
|
|
103
104
|
children: /*#__PURE__*/ _jsx(_Fragment, {
|
|
104
105
|
children: children
|
|
105
106
|
})
|
|
106
107
|
});
|
|
108
|
+
// Sized by Yoga like a `View`, so the trigger can fill or wrap in the space it is given.
|
|
107
109
|
return /*#__PURE__*/ _jsx(Host, {
|
|
108
|
-
matchContents: true,
|
|
109
110
|
style: style,
|
|
110
111
|
testID: testID,
|
|
111
112
|
ignoreSafeArea: "all",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["community/menu/MenuView.ios.tsx"],"sourcesContent":[null],"names":["React","Button","ContextMenu","Host","Menu","RNHostView","Section","Toggle","disabled","disabledModifier","tint","tintModifier","actionId","action","id","title","makeEvent","nativeEvent","event","renderAction","onPressAction","attributes","hidden","subactions","displayInline","state","image","imageColor","key","systemImage","undefined","tintMod","length","children","map","sub","label","fire","modifiers","push","isOn","onIsOnChange","destructive","role","onPress","warnedShowNoop","MenuView","props","ref","actions","shouldOpenOnLongPress","style","testID","useImperativeHandle","show","__DEV__","console","warn","items","body","trigger","matchContents","ignoreSafeArea","Trigger","Items"],"mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,6BAA6B;AACzD,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,YAAYC,gBAAgB,EAAEC,QAAQC,YAAY,QAAQ,2BAA2B;AAI9F,SAASC,SAASC,MAAkB;IAClC,OAAOA,OAAOC,EAAE,IAAID,OAAOE,KAAK;AAClC;AAEA,SAASC,UAAUH,MAAkB;IACnC,OAAO;QAAEI,aAAa;YAAEC,OAAON,SAASC;QAAQ;IAAE;AACpD;AAEA,SAASM,aACPN,MAAkB,EAClBO,aAAkD;IAElD,IAAIP,OAAOQ,UAAU,EAAEC,QAAQ;QAC7B,OAAO;IACT;IAEA,MAAM,EAAEC,UAAU,EAAEC,aAAa,EAAEC,KAAK,EAAEJ,UAAU,EAAEK,KAAK,EAAEC,UAAU,EAAEZ,KAAK,EAAE,GAAGF;IACnF,MAAMe,MAAMhB,SAASC;IACrB,MAAMgB,cAAc,OAAOH,UAAU,WAAWA,QAAQI;IACxD,yEAAyE;IACzE,gDAAgD;IAChD,MAAMC,UAAUJ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E,8EAA8E;IAC9E,sBAAsB;IACtB/C,MAAMqD,mBAAmB,CACvBL,KACA,IAAO,CAAA;YACLM,MAAM;gBACJ,IAAIC,WAAW,CAACV,gBAAgB;oBAC9BA,iBAAiB;oBACjBW,QAAQC,IAAI,CACV;gBAEJ;YACF;QACF,CAAA,GACA,EAAE;IAGJ,MAAMC,QAAQT,QAAQf,GAAG,CAAC,CAACrB,SAAWM,aAAaN,QAAQO;IAC3D,MAAMuC,OAAO5C,sBAAQ,KAACT;QAAQS,OAAOA;kBAAQ2C;SAAmBA;IAEhE,2EAA2E;IAC3E,kDAAkD;IAClD,MAAME,wBACJ,KAACvD;QAAWwD,aAAa;
|
|
1
|
+
{"version":3,"sources":["community/menu/MenuView.ios.tsx"],"sourcesContent":[null],"names":["React","Button","ContextMenu","Host","Menu","RNHostView","Section","Toggle","disabled","disabledModifier","tint","tintModifier","actionId","action","id","title","makeEvent","nativeEvent","event","renderAction","onPressAction","attributes","hidden","subactions","displayInline","state","image","imageColor","key","systemImage","undefined","tintMod","length","children","map","sub","label","fire","modifiers","push","isOn","onIsOnChange","destructive","role","onPress","warnedShowNoop","MenuView","props","ref","actions","shouldOpenOnLongPress","style","testID","useImperativeHandle","show","__DEV__","console","warn","items","body","trigger","matchContents","boundedByHost","ignoreSafeArea","Trigger","Items"],"mappings":";AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,6BAA6B;AACzD,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,YAAYC,gBAAgB,EAAEC,QAAQC,YAAY,QAAQ,2BAA2B;AAI9F,SAASC,SAASC,MAAkB;IAClC,OAAOA,OAAOC,EAAE,IAAID,OAAOE,KAAK;AAClC;A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AAa;QACvCJ,UAAUC,IAAI,CAACR;IACjB;IAEA,qBACE,KAAC9B;QAECmC,OAAOrB;QACPc,aAAaA;QACbc,MAAMtB,YAAYqB,cAAc,gBAAgBZ;QAChDQ,WAAWA,UAAUN,MAAM,GAAG,IAAIM,YAAYR;QAC9Cc,SAASP;OALJT;AAQX;AAEA,IAAIiB,iBAAiB;AAErB;;;CAGC,GACD,OAAO,SAASC,SAASC,KAAiE;IACxF,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAE7B,aAAa,EAAE8B,qBAAqB,EAAEnC,KAAK,EAAEoC,KAAK,EAAElB,QAAQ,EAAEmB,MAAM,EAAE,GAC1FL;IAEF,4EAA4E;IAC5E,8EAA8E;IAC9E,sBAAsB;IACtB/C,MAAMqD,mBAAmB,CACvBL,KACA,IAAO,CAAA;YACLM,MAAM;gBACJ,IAAIC,WAAW,CAACV,gBAAgB;oBAC9BA,iBAAiB;oBACjBW,QAAQC,IAAI,CACV;gBAEJ;YACF;QACF,CAAA,GACA,EAAE;IAGJ,MAAMC,QAAQT,QAAQf,GAAG,CAAC,CAACrB,SAAWM,aAAaN,QAAQO;IAC3D,MAAMuC,OAAO5C,sBAAQ,KAACT;QAAQS,OAAOA;kBAAQ2C;SAAmBA;IAEhE,2EAA2E;IAC3E,kDAAkD;IAClD,MAAME,wBACJ,KAACvD;QAAWwD,aAAa;QAACC,aAAa;kBACrC,cAAA;sBAAG7B;;;IAIP,yFAAyF;IACzF,qBACE,KAAC9B;QAAKgD,OAAOA;QAAOC,QAAQA;QAAQW,gBAAe;kBAChDb,sCACC,MAAChD;;8BACC,KAACA,YAAY8D,OAAO;8BAAEJ;;8BACtB,KAAC1D,YAAY+D,KAAK;8BAAEN;;;2BAGtB,KAACvD;YAAKgC,OAAOwB;sBAAUD;;;AAI/B"}
|
|
@@ -2,12 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { getTextFromChildren } from '../../utils';
|
|
5
|
+
import { flattenFragments } from '../../utils/flattenFragments';
|
|
5
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
7
|
const TextNativeView = requireNativeView('ExpoUI', 'TextView');
|
|
7
8
|
// Constructs tree of spans from nested Text components
|
|
8
9
|
function collectSpans(children) {
|
|
9
10
|
if (children === undefined || children === null) return null;
|
|
10
|
-
const childArray =
|
|
11
|
+
const childArray = flattenFragments(children);
|
|
11
12
|
if (childArray.length === 0) return null;
|
|
12
13
|
const hasNestedText = childArray.some((child)=>/*#__PURE__*/ React.isValidElement(child) && child.type === Text);
|
|
13
14
|
if (!hasNestedText) return null;
|
|
@@ -38,11 +39,11 @@ function collectSpans(children) {
|
|
|
38
39
|
if (nestedSpans) {
|
|
39
40
|
span.children = nestedSpans;
|
|
40
41
|
} else {
|
|
41
|
-
span.text = getTextFromChildren(childProps.children) ?? '';
|
|
42
|
+
span.text = getTextFromChildren(flattenFragments(childProps.children)) ?? '';
|
|
42
43
|
}
|
|
43
44
|
spans.push(span);
|
|
44
45
|
} else if (__DEV__ && /*#__PURE__*/ React.isValidElement(child)) {
|
|
45
|
-
console.warn('Text: Unsupported child element of type "%s" inside <Text>. Only <Text>, string, and number children are supported.', typeof child.type === 'function' ? child.type.name || 'Unknown' : child.type);
|
|
46
|
+
console.warn('Text: Unsupported child element of type "%s" inside <Text>. Only <Text>, string, and number children are supported.', typeof child.type === 'function' ? child.type.name || 'Unknown' : String(child.type));
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
return spans.length > 0 ? spans : null;
|
|
@@ -58,7 +59,7 @@ function transformTextProps(props) {
|
|
|
58
59
|
...spans ? {
|
|
59
60
|
spans
|
|
60
61
|
} : {
|
|
61
|
-
text: getTextFromChildren(children) ?? ''
|
|
62
|
+
text: getTextFromChildren(flattenFragments(children)) ?? ''
|
|
62
63
|
},
|
|
63
64
|
// Extract typography from style (used as base style)
|
|
64
65
|
typography: style?.typography,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/Text/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","React","getTextFromChildren","createViewModifierEventListener","TextNativeView","collectSpans","children","undefined","childArray","
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/Text/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","React","getTextFromChildren","flattenFragments","createViewModifierEventListener","TextNativeView","collectSpans","children","undefined","childArray","length","hasNestedText","some","child","isValidElement","type","Text","spans","push","text","String","childProps","props","span","color","fontSize","style","fontWeight","fontStyle","fontFamily","textDecoration","letterSpacing","background","shadow","nestedSpans","__DEV__","console","warn","name","transformTextProps","modifiers","restProps","typography","textAlign","lineHeight","lineBreak"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AACzC,YAAYC,WAAW,QAAQ;AAI/B,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,+BAA+B,QAAQ,qBAAqB;AAuPrE,MAAMC,iBAAuDL,kBAC3D,UACA;AAGF,uDAAuD;AACvD,SAASM,aAAaC,QAAyB;IAC7C,IAAIA,aAAaC,aAAaD,aAAa,MAAM,OAAO;IAExD,MAAME,aAAaN,iBAAiBI;IACpC,IAAIE,WAAWC,MAAM,KAAK,GAAG,OAAO;IAEpC,MAAMC,gBAAgBF,WAAWG,IAAI,CACnC,CAACC,sBAAUZ,MAAMa,cAAc,CAACD,UAAUA,MAAME,IAAI,KAAKC;IAG3D,IAAI,CAACL,eAAe,OAAO;IAE3B,MAAMM,QAA0B,EAAE;IAElC,KAAK,MAAMJ,SAASJ,WAAY;QAC9B,IAAI,OAAOI,UAAU,UAAU;YAC7BI,MAAMC,IAAI,CAAC;gBAAEC,MAAMN;YAAM;QAC3B,OAAO,IAAI,OAAOA,UAAU,UAAU;YACpCI,MAAMC,IAAI,CAAC;gBAAEC,MAAMC,OAAOP;YAAO;QACnC,OAAO,kBAAIZ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AC;QACvF,qDAAqD;QACrDmC,YAAYhB,OAAOgB;QACnB,uEAAuE;QACvEjB,UAAUC,OAAOD;QACjBE,YAAYD,OAAOC;QACnBC,WAAWF,OAAOE;QAClBC,YAAYH,OAAOG;QACnBc,WAAWjB,OAAOiB;QAClBb,gBAAgBJ,OAAOI;QACvBC,eAAeL,OAAOK;QACtBa,YAAYlB,OAAOkB;QACnBC,WAAWnB,OAAOmB;QAClBb,YAAYN,OAAOM;QACnBC,QAAQP,OAAOO;IACjB;AACF;AAEA;;CAEC,GACD,OAAO,SAASjB,KAAKM,KAAgB;IACnC,qBAAO,KAACjB;QAAgB,GAAGkC,mBAAmBjB,MAAM;;AACtD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type SFSymbol } from 'sf-symbols-typescript';
|
|
2
3
|
import { type CommonViewModifierProps } from '../types';
|
|
3
4
|
export interface ContentUnavailableViewProps extends CommonViewModifierProps {
|
|
@@ -13,6 +14,10 @@ export interface ContentUnavailableViewProps extends CommonViewModifierProps {
|
|
|
13
14
|
* Description of why the content is not available.
|
|
14
15
|
*/
|
|
15
16
|
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Controls shown below the description, such as a `Button` that tries again.
|
|
19
|
+
*/
|
|
20
|
+
actions?: ReactNode;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Displays a native Swift UI ContentUnavailableView.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
|
+
import { Slot } from '../SlotView';
|
|
3
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
5
|
const ContentUnavailableViewNativeView = requireNativeView('ExpoUI', 'ContentUnavailableView');
|
|
5
6
|
function transformContentUnavailableViewProps(props) {
|
|
6
|
-
const { modifiers, ...restProps } = props;
|
|
7
|
+
const { modifiers, actions, ...restProps } = props;
|
|
7
8
|
return {
|
|
8
9
|
modifiers,
|
|
9
10
|
...modifiers ? createViewModifierEventListener(modifiers) : undefined,
|
|
@@ -16,7 +17,11 @@ function transformContentUnavailableViewProps(props) {
|
|
|
16
17
|
* @platform tvos 17.0+
|
|
17
18
|
*/ export function ContentUnavailableView(props) {
|
|
18
19
|
return /*#__PURE__*/ _jsx(ContentUnavailableViewNativeView, {
|
|
19
|
-
...transformContentUnavailableViewProps(props)
|
|
20
|
+
...transformContentUnavailableViewProps(props),
|
|
21
|
+
children: props.actions != null ? /*#__PURE__*/ _jsx(Slot, {
|
|
22
|
+
name: "actions",
|
|
23
|
+
children: props.actions
|
|
24
|
+
}) : null
|
|
20
25
|
});
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/ContentUnavailableView/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","ContentUnavailableViewNativeView","transformContentUnavailableViewProps","props","modifiers","restProps","undefined","ContentUnavailableView"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"sources":["swift-ui/ContentUnavailableView/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","Slot","createViewModifierEventListener","ContentUnavailableViewNativeView","transformContentUnavailableViewProps","props","modifiers","actions","restProps","undefined","ContentUnavailableView","name"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,+BAA+B,QAAQ,qBAAqB;AA6BrE,MAAMC,mCACJH,kBAAkB,UAAU;AAE9B,SAASI,qCACPC,KAAkC;IAElC,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAE,GAAGC,WAAW,GAAGH;IAC7C,OAAO;QACLC;QACA,GAAIA,YAAYJ,gCAAgCI,aAAaG,SAAS;QACtE,GAAGD,SAAS;IACd;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASE,uBAAuBL,KAAkC;IACvE,qBACE,KAACF;QAAkC,GAAGC,qCAAqCC,MAAM;kBAC9EA,MAAME,OAAO,IAAI,qBAAO,KAACN;YAAKU,MAAK;sBAAWN,MAAME,OAAO;aAAW;;AAG7E"}
|
|
@@ -14,9 +14,15 @@ export interface RNHostViewProps {
|
|
|
14
14
|
horizontal?: boolean;
|
|
15
15
|
};
|
|
16
16
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Measures the children within the space Yoga gives the `Host`. SwiftUI layout between the
|
|
19
|
+
* `Host` and this view (padding, siblings, scroll views) is not taken into account.
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
boundedByHost?: boolean;
|
|
17
23
|
/**
|
|
18
24
|
* The RN View to be hosted.
|
|
19
25
|
*/
|
|
20
26
|
children: React.ReactElement;
|
|
21
27
|
}
|
|
22
|
-
export declare function RNHostView({ matchContents, ...props }: RNHostViewProps): import("react").JSX.Element;
|
|
28
|
+
export declare function RNHostView({ matchContents, boundedByHost, ...props }: RNHostViewProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { NativeTreeContext } from '../NativeTreeContext';
|
|
|
5
5
|
import { PresentedContentContext, useIsPresentedInOwnWindow } from '../PresentedContentContext';
|
|
6
6
|
import { resolveMatchContents } from '../utils/matchContents';
|
|
7
7
|
const RNHostNativeView = requireNativeView('ExpoUI', 'RNHostView');
|
|
8
|
-
export function RNHostView({ matchContents, ...props }) {
|
|
8
|
+
export function RNHostView({ matchContents, boundedByHost, ...props }) {
|
|
9
9
|
// A sheet or popover presents its content in its own view controller, where the React Native
|
|
10
10
|
// surface root is not an ancestor and so touch dispatches don't work.
|
|
11
11
|
// Hosted content there owns its touches and is the origin it is measured from; native reads
|
|
@@ -18,6 +18,7 @@ export function RNHostView({ matchContents, ...props }) {
|
|
|
18
18
|
matchContentsHorizontal: matchContentsHorizontal,
|
|
19
19
|
matchContentsVertical: matchContentsVertical,
|
|
20
20
|
expoInternalSizeFromChildren: matchContentsHorizontal || matchContentsVertical,
|
|
21
|
+
expoInternalBoundedByHost: boundedByHost,
|
|
21
22
|
// `matchContents` can only be used once on mount
|
|
22
23
|
// So we force unmount when it changes to prevent unexpected layout
|
|
23
24
|
key: `${matchContentsHorizontal}-${matchContentsVertical}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/RNHostView.tsx"],"sourcesContent":[null],"names":["requireNativeView","NativeTreeContext","PresentedContentContext","useIsPresentedInOwnWindow","resolveMatchContents","RNHostNativeView","RNHostView","matchContents","props","layoutRoot","horizontal","matchContentsHorizontal","vertical","matchContentsVertical","expoInternalSizeFromChildren","key","Provider","value","children"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,6BAA6B;AAChG,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,mBAA6CL,kBAAkB,UAAU;
|
|
1
|
+
{"version":3,"sources":["swift-ui/RNHostView.tsx"],"sourcesContent":[null],"names":["requireNativeView","NativeTreeContext","PresentedContentContext","useIsPresentedInOwnWindow","resolveMatchContents","RNHostNativeView","RNHostView","matchContents","boundedByHost","props","layoutRoot","horizontal","matchContentsHorizontal","vertical","matchContentsVertical","expoInternalSizeFromChildren","expoInternalBoundedByHost","key","Provider","value","children"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,6BAA6B;AAChG,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,mBAA6CL,kBAAkB,UAAU;AA0B/E,OAAO,SAASM,WAAW,EAAEC,aAAa,EAAEC,aAAa,EAAE,GAAGC,OAAwB;IACpF,6FAA6F;IAC7F,sEAAsE;IACtE,4FAA4F;IAC5F,0BAA0B;IAC1B,MAAMC,aAAaP;IACnB,MAAM,EAAEQ,YAAYC,uBAAuB,EAAEC,UAAUC,qBAAqB,EAAE,GAC5EV,qBAAqBG;IAEvB,qBACE,eAACF;QACE,GAAGI,KAAK;QACTC,YAAYA;QACZE,yBAAyBA;QACzBE,uBAAuBA;QACvBC,8BAA8BH,2BAA2BE;QACzDE,2BAA2BR;QAC3B,iDAAiD;QACjD,mEAAmE;QACnES,KAAK,GAAGL,wBAAwB,CAAC,EAAEE,uBAAuB;qBAE1D,KAACZ,wBAAwBgB,QAAQ;QAACC,OAAO;kBAEvC,cAAA,KAAClB,kBAAkBiB,QAAQ;YAACC,OAAO;sBAAQV,MAAMW,QAAQ;;;AAIjE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { requireNativeView } from 'expo';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { flattenFragments } from '../../utils/flattenFragments';
|
|
4
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
const TextNativeView = requireNativeView('ExpoUI', 'TextView');
|
|
6
7
|
export function Text(props) {
|
|
@@ -22,7 +23,7 @@ export function Text(props) {
|
|
|
22
23
|
if (children === undefined || children === null) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
|
-
const childArray =
|
|
26
|
+
const childArray = flattenFragments(children);
|
|
26
27
|
if (childArray.length === 0) return null;
|
|
27
28
|
const isSimpleText = childArray.every((child)=>typeof child === 'string' || typeof child === 'number');
|
|
28
29
|
if (isSimpleText) {
|