react-native-settings icon indicating copy to clipboard operation
react-native-settings copied to clipboard

null is not an object (evaluating '_reactNativeSettings.default.getSetting')

Open spacearound404 opened this issue 4 years ago • 2 comments

Error: TypeError: null is not an object (evaluating '_reactNativeSettings.default.getSetting')

Click To Expand
TypeError: null is not an object (evaluating '_reactNativeSettings.default.getSetting')
This error is located at:
    in WrapperComponent (at OrdersScreen.js:215)
    in RCTView (at View.js:34)
    in View (at OrdersScreen.js:186)
    in OrdersScreen (at SceneView.tsx:122)
    in StaticContainer
    in StaticContainer (at SceneView.tsx:115)
    in EnsureSingleNavigator (at SceneView.tsx:114)
    in SceneView (at useDescriptors.tsx:153)
    in RCTView (at View.js:34)
    in View (at ResourceSavingScene.tsx:64)
    in RCTView (at View.js:34)
    in View (at ResourceSavingScene.tsx:63)
    in ResourceSavingScene (at DrawerView.tsx:183)
    in RCTView (at View.js:34)
    in View (at src/index.native.js:123)
    in ScreenContainer (at DrawerView.tsx:162)
    in RCTView (at View.js:34)
    in View (at Drawer.tsx:645)
    in RCTView (at View.js:34)
    in View (at createAnimatedComponent.js:240)
    in AnimatedComponent(View) (at Drawer.tsx:638)
    in RCTView (at View.js:34)
    in View (at createAnimatedComponent.js:240)
    in AnimatedComponent(View) (at Drawer.tsx:628)
    in PanGestureHandler (at GestureHandlerNative.tsx:13)
    in PanGestureHandler (at Drawer.tsx:619)
    in DrawerView (at DrawerView.tsx:215)
    in SafeAreaProviderCompat (at DrawerView.tsx:213)
    in GestureHandlerRootView (at GestureHandlerRootView.android.js:31)
    in GestureHandlerRootView (at DrawerView.tsx:212)
    in DrawerView (at createDrawerNavigator.tsx:47)
    in DrawerNavigator (at DrawerNavigation.js:11)
    in DrowerNavigation (at HomeScreen.js:6)
    in HomeScreen (at SceneView.tsx:122)
    in StaticContainer
    in StaticContainer (at SceneView.tsx:115)
    in EnsureSingleNavigator (at SceneView.tsx:114)
    in SceneView (at useDescriptors.tsx:153)
    in RCTView (at View.js:34)
    in View (at BottomTabView.tsx:55)
    in SceneContent (at BottomTabView.tsx:171)
    in RCTView (at View.js:34)
    in View (at ResourceSavingScene.tsx:64)
    in RCTView (at View.js:34)
    in View (at ResourceSavingScene.tsx:63)
    in ResourceSavingScene (at BottomTabView.tsx:165)
    in RCTView (at View.js:34)
    in View (at src/index.native.js:123)
    in ScreenContainer (at BottomTabView.tsx:145)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:74)
    in SafeAreaProvider (at SafeAreaProviderCompat.tsx:42)
    in SafeAreaProviderCompat (at BottomTabView.tsx:144)
    in BottomTabView (at createBottomTabNavigator.tsx:45)
    in BottomTabNavigator (at NavigationCustom.js:85)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:409)
    in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:91)
    in ThemeProvider (at NavigationContainer.tsx:90)
    in ForwardRef(NavigationContainer) (at NavigationCustom.js:80)
    in NavigationCustom (created by ConnectFunction)
    in ConnectFunction (at App.js:9)
    in Provider (at App.js:8)
    in App (at renderApplication.js:45)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:132)
    in AppContainer (at renderApplication.js:39)

My installation steps:

  1. npm install react-native-settings --save
  2. react-native link react-native-settings
  3. in MainApplication.java added:
...
import android.content.IntentFilter;
import io.rumors.reactnativesettings.RNSettingsPackage;
import io.rumors.reactnativesettings.receivers.GpsLocationReceiver;
import io.rumors.reactnativesettings.receivers.AirplaneModeReceiver;
...

public class MainApplication extends Application implements ReactApplication {

  ...

  @Override
  public void onCreate() {

    ...

    registerReceiver(new GpsLocationReceiver(), new IntentFilter("android.location.PROVIDERS_CHANGED"));
    registerReceiver(new AirplaneModeReceiver(), new IntentFilter("android.intent.action.AIRPLANE_MODE"));
  }
}
  1. npm i & react-native link
  2. react-native run-android -- --reset-cache

The example starts and works successfully. I checked everything several times, but I can't figure out how to fix it. I don't use Expo.

build.gradle info:

buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28    

gradle: 3.6.3 react-native: 0.63.4 android: 9.0 react-native-settings: 0.2.3

spacearound404 avatar Jan 30 '21 14:01 spacearound404

I tried to install v0.2.2, v0.2.1, v0.2.0, it didn't help. By the way, if write console.log(NativeModules); then print {}, also if write console.log(RNSettings); then print null in /node_modules/react-native-settings/index.js file

spacearound404 avatar Jan 30 '21 15:01 spacearound404

I got the exact same error, with undefined instead of null.

sentientmachin3 avatar Apr 19 '21 12:04 sentientmachin3