Skip to content

Add iOS BridgeViewProvider for React Native view overrides#31

Open
asikora-sf wants to merge 5 commits intosalesforce:devfrom
asikora-sf:stack/viewprovider/02-ios-viewprovider-bridge
Open

Add iOS BridgeViewProvider for React Native view overrides#31
asikora-sf wants to merge 5 commits intosalesforce:devfrom
asikora-sf:stack/viewprovider/02-ios-viewprovider-bridge

Conversation

@asikora-sf
Copy link
Contributor

Summary

  • Creates BridgeViewProvider.swift implementing AgentforceViewProviding protocol
  • canHandle(type:) checks against pre-registered component type strings from JS
  • view(for:data:) returns an RCTRootView wrapped in SwiftUI via UIViewRepresentable
  • Adds registerViewProvider / clearViewProvider native methods to AgentforceModule
  • Passes the view provider to AgentforceClient init when registered

Stack

PR 2/6 in the viewprovider stack. Depends on PR #30.

Test plan

  • iOS build compiles with new BridgeViewProvider
  • registerViewProvider accepts componentTypes + reactComponentName
  • clearViewProvider resets registration
  • Without registration, AgentforceClient inits with nil viewProvider (no behavior change)

Replace componentTypes[] + reactComponentName with a componentMap
Record<string, string> so each SDK component type maps to its own
React Native component name.
Bridges the native SDK view customization to React Native via RCTRootView.
- BridgeViewProvider: canHandle() checks pre-registered types, view() renders RCTRootView in SwiftUI
- registerViewProvider/clearViewProvider native methods exposed to JS
- ViewProvider passed to AgentforceClient init when registered
Replace Set<String> + single reactComponentName with a [String: String]
dictionary mapping each component definition to its own React component.
canHandle() checks map keys, view() looks up the component name per type.
@asikora-sf asikora-sf force-pushed the stack/viewprovider/02-ios-viewprovider-bridge branch from 61db233 to 0045b72 Compare March 5, 2026 22:27
RCTRootView embedded in UIViewRepresentable was getting zero size
because SwiftUI had no sizing information. Set sizeFlexibility and
implement sizeThatFits so the React content measures correctly.
@asikora-sf asikora-sf requested review from robertson-waweru and tsaarva and removed request for tsaarva March 9, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant