Skip to content

fix: merchant views on the New Architecture below RN 0.82 - #198

Merged
vraghunandhan merged 1 commit into
mainfrom
fix/merchant-views-new-arch
Oct 25, 2026
Merged

vraghunandhan merged 1 commit into
mainfrom
fix/merchant-views-new-arch

Conversation

@Yaswanth0606

@Yaswanth0606 Yaswanth0606 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Merchant views (JuspayHeader, JuspayHeaderAttached, JuspayFooter, JuspayFooterAttached) did not render for apps on React Native below 0.82 running the New Architecture (bridgeless).

  • Android: below 0.82, createMerchantView called getReactNativeHost().getReactInstanceManager() before checking IS_NEW_ARCHITECTURE_ENABLED. Bridgeless apps whose ReactNativeHost throws there never reached the ReactHost path, and the stock host built an unused legacy ReactInstanceManager. New Architecture builds now always take the ReactHost.createSurface(activity, …) path that RN 0.82+ already uses. createReactSurfaceView was only reachable from the old branch and created surfaces with the ReactApplicationContext instead of the activity, so it is removed.
  • iOS (RN 0.78+): the RCTReactNativeFactory lookup checked HyperSdkReactDelegate, then only ivars declared on the app delegate's own class. RCTAppDelegate subclasses keep the factory in a superclass ivar, so they fell back to RCTRootView initWithBridge:, which never starts in bridgeless mode (RCTBridgeProxy.valid is NO). The lookup now also asks the delegate for reactNativeFactory. The runtime-resolved selectors are declared in a small protocol, which also clears two existing -Wundeclared-selector warnings.
  • README: documents newArchEnabled for Android below 0.82 (the library reads only the unscoped property) and replaces the Swift-only AppDelegate note with merchant-view requirements for both platforms.

Old-architecture apps and RN 0.82+ keep their current paths.

Test plan

  • :hyper-sdk-react:compileDebugJavaWithJavac passes in the example app (RN 0.79.7) with newArchEnabled=false and with -PnewArchEnabled=true
  • The hyper-sdk-react pod builds for the iOS simulator in the example app (RN 0.79.7, New Architecture), with no warnings left in HyperMerchantView.mm
  • Merchant view renders on RN 0.79 bridgeless: Android with a ReactNativeHost that throws from getReactInstanceManager(), iOS with an RCTAppDelegate subclass
  • Merchant view still renders on the old architecture and on RN 0.82+

Notes

  • yarn lint already fails on main (prettier errors in scripts/write-hyper-sdk-version.js), so these commits skipped only that pre-commit step.
  • useNewApprochForMerchantView is now implied by newArchEnabled, because build.gradle forces the New Architecture on 0.82+. A follow-up could drop it along with the REACT_NATIVE_VERSION parsing. That would also remove the startup NumberFormatException for react-native specifiers such as >=0.83.1 or npm: aliases.

@Yaswanth0606
Yaswanth0606 force-pushed the fix/merchant-views-new-arch branch from 784e860 to 621e429 Compare October 24, 2026 08:56
Android: below RN 0.82, createMerchantView called
getReactNativeHost().getReactInstanceManager() before checking IS_NEW_ARCHITECTURE_ENABLED,
so bridgeless apps whose ReactNativeHost throws there never got merchant views, and the
stock host built an unused legacy ReactInstanceManager. New Architecture builds now always
use the ReactHost.createSurface path with the activity context; createReactSurfaceView is
removed.

iOS: the RCTReactNativeFactory lookup only checked HyperSdkReactDelegate and ivars declared
on the app delegate's own class, so RCTAppDelegate subclasses fell back to RCTRootView
initWithBridge:, which renders nothing in bridgeless mode. Also ask the delegate for
reactNativeFactory, and declare the runtime-resolved selectors so -Wundeclared-selector
stays quiet.

README: document newArchEnabled for Android below RN 0.82 and how merchant views find the
ReactHost and RCTReactNativeFactory on the New Architecture.
@Yaswanth0606
Yaswanth0606 force-pushed the fix/merchant-views-new-arch branch from 621e429 to 1df2072 Compare October 24, 2026 16:22
@vraghunandhan
vraghunandhan merged commit df13dcd into main Oct 25, 2026
9 checks passed
@vraghunandhan
vraghunandhan deleted the fix/merchant-views-new-arch branch October 25, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants