Skip to content

callstackincubator/react-native-legal

Repository files navigation

react-native-legal

Automagically generate license acknowledgements for your React Native app 🚀

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

Installation

yarn add react-native-legal

or

npm i --save react-native-legal

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": [
+      "react-native-legal"
    ]
  }
}
  1. Use the library in the codebase
import * as React from 'react';
import { Button, View } from 'react-native';
import { ReactNativeLegal } from 'react-native-legal';

function launchNotice() {
  ReactNativeLegal.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 legal-generate

or

yarn react-native legal-generate
  1. Use the library in the codebase
import * as React from 'react';
import { Button, View } from 'react-native';
import { ReactNativeLegal } from 'react-native-legal';

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

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

Expo

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