1.1.0 • Published 3 years ago

@bobbycolley/react-native-open-settings v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@bobbycolley/react-native-open-settings

Forked and up-to-date package for react-native-open-settings

npm version

Open your apps settings in the Settings app

Install

Yarn

yarn add @bobbycolley/react-native-open-settings

NPM

npm install @bobbycolley/react-native-open-settings

Setup

Autolinking

iOS

cd ios
pod install

Thats it! You don't need to do anything else.

Manual Setup

iOS

Add React Native Open Settings to project libraries.

Android

  • Edit build.gradle to look like this:
apply plugin: 'com.android.application'

android {
  ...
}

dependencies {
  ...
+ compile project(':react-native-open-settings')
}
  • In settings.gradle, insert the following code:
include ':react-native-open-settings'
project(':react-native-open-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-open-settings/android')
  • Edit your MainApplication.java to look like this:
package com.myapp;

....
import com.opensettings.OpenSettingsPackage

public class MainApplication extends Application implements ReactApplication {

    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new OpenSettingsPackage()
        );
    }
    ...
}

Usage

Require the @bobbycolley/react-native-open-settings module.

import OpenSettings from "@bobbycolley/react-native-open-settings";

And then, where you want to open the settings, just do

OpenSettings.openSettings();

Have fun!

TODO

  • Update README
  • Add MIT License
  • Update with PR's from react-native-open-settings
  • Add tests