Skip to content

callstackincubator/react-native-legal

Repository files navigation

with-react-native-oss-notice

Automagically generate license acknowledgements for your React Native app 🚀

Android iOS AndroidTV tvOS
Android example iOS example AndroidTV example tvOS example

Installation

yarn add with-react-native-oss-notice

or

npm i --save with-react-native-oss-notice

Usage

This tool is split into 2 parts:

I want to generate licenses in my Expo project

  1. Add the config plugin to the app.json/app.config.js
{
  "expo": {
    "plugins": [
+      "with-react-native-oss-notice"
    ]
  }
}
  1. Use the library in the codebase
import * as React from 'react';
import { Button, View } from 'react-native';
import { WithReactNativeOSSNotice } from 'with-react-native-oss-notice';

function launchNotice() {
  WithReactNativeOSSNotice.launchLicenseListScreen('OSS Notice');
}

function MyComponent() {
  return (
    <View>
      <Button onPress={launchNotice} text="Open source licenses" />
    </View>
  );
}
  1. Use Prebuild or EAS to build the app

I want to generate licenses in my bare RN project

  1. Invoke the CLI plugin from the root of your RN app
npx react-native with-oss-notice

or

yarn react-native with-oss-notice
  1. Use the library in the codebase
import * as React from 'react';
import { Button, View } from 'react-native';
import { WithReactNativeOSSNotice } from 'with-react-native-oss-notice';

function launchNotice() {
  WithReactNativeOSSNotice.launchLicenseListScreen('OSS Notice');
}

function MyComponent() {
  return (
    <View>
      <Button onPress={launchNotice} text="Open source licenses" />
    </View>
  );
}

Expo

  • ✅ You can use this library with Development Builds by adding with-react-native-oss-notice to your app.json/app.config.js plugins array.
  • ❌ This library can't be used in the "Expo Go" app because it requires custom native code.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Acknowledgements

  • AboutLibraries - collects and displays the license metadata for the Android app <3
  • LicensePlist - generates license metadata for the iOS app <3

License

MIT