Skip to content

Conversation

@leonelgalan
Copy link

@leonelgalan leonelgalan commented Nov 4, 2025

Summary

This PR addresses three critical compatibility and stability issues:

  1. Podspec: Migrates to install_modules_dependencies for proper New Architecture dependency management (fixes RCT-Folly compatibility issues)
  2. Swift initialization: Defers RowndPlugin state initialization until after configure() is called (fixes crash on initialization)
  3. JavaScript deprecation: Replaces deprecated YellowBox with LogBox (fixes runtime errors)

Changes

1. Podspec: Use install_modules_dependencies for New Architecture

File: rownd-react-native.podspec

  • Added initialization of install_modules_dependencies helper from React Native's scripts
  • Replaced manual dependency declarations (React-Codegen, RCT-Folly, RCTRequired, RCTTypeSafety, ReactCommon/turbomodule/core) with install_modules_dependencies(s)
  • This ensures proper dependency resolution and version compatibility with React Native 0.80+

References:

2. Swift: Defer state initialization until after configuration

File: ios/RowndPlugin.swift

  • Changed @ObservedObject private var state to private var state: ObservableState<RowndState>? = nil to allow deferred initialization
  • Moved state subscription and event emitter setup from init() to configure() method
  • State is now initialized only after Rownd.configure() is called, preventing crashes when accessing Rownd state before it's configured

Problem: Previously, the plugin attempted to access Rownd state during initialization, which could cause crashes if Rownd wasn't configured yet.

3. JavaScript: Replace deprecated YellowBox with LogBox

File: src/components/GlobalContext.tsx

  • Replaced YellowBox import with LogBox
  • Updated YellowBox.ignoreWarnings() calls to LogBox.ignoreLogs()
  • Removes deprecation warnings and runtime errors in React Native 0.63+

Testing

  • Verified podspec changes work with React Native 0.80+ New Architecture
  • Verified Swift initialization fix prevents crashes
  • Verified LogBox replacement removes deprecation warnings

Related Issues

Fixes compatibility issues with:

Versions

  • expo 54.0.21
  • react-native 0.81.5
  • @rownd/react-native 3.4.0

Summary by Sourcery

Ensure compatibility with React Native 0.80+ by updating the podspec for new architecture, deferring Swift plugin initialization to prevent crashes, and replacing deprecated YellowBox with LogBox in JavaScript.

Bug Fixes:

  • Defer RowndPlugin state initialization until after configure() is called to avoid iOS initialization crashes
  • Replace deprecated YellowBox with LogBox in GlobalContext to remove deprecation warnings

Build:

  • Migrate rownd-react-native podspec to use install_modules_dependencies for proper New Architecture dependency management

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 4, 2025

Reviewer's Guide

Updates Podspec to handle New Architecture dependencies, defers iOS plugin state setup until after Rownd.configure(), and replaces deprecated YellowBox with LogBox in the JS context for RN 0.80+ compatibility.

Sequence diagram for deferred RowndPlugin state initialization in iOS

sequenceDiagram
    participant App
    participant RowndPlugin
    participant Rownd
    participant EventEmitter

    App->>RowndPlugin: init()
    Note right of RowndPlugin: state is not initialized
    App->>RowndPlugin: configure(appKey)
    RowndPlugin->>Rownd: configure(launchOptions, appKey)
    Rownd-->>RowndPlugin: configuration complete
    RowndPlugin->>Rownd: getInstance().state().subscribe
    Rownd-->>RowndPlugin: ObservableState<RowndState>
    RowndPlugin->>EventEmitter: sendEvent("update_state", state)
Loading

Class diagram for updated RowndPlugin state management

classDiagram
    class RowndPlugin {
        - state: ObservableState<RowndState>?
        - stateCancellable: AnyCancellable?
        + init()
        + configure(appKey, resolver, rejecter)
    }
    class ObservableState {
        + $current: RowndState
        + subscribe(callback)
    }
    class RowndState {
        + toDictionary()
    }
    RowndPlugin --> ObservableState
    ObservableState --> RowndState
Loading

Class diagram for GlobalContext LogBox update

classDiagram
    class GlobalContext {
        + state: GlobalState
        + dispatch: React.Dispatch<TAction>
    }
    class LogBox {
        + ignoreLogs(warnings: string[])
    }
    GlobalContext ..> LogBox: uses
    GlobalContext ..> GlobalState
    GlobalContext ..> TAction
Loading

Flow diagram for Podspec dependency management update

flowchart TD
    A["Podspec loads"] --> B{Is RCT_NEW_ARCH_ENABLED == '1'?}
    B -- Yes --> C["Set compiler flags for New Architecture"]
    C --> D["Call install_modules_dependencies(s)"]
    B -- No --> E["Skip New Architecture dependency setup"]
Loading

File-Level Changes

Change Details Files
Podspec updated to use install_modules_dependencies for New Architecture
  • Added install_modules_dependencies helper import for React Native scripts
  • Replaced manual React Native dependency declarations with install_modules_dependencies(s)
rownd-react-native.podspec
Deferred Swift plugin state initialization until after configure()
  • Changed state property to optional ObservableState
  • Moved state subscription and event emitter setup from init() to configure()
ios/RowndPlugin.swift
Replaced deprecated YellowBox with LogBox in JS
  • Swapped YellowBox import to LogBox
  • Updated ignoreWarnings() calls to ignoreLogs()
src/components/GlobalContext.tsx

Assessment against linked issues

Issue Objective Addressed Explanation
#63 Remove or replace the dependency on RCT-Folly in the podspec to resolve installation errors with New Architecture projects.

Possibly linked issues

  • #provided_issue: PR updates Podspec to use install_modules_dependencies, resolving RCT-Folly specification not found error for New Architecture.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • In RowndPlugin consider adding a deinit to cancel stateCancellable so you don’t leak subscriptions when the plugin is deallocated.
  • You may want to document or guard behavior for repeated calls to configure() since subsequent invocations currently won’t reinitialize the state subscription.
  • Double-check that you’ve replaced all YellowBox imports with LogBox in GlobalContext.tsx and removed any lingering references to the old API.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In RowndPlugin consider adding a deinit to cancel stateCancellable so you don’t leak subscriptions when the plugin is deallocated.
- You may want to document or guard behavior for repeated calls to configure() since subsequent invocations currently won’t reinitialize the state subscription.
- Double-check that you’ve replaced all YellowBox imports with LogBox in GlobalContext.tsx and removed any lingering references to the old API.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

Unable to find a specification for RCT-Folly with New Architecture

1 participant