@onekeyfe/react-native-native-overlay 6.7.0-alpha.475 → 6.8.0-11
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/README.md +119 -21
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEntryRootView.kt +60 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayHost.kt +37 -5
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPackage.kt +1 -1
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToastCardView.kt +869 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToastSpec.kt +327 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToasterView.kt +574 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayToasterViewManager.kt +54 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayView.kt +12 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayViewManager.kt +8 -0
- package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayAccessibilityIsolationTest.kt +172 -0
- package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlayMotionTest.kt +42 -0
- package/android/src/test/java/com/onekey/nativeoverlay/NativeOverlaySheetInsetTest.kt +78 -0
- package/docs/SPEC.md +324 -33
- package/ios/NativeOverlayContainerView.swift +6 -0
- package/ios/NativeOverlayToastCardView.swift +572 -0
- package/ios/NativeOverlayToastSpec.swift +356 -0
- package/ios/NativeOverlayToasterView.swift +519 -0
- package/ios/NativeOverlayWindowManager.swift +244 -7
- package/ios/RCTNativeOverlayToasterComponentView.h +11 -0
- package/ios/RCTNativeOverlayToasterComponentView.mm +85 -0
- package/lib/module/NativeOverlayNativeComponent.ts +13 -0
- package/lib/module/NativeOverlayToasterNativeComponent.ts +24 -0
- package/lib/module/OverlayView.js +7 -1
- package/lib/module/OverlayView.js.map +1 -1
- package/lib/module/animation/anchoredOrigin.js +26 -0
- package/lib/module/animation/anchoredOrigin.js.map +1 -0
- package/lib/module/animation/resolveAnimation.js +26 -4
- package/lib/module/animation/resolveAnimation.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/toast/OverlayToastHost.js +42 -0
- package/lib/module/toast/OverlayToastHost.js.map +1 -0
- package/lib/module/toast/OverlayToastHost.web.js +32 -0
- package/lib/module/toast/OverlayToastHost.web.js.map +1 -0
- package/lib/module/toast/OverlayToastStore.js +217 -0
- package/lib/module/toast/OverlayToastStore.js.map +1 -0
- package/lib/module/toast/toastBridge.js +65 -0
- package/lib/module/toast/toastBridge.js.map +1 -0
- package/lib/module/toast/toastDomContent.web.js +298 -0
- package/lib/module/toast/toastDomContent.web.js.map +1 -0
- package/lib/module/toast/toastDomRenderer.web.js +695 -0
- package/lib/module/toast/toastDomRenderer.web.js.map +1 -0
- package/lib/module/toast/toastStyles.web.js +97 -0
- package/lib/module/toast/toastStyles.web.js.map +1 -0
- package/lib/module/toast/types.js +2 -0
- package/lib/module/toast/types.js.map +1 -0
- package/lib/module/web/animateTransition.js +38 -12
- package/lib/module/web/animateTransition.js.map +1 -1
- package/lib/module/web/overlayLayers.js +5 -0
- package/lib/module/web/overlayLayers.js.map +1 -1
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts +13 -0
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/NativeOverlayToasterNativeComponent.d.ts +19 -0
- package/lib/typescript/src/NativeOverlayToasterNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/OverlayView.d.ts.map +1 -1
- package/lib/typescript/src/animation/anchoredOrigin.d.ts +7 -0
- package/lib/typescript/src/animation/anchoredOrigin.d.ts.map +1 -0
- package/lib/typescript/src/animation/resolveAnimation.d.ts +9 -3
- package/lib/typescript/src/animation/resolveAnimation.d.ts.map +1 -1
- package/lib/typescript/src/animation/types.d.ts +5 -1
- package/lib/typescript/src/animation/types.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/toast/OverlayToastHost.d.ts +6 -0
- package/lib/typescript/src/toast/OverlayToastHost.d.ts.map +1 -0
- package/lib/typescript/src/toast/OverlayToastHost.web.d.ts +6 -0
- package/lib/typescript/src/toast/OverlayToastHost.web.d.ts.map +1 -0
- package/lib/typescript/src/toast/OverlayToastStore.d.ts +47 -0
- package/lib/typescript/src/toast/OverlayToastStore.d.ts.map +1 -0
- package/lib/typescript/src/toast/toastBridge.d.ts +11 -0
- package/lib/typescript/src/toast/toastBridge.d.ts.map +1 -0
- package/lib/typescript/src/toast/toastDomContent.web.d.ts +15 -0
- package/lib/typescript/src/toast/toastDomContent.web.d.ts.map +1 -0
- package/lib/typescript/src/toast/toastDomRenderer.web.d.ts +8 -0
- package/lib/typescript/src/toast/toastDomRenderer.web.d.ts.map +1 -0
- package/lib/typescript/src/toast/toastStyles.web.d.ts +2 -0
- package/lib/typescript/src/toast/toastStyles.web.d.ts.map +1 -0
- package/lib/typescript/src/toast/types.d.ts +240 -0
- package/lib/typescript/src/toast/types.d.ts.map +1 -0
- package/lib/typescript/src/web/animateTransition.d.ts +12 -0
- package/lib/typescript/src/web/animateTransition.d.ts.map +1 -1
- package/lib/typescript/src/web/overlayLayers.d.ts.map +1 -1
- package/package.json +3 -2
- package/react-native.config.js +1 -0
- package/src/NativeOverlayNativeComponent.ts +13 -0
- package/src/NativeOverlayToasterNativeComponent.ts +24 -0
- package/src/OverlayView.tsx +7 -0
- package/src/animation/anchoredOrigin.ts +35 -0
- package/src/animation/resolveAnimation.ts +28 -7
- package/src/animation/types.ts +5 -1
- package/src/index.ts +24 -0
- package/src/toast/OverlayToastHost.tsx +62 -0
- package/src/toast/OverlayToastHost.web.tsx +29 -0
- package/src/toast/OverlayToastStore.ts +254 -0
- package/src/toast/toastBridge.ts +62 -0
- package/src/toast/toastDomContent.web.ts +351 -0
- package/src/toast/toastDomRenderer.web.ts +856 -0
- package/src/toast/toastStyles.web.ts +97 -0
- package/src/toast/types.ts +251 -0
- package/src/web/animateTransition.ts +54 -14
- package/src/web/overlayLayers.ts +7 -0
package/README.md
CHANGED
|
@@ -1,35 +1,133 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @onekeyfe/react-native-native-overlay
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
**Overlay hosts that draw above the app on iOS, Android and Web while keeping the caller's React subtree and hit testing intact.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@onekeyfe/react-native-native-overlay)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Owns where an overlay is drawn, which overlay is on top and how it enters and
|
|
17
|
+
exits. Levels are fixed (`modal`, `hardware`, `secure`, `toast`, `lock`,
|
|
18
|
+
`debug`), each entry picks a `global` or `page` scope and a lane strategy, and
|
|
19
|
+
the native host reparents the caller's content so React context, refs and
|
|
20
|
+
`measureInWindow` keep working. Sheet, center, fullscreen, toast and anchored
|
|
21
|
+
presentations are available; the application owns the content and business UI.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Predictable ordering** — every page entry renders below every global entry,
|
|
26
|
+
and inside a scope entries sort by level and then by request order.
|
|
27
|
+
- **Lane strategies** — `stack`, `queue` and `replace` apply per
|
|
28
|
+
(scope, host, level) lane, with `priority`, `replaceKey` and de-duplicated ids.
|
|
29
|
+
- **Preserved React identity** — the overlay view stays where the caller
|
|
30
|
+
rendered it; native code moves its content into the host, so there is no
|
|
31
|
+
portal that drops context.
|
|
32
|
+
- **Page scope that covers chrome** — `OverlayPageHost` as the last child of a
|
|
33
|
+
root route lets page overlays cover native headers and the tab bar.
|
|
34
|
+
- **Native presentation and motion** — sheet drag, back handling, keyboard
|
|
35
|
+
avoidance, status bar styling and configurable enter/exit animations.
|
|
36
|
+
- **Web parity** — the Web implementation portals into z-indexed level layers
|
|
37
|
+
with a focus trap and page isolation.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
yarn add @onekeyfe/react-native-native-overlay
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The native hosts are React Native Fabric codegen components, not Nitro views.
|
|
46
|
+
Install the app's iOS pods and rebuild the native application after adding the
|
|
47
|
+
package. Web additionally needs `react-dom`; it is declared as an optional peer
|
|
48
|
+
dependency.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
6
51
|
|
|
7
52
|
```tsx
|
|
8
|
-
import {
|
|
53
|
+
import { useState } from 'react';
|
|
54
|
+
import {
|
|
55
|
+
OverlayPageHost,
|
|
56
|
+
OverlayView,
|
|
57
|
+
} from '@onekeyfe/react-native-native-overlay';
|
|
9
58
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
59
|
+
function MainRoute() {
|
|
60
|
+
const [visible, setVisible] = useState(false);
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{screen}
|
|
64
|
+
<OverlayView
|
|
65
|
+
visible={visible}
|
|
66
|
+
presentation="sheet"
|
|
67
|
+
level="modal"
|
|
68
|
+
sheet={{ dismissOnPanDown: true, cornerRadius: 24 }}
|
|
69
|
+
onRequestDismiss={() => setVisible(false)}
|
|
70
|
+
>
|
|
71
|
+
{content}
|
|
72
|
+
</OverlayView>
|
|
73
|
+
{/* Last child of the root route, after its navigator. */}
|
|
74
|
+
<OverlayPageHost hostKey="main" />
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
13
78
|
```
|
|
14
79
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
80
|
+
The application still owns `visible` and the content. `scope="page"` resolves
|
|
81
|
+
`hostKey`/`ownerKey` from the nearest `OverlayPageHostScope` and
|
|
82
|
+
`OverlayPageOwnerScope` providers.
|
|
83
|
+
|
|
84
|
+
## API
|
|
85
|
+
|
|
86
|
+
| Export | Shape | Description | Platforms |
|
|
87
|
+
| --- | --- | --- | :-: |
|
|
88
|
+
| `OverlayView` | component | Declarative overlay: `visible`, `scope`, `level`, `strategy`, `priority`, `replaceKey`, `presentation`, `sheet`, `animation`, `backdrop`, `blocking`, `keepContentMounted`, `statusBarStyle`, `contentSize`, dismiss/present callbacks. | iOS, Android, Web |
|
|
89
|
+
| `OverlayPageHost` | component | Renders the page-scope overlays of one root route from `hostKey`. | iOS, Android, Web |
|
|
90
|
+
| `OverlayPageHostScope`, `OverlayPageOwnerScope` | providers | Supply `hostKey` per root route and `ownerKey` per page. | iOS, Android, Web |
|
|
91
|
+
| `overlayStore` | store | Imperative `request`, `dismiss`, `finalize`, `reopen`, `dismissAll`, `setPageVisible`, `removePage`, `resolveBack`. | iOS, Android, Web |
|
|
92
|
+
| `OverlayRequestError` | error class | Thrown for invalid requests such as a page entry without keys. | iOS, Android, Web |
|
|
93
|
+
| `OVERLAY_LEVELS`, `OVERLAY_LEVEL_ORDER` | constants | The level list and their numeric order. | iOS, Android, Web |
|
|
94
|
+
| `resolveOverlayAnimation`, `OVERLAY_MOTION_PRESETS`, `NATIVE_MOTION_PRESETS`, `WEB_MOTION_PRESETS` | helpers | Resolve animation configs per platform. | iOS, Android, Web |
|
|
95
|
+
|
|
96
|
+
`presentation` accepts `sheet`, `center`, `fullscreen`, `toast` and `anchored`.
|
|
97
|
+
`strategy` accepts `stack`, `queue` and `replace`. See
|
|
98
|
+
[`docs/SPEC.md`](docs/SPEC.md) for the ownership model, platform differences and
|
|
99
|
+
acceptance record.
|
|
100
|
+
|
|
101
|
+
## Platform support
|
|
102
|
+
|
|
103
|
+
| Capability | iOS | Android | Web |
|
|
104
|
+
| --- | :-: | :-: | :-: |
|
|
105
|
+
| Global overlays and level ordering | ✅ | ✅ | ✅ |
|
|
106
|
+
| Page scope via `OverlayPageHost` | ✅ | ✅ | ✅ |
|
|
107
|
+
| Sheet presentation | ✅ | ✅ | ✅ |
|
|
108
|
+
| Keyboard avoidance | ✅ | ✅ | ✅ |
|
|
109
|
+
| `windowOffsetRequest` for modal-relative anchors | ✅ | — | — |
|
|
110
|
+
| `contentSize` for pre-rotation layout | ✅ | ✅ | — |
|
|
111
|
+
| Status bar styling | ✅ | ✅ | — |
|
|
112
|
+
|
|
113
|
+
## Caveats
|
|
20
114
|
|
|
21
|
-
|
|
115
|
+
> [!IMPORTANT]
|
|
116
|
+
> Page-scope entries need both `hostKey` and `ownerKey`. A declarative
|
|
117
|
+
> `OverlayView` waits until the nearest scope providers supply them, but a
|
|
118
|
+
> direct `overlayStore.request` with a missing key throws `OverlayRequestError`.
|
|
22
119
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
120
|
+
> [!NOTE]
|
|
121
|
+
> The `windowOffsetRequest`/`onWindowOffset` and `contentSize` props are
|
|
122
|
+
> native-only layout aids; they do nothing on Web. On Web the overlay portals
|
|
123
|
+
> into a level layer and relies on `react-dom`.
|
|
26
124
|
|
|
27
|
-
##
|
|
125
|
+
## References
|
|
28
126
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
127
|
+
- [Package spec](docs/SPEC.md)
|
|
128
|
+
- [Public exports](src/index.ts)
|
|
129
|
+
- [Changelog](../../CHANGELOG.md)
|
|
32
130
|
|
|
33
131
|
## License
|
|
34
132
|
|
|
35
|
-
MIT
|
|
133
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -103,6 +103,9 @@ internal class NativeOverlayEntryRootView(
|
|
|
103
103
|
private var imeBottom = 0
|
|
104
104
|
private var safeTop = 0
|
|
105
105
|
private var sheetBottomPadding = 0
|
|
106
|
+
/** Paints the platform sheet's navigation-bar inset strip. */
|
|
107
|
+
internal var sheetBottomInsetPaintView: View? = null
|
|
108
|
+
private set
|
|
106
109
|
private var keyboardAnimating = false
|
|
107
110
|
|
|
108
111
|
/** `sheet` presentation: the draggable surface; otherwise null. */
|
|
@@ -156,6 +159,8 @@ internal class NativeOverlayEntryRootView(
|
|
|
156
159
|
backgroundColor: Int,
|
|
157
160
|
showHandle: Boolean,
|
|
158
161
|
draggable: Boolean,
|
|
162
|
+
bottomInsetColor: Int? = null,
|
|
163
|
+
bottomInsetHorizontalPx: Float = 0f,
|
|
159
164
|
) {
|
|
160
165
|
val sheet = sheetView ?: createSheet()
|
|
161
166
|
(sheet.background as? GradientDrawable)?.apply {
|
|
@@ -178,6 +183,60 @@ internal class NativeOverlayEntryRootView(
|
|
|
178
183
|
params.height = targetHeight
|
|
179
184
|
sheet.layoutParams = params
|
|
180
185
|
}
|
|
186
|
+
updateSheetBottomInsetPaint(sheetBottomPadding, bottomInsetColor, bottomInsetHorizontalPx)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* `sheet` presentation: the sheet pads its content by the navigation-bar
|
|
191
|
+
* inset so the content sits above the system bar. When JS draws the surface
|
|
192
|
+
* the platform sheet stays transparent, and the JS safe-area tail cannot
|
|
193
|
+
* paint this strip on Android: it hangs below the React content root, which
|
|
194
|
+
* Android does not composite outside its bounds. Paint the strip natively
|
|
195
|
+
* with the drawn surface color instead. A null color keeps it transparent
|
|
196
|
+
* for platform-painted sheets.
|
|
197
|
+
*/
|
|
198
|
+
internal fun updateSheetBottomInsetPaint(
|
|
199
|
+
insetPx: Int,
|
|
200
|
+
color: Int?,
|
|
201
|
+
horizontalInsetPx: Float,
|
|
202
|
+
) {
|
|
203
|
+
val sheet = sheetView ?: return
|
|
204
|
+
if (color == null || insetPx <= 0) {
|
|
205
|
+
sheetBottomInsetPaintView?.let { paint ->
|
|
206
|
+
sheet.removeView(paint)
|
|
207
|
+
sheetBottomInsetPaintView = null
|
|
208
|
+
}
|
|
209
|
+
return
|
|
210
|
+
}
|
|
211
|
+
val paint = sheetBottomInsetPaintView ?: View(reactContext).apply {
|
|
212
|
+
isClickable = false
|
|
213
|
+
isFocusable = false
|
|
214
|
+
importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_NO
|
|
215
|
+
// Index 0 keeps the strip behind the sheet content.
|
|
216
|
+
sheet.addView(
|
|
217
|
+
this,
|
|
218
|
+
0,
|
|
219
|
+
LayoutParams(LayoutParams.MATCH_PARENT, 0).apply { gravity = Gravity.BOTTOM },
|
|
220
|
+
)
|
|
221
|
+
sheetBottomInsetPaintView = this
|
|
222
|
+
}
|
|
223
|
+
paint.setBackgroundColor(color)
|
|
224
|
+
// The content height can be fractional; overlap it by a couple of points so
|
|
225
|
+
// rounding cannot leave an unpainted row above the strip. Both views share
|
|
226
|
+
// the same surface color, so the overlap is invisible.
|
|
227
|
+
val height = insetPx + (2 * resources.displayMetrics.density).toInt()
|
|
228
|
+
val horizontal = horizontalInsetPx.toInt().coerceAtLeast(0)
|
|
229
|
+
val params = paint.layoutParams as LayoutParams
|
|
230
|
+
if (
|
|
231
|
+
params.height != height ||
|
|
232
|
+
params.leftMargin != horizontal ||
|
|
233
|
+
params.rightMargin != horizontal
|
|
234
|
+
) {
|
|
235
|
+
params.height = height
|
|
236
|
+
params.leftMargin = horizontal
|
|
237
|
+
params.rightMargin = horizontal
|
|
238
|
+
paint.layoutParams = params
|
|
239
|
+
}
|
|
181
240
|
}
|
|
182
241
|
|
|
183
242
|
/** The sheet's full height, navigation bar padding included. */
|
|
@@ -242,6 +301,7 @@ internal class NativeOverlayEntryRootView(
|
|
|
242
301
|
sheetAnimationView = coordinator
|
|
243
302
|
sheetBehavior = behavior
|
|
244
303
|
handleView = handle
|
|
304
|
+
sheetBottomInsetPaintView = null
|
|
245
305
|
return sheet
|
|
246
306
|
}
|
|
247
307
|
|
|
@@ -2,6 +2,7 @@ package com.onekey.nativeoverlay
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.view.KeyEvent
|
|
5
|
+
import android.view.View
|
|
5
6
|
import android.view.ViewGroup
|
|
6
7
|
import android.view.Window
|
|
7
8
|
import android.widget.FrameLayout
|
|
@@ -103,6 +104,32 @@ internal class NativeOverlayHost private constructor(
|
|
|
103
104
|
onEntriesChanged()
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Adds the message-toast layer under every entry of the `toast` level: the
|
|
109
|
+
* cards are plain views, drawn by the platform rather than hosted React
|
|
110
|
+
* content, and custom toast entries stay above them.
|
|
111
|
+
*/
|
|
112
|
+
fun attachToastLayer(layer: View) {
|
|
113
|
+
val content = activity.findViewById<ViewGroup>(android.R.id.content) ?: return
|
|
114
|
+
if (parent !== content) {
|
|
115
|
+
(parent as? ViewGroup)?.removeView(this)
|
|
116
|
+
content.addView(this, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
117
|
+
} else if (content.getChildAt(content.childCount - 1) !== this) {
|
|
118
|
+
bringToFront()
|
|
119
|
+
}
|
|
120
|
+
val container = levelContainer(NativeOverlayLevel.TOAST)
|
|
121
|
+
if (layer.parent !== container) {
|
|
122
|
+
(layer.parent as? ViewGroup)?.removeView(layer)
|
|
123
|
+
container.addView(layer, 0, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
124
|
+
}
|
|
125
|
+
updateAccessibility()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
fun detachToastLayer(layer: View) {
|
|
129
|
+
(layer.parent as? ViewGroup)?.removeView(layer)
|
|
130
|
+
updateAccessibility()
|
|
131
|
+
}
|
|
132
|
+
|
|
106
133
|
fun detach(entry: NativeOverlayEntryRootView) {
|
|
107
134
|
(entry.parent as? ViewGroup)?.removeView(entry)
|
|
108
135
|
onEntriesChanged()
|
|
@@ -128,11 +155,14 @@ internal class NativeOverlayHost private constructor(
|
|
|
128
155
|
container
|
|
129
156
|
}
|
|
130
157
|
|
|
131
|
-
private fun
|
|
158
|
+
private fun orderedViews(): List<View> =
|
|
132
159
|
levelContainers.values.flatMap { container ->
|
|
133
|
-
(0 until container.childCount).
|
|
160
|
+
(0 until container.childCount).map { container.getChildAt(it) }
|
|
134
161
|
}
|
|
135
162
|
|
|
163
|
+
private fun orderedEntries(): List<NativeOverlayEntryRootView> =
|
|
164
|
+
orderedViews().filterIsInstance<NativeOverlayEntryRootView>()
|
|
165
|
+
|
|
136
166
|
/** Global overlays win; otherwise the topmost visible page overlay. */
|
|
137
167
|
private fun topBackEntry(): NativeOverlayEntryRootView? =
|
|
138
168
|
orderedEntries().lastOrNull {
|
|
@@ -149,11 +179,13 @@ internal class NativeOverlayHost private constructor(
|
|
|
149
179
|
|
|
150
180
|
/** TalkBack only reads the topmost blocking overlay and what is above it. */
|
|
151
181
|
private fun updateAccessibility() {
|
|
152
|
-
val
|
|
153
|
-
val topIndex =
|
|
182
|
+
val views = orderedViews()
|
|
183
|
+
val topIndex = views.indexOfLast {
|
|
184
|
+
it is NativeOverlayEntryRootView && it.blocking && it.isShownForInput
|
|
185
|
+
}
|
|
154
186
|
val content = activity.findViewById<ViewGroup>(android.R.id.content) ?: return
|
|
155
187
|
if (topIndex >= 0) {
|
|
156
|
-
accessibilityIsolation.update(content, this,
|
|
188
|
+
accessibilityIsolation.update(content, this, views.take(topIndex), this)
|
|
157
189
|
return
|
|
158
190
|
}
|
|
159
191
|
val pageEntry = shownPageHosts().flatMap { it.shownEntries() }.lastOrNull { it.blocking }
|
|
@@ -8,7 +8,7 @@ import com.facebook.react.uimanager.ViewManager
|
|
|
8
8
|
class NativeOverlayPackage : ReactPackage {
|
|
9
9
|
override fun createViewManagers(
|
|
10
10
|
reactContext: ReactApplicationContext,
|
|
11
|
-
): List<ViewManager<*, *>> = listOf(NativeOverlayViewManager(), NativeOverlayPageHostViewManager())
|
|
11
|
+
): List<ViewManager<*, *>> = listOf(NativeOverlayViewManager(), NativeOverlayPageHostViewManager(), NativeOverlayToasterViewManager())
|
|
12
12
|
|
|
13
13
|
override fun createNativeModules(
|
|
14
14
|
reactContext: ReactApplicationContext,
|