Skip to content

Cannot read property 'KnockProvider' of undefined #838

@anujraghuvanshi

Description

@anujraghuvanshi

I am Getting this Error - Cannot read property 'KnockProvider' of undefined

Here's my code Snippet -

import { KnockFeedProvider, KnockProvider } from '@knocklabs/react-native';

<KnockProvider
  apiKey={"MY_API_KEY"}
  user={{ id: "myuserid", email: "myuserid" }}
>
  <KnockFeedProvider feedId={process.env.KNOCK_FEED_ID}>
    <Text>Notifications go in here!</Text>
  </KnockFeedProvider>
</KnockProvider>;

Package Version - "@knocklabs/react-native": "^0.7.6",

I have installed this package version and used the code simply and re-run the app and getting the error. This should ideally work as I can't see any native dependencies to be installed.

Here's System Info -

ystem:
  OS: macOS 26.2
  CPU: (12) arm64 Apple M3 Pro
  Memory: 324.77 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 4.9.1
    path: ~/.nvm/versions/node/v20.9.0/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.nvm/versions/node/v20.9.0/bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK:
    API Levels:
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.1
    wanted: 18.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Note: I am currently running in iOS only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions