react-native/packages/react-native-test-library/package.json
Riccardo Cipolleschi fe1057afcd Let lib maintainer be explicit with componentProvider mapping (#47520)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47520

Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort.

With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves.

For example:
```json
//...
"codegenConfig": {
    //..
    "ios": {
      "componentProvider": {
        "RNTMyNativeView": "RNTMyNativeViewComponentView"
      }
    }
  },
```
means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class.

This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries.

## Changelog:
[iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric

Reviewed By: dmytrorykun

Differential Revision: D65666061

fbshipit-source-id: 692e753635873ff9260e131d2d18ed226b2378c2
2024-11-12 07:38:03 -08:00

55 lines
1.5 KiB
JSON

{
"name": "@react-native/oss-library-example",
"version": "0.77.0-main",
"private": true,
"description": "Package that includes native module exapmle, native component example, targets both the old and the new architecture. It should serve as an example of a real-world OSS library.",
"license": "MIT",
"homepage": "https://github.com/facebook/react-native.git",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react-native.git",
"directory": "packages/react-native-test-library"
},
"main": "./index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
"build": "yarn clean && babel --out-dir lib src",
"clean": "rimraf lib",
"codegen": "npx react-native codegen",
"prepare": "yarn run codegen && yarn run build"
},
"files": [
"generated"
],
"devDependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.77.0-main",
"react-native": "1000.0.0"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"codegenConfig": {
"name": "OSSLibraryExampleSpec",
"type": "all",
"jsSrcsDir": "src",
"outputDir": {
"ios": "ios",
"android": "android/src/main"
},
"includesGeneratedCode": true,
"android": {
"javaPackageName": "com.reactnative.osslibraryexample"
},
"ios": {
"componentProvider": {
"SampleNativeComponent": "RCTSampleNativeComponentComponentView"
}
}
}
}