Error: Undefined an object reactNativeAndroidLocationEnabler2

See original GitHub issue

I run this package with genymotion – android 6.0 and have this error Please give me any help. Thanks! package.js:

"react": "16.5.0",
"expo": "^31.0.2",
screen shot 2018-12-01 at 9 26 48 pm

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
kokorolxcommented, Dec 3, 2018

Here is my code.

import React from 'react';
import { AppRegistry, Text, View, TouchableOpacity, StyleSheet, Alert } from 'react-native';
import RNAndroidLocationEnabler from 'react-native-android-location-enabler';
export default class App extends React.Component {
  constructor(props) {
      super(props);
    }

    componentDidMount() {
      RNAndroidLocationEnabler.promptForEnableLocationIfNeeded({interval: 10000, fastInterval: 5000})
        .then(data => {
          console.log("Location turn on")
        }).catch(err => {
          console.log("Location error: ", err)
        });
    }

    render() {
      return (
        <View style={style.container}>
          <Text style={style.text}>Hello</Text>
        </View>
      );
    }
  }

  const style = StyleSheet.create({
    container: {
      flex: 1,
      alignItems: 'center',
      justifyContent: 'center',
    },
    button: {
      padding: 20,
    },
    text: {
      fontSize: 20,
    },
    textSuccess: {
      fontSize: 20,
      color: 'green',
    },
  });

the image above was checkout. I created new project and have the same error image

1reaction
louicodercommented, Nov 23, 2019

when I import the module import RNAndroidLocationEnabler from 'react-native-android-location-enabler'; I get in RNAndroidLocationEnabler undefined value

@andrey-shostik Are you running this on iOS, as far as I’m concerned this will be null or undefined for iOS, wrap this function inside a platform check. I have realised this only works with Android since it’s there’s a different procedure for toggling location on and off for iOS. Do something like:

if (Platform.OS === 'android') {
  toggleLocation(); // check whether location is enabled or not
} else {
  // block to check ios location enabled or not
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error undefined is not an object React Native - Stack Overflow
But, when I call it in child, error says: undefined is not an object! Child component: <BigNews id={props.content.main.first.id} ...
Read more >
react-native-android-location-enabler - Bountysource
As topic, it says I have duplicated react-native. 0 likes. Error: Undefined an object reactNativeAndroidLocationEnabler2 ...
Read more >
undefined is not an object error in my project. Pretty sure it has ...
I am trying to run a basic query on my react-native app using apollo. I keep getting the following error: TypeError: TypeError: undefined...
Read more >
Render Error undefined is not an Object (evaluating _react ...
In this video ,we fixed an error "Render Error undefined is not an Object (evaluating _react.react .createElement)".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found