Add Android BridgeViewProvider for React Native view overrides#32
Open
asikora-sf wants to merge 7 commits intosalesforce:devfrom
Open
Add Android BridgeViewProvider for React Native view overrides#32asikora-sf wants to merge 7 commits intosalesforce:devfrom
asikora-sf wants to merge 7 commits intosalesforce:devfrom
Conversation
4 tasks
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.
bd47ecd to
add211f
Compare
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.
Bridges the native SDK view customization to React Native via ReactRootView. - BridgeViewProvider: canHandle() checks pre-registered types, GetView() renders ReactRootView in Compose - registerViewProvider/clearViewProvider React methods exposed to JS - ViewProvider passed to AgentforceConfiguration builder when registered
Change BridgeViewProvider from N:1 (multiple types → one component) to 1:1 mapping (each type → its own React component name). The register() method now accepts a Map<String, String> and GetView() looks up the per-type component name from the map. Also update registerViewProvider in AgentforceModule to read componentMap from the ReadableMap instead of componentTypes array + reactComponentName.
add211f to
47ed555
Compare
Contributor
Author
|
@CCX-Wu I had to do some sizing work in the second PR for intrinsic sizing on iOS, may need some Android work as well if there's similar issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BridgeViewProvider.ktimplementingAgentforceViewProviderinterfacecanHandle(definition:)checks against pre-registered component type strings from JSGetView()renders aReactRootViewinside a ComposeAndroidViewregisterViewProvider/clearViewProviderReact methods toAgentforceModuleAgentforceConfiguration.Builderwhen registeredStack
PR 3/6 in the
viewproviderstack. Depends on PR #30, #31.Test plan