Skip to content

Support for wrapping Native Packages #543

@ghost

Description

Introduction

While React Native provides some excellent APIs for allowing packages to bind native libraries to TypeScript, we have a requirement to centralise business logic outside of packages. However, after looking at the documentation, and trying numerous things, it appears that I cannot achieve this in React Native's current form.

This discussion encompasses why we want to achieve this. If this cannot be done, and will not be done for a specific reason, I'd like to know why. In the situation I've misunderstood something in the documentation, I apologies and will be happy to look at any documentation to achieve it.

Details

We're looking to write a package that will combine several components that contain native code, for example:

  • consumer-app
dependencies: {
    "my-wrapping-package": "1.2.3"
}

my-wrapping-package

peerDependencies: {
    "react-native-webview": "4.5.6",
    "react-native-device-info": "7.8.9",
}

We want to enable teams within our organisation to install one package, maintained centrally, in order to simplify the development process, and support a pre-defined legacy API.

When I have attempted to achieve this via the above package configuration, it cannot link the various dependencies through the wrapper. In other words, I don't see the relevant pods in my podfile.lock. I can see them if I install them as direct dependencies in "consumer-app".

Discussion points

  • Am I doing something stupid here?
  • While the documentation states about linking here, it's not clear as to how it might be achieved. If I am missing something obvious, is it possible to improve the documentation in this area?
  • If this is not possible for middleware packages to define and manage native dependencies, why not?

Thanks for your consideration.

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