MOBILE-342: Embedded blocks — the public API for React Native - #218
MOBILE-342: Embedded blocks — the public API for React Native#218Vailence wants to merge 4 commits into
Conversation
|
Спасибо за разбор — все четыре пункта закрыты в Обязательный: lintЗелёный. Одна поправка к рецепту: голый import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'на импорт из корня Плюс руками схлопнул конкатенации в шаблонные литералы: Осталось 0 ошибок и 2 предупреждения, оба преэкзистирующие: Средний: пустое имя местаИсправил ровно как предложено — гард больше не отказывается строить хост, и это подтвердилось на устройстве: блок схлопывается в 0 и отдаёт Но заодно выяснилось, что эталоном тут был не Android. На эмуляторе безымянное место даёт Нативный Android прячет свою вьюху ( Низкий: нулевая высотаВыровнял iOS по Android — в гард добавился Побочно чинится настоящий баг, который был виден на демо: блок в раскрывающемся контейнере (высота 0 → N) верстал страницу в нулевом вьюпорте и рапортовал Контракт Низкий: хвосты pending-сигналов
И там же нашлась причина посерьёзнее. Проверки40 jest-тестов (добавил 3: пустое имя, имя из пробелов, доставка исхода безымянного места), Про условия мержа и решение по trim — согласен, ждём релиза нативных SDK и командного решения; пины и CHANGELOG трогать не стал. |
Adds
MindboxEmbeddedBlock— the React Native wrapper over the SDK's own embedded block, the samecontainer SwiftUI, Compose and Flutter wrap. The app marks a place by its system name and hands it
a height; what goes into that place is the config's decision and changes without an app release.
Public API
Seven ideas, the same ones the other wrappers expose: the place, the host's height, the waiting
budget, two screens of the host's own, two outcomes — plus one thing only React Native needs.
placeSystemNameheighttimeoutMsplaceholder/errorerroris the opt-in into showing a failure at all; an empty place always collapses.onLoad/onFailonFailcovers a failure, a timeout and an empty place alike.activeImplementation
A Fabric component; the module is New Architecture only, so no old-architecture path exists.
SimpleViewManagerover a frame that holds the SDK'sMindboxEmbeddedBlockView.The frame installs its own
LifecycleOwner: the block must live as long as the RN view, not aslong as the fragment
react-native-screensdestroys under a covering screen. It also re-measuresitself on the looper, because Yoga answers a native child's
requestLayout()with nothing.RCTViewComponentView(Objective-C++, as the base class and event emitters are C++)driving a Swift host, since the container's wrapper API is behind
@_spi(Internal). The block isbuilt in
finalizeUpdates:, and appearances reported before the emitter exists are replayed onceit arrives.
with its view.
is taken, not what to draw there. The visible screens are RN overlays.
Notes for review
2.15.2/2.15.1). Embedded blocks are notreleased yet, so this branch is built against local builds through the existing
mindboxNativeSdkVersionoverride and a:pathpod — those overrides are deliberately notcommitted. The wire contract itself is already stable on
mission/storiesin all three native SDKs.Checks
tscclean over the feature.MindboxSdkscheme builds.empty place, custom timeout, host placeholder and error, taps and horizontal swipes reaching the
native content through the overlay, and push/modal cover-and-return keeping the content in place.