Code Monkey home page Code Monkey logo

react-native-device-settings's People

Contributors

adriaanvanrossum avatar christophby avatar rjblopes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-device-settings's Issues

[Android] Undefined is not an object (evaluating 'RNOpenSettings.generalSettings')

Hi, I've got an issue using this library, I followed the manual installation section and when I want to open the settings:

import DeviceSettings from 'react-native-device-settings';

class Toto extends React.Component {
  openSettings = () => {
    DeviceSettings.open();
  };

  render() {
    <Button onClick={this.openSettings}>
      Open settings
    </Button>
  }
}

I get a red screen error saying:
undefined is not an object (evaluating 'RNOpenSettings.generalSettings')

My MainActivity.java:

package com.MyApp.app;

import com.facebook.react.ReactActivity;
import com.rjblopes.opensettings.OpenSettingsPackage;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "MyApp";
    }
}

I've got these lines on my settings.graddle:

[...]
include ':react-native-device-settings'
project(':react-native-device-settings').projectDir = new File(settingsDir, '../node_modules/react-native-device-settings/android')
[...]

And in my project-level build.gradle:

dependencies {
  [...]
  compile project(':react-native-device-settings')
  [...]
}

RN: 0.55.3
Library npm version: 1.2.0
Android device: Xiaomi Redmi Note 4X
Android simulator: API 27

[EDIT]
I fixed it, instead of doing what Readme.md is saying, I put:

import com.rjblopes.opensettings.OpenSettingsPackage; // Add this import

[...]

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new OpenSettingsPackage(), // Add this line
            [...]
      );
    }
[...]

on MainApplication.java and removed:

import com.rjblopes.opensettings.OpenSettingsPackage;

from MainActivity.java

Android build fails

.../node_modules/react-native-device-settings/android/src/main/java/com/rjblopes/opensettings/OpenSettingsPackage.java:15: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error

My project has:

"react": "16.0.0-alpha.12",
"react-native": "0.47.1",

I did the setup via npm i react-native-device-settings --save && react-native link react-native-device-settings.

Everything works well on iOS.

Update npm version

Thank you for this library! It's been working great for me. Do you think you could publish a new version of the package on npm that includes the Android @Override change from this commit?

Referencing the git tag does, of course, work, but it's certainly not as clear as using semver.

Thanks again!

Open Location settings

Is there any support for this screen right now? really need it for my works. I don't see it in the market now. Thanks.

Open app permissions?

I was wondering if it's possible to open app permissions page in Android instead of just app settings?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.