How to resolve Unhandled promise rejection: Error: Unable to activate keep awake React Native

Viewed 6497

Hello I am completely new on React Native so I am busy trying to get the gist of it, so I after I added this of code I started getting the following error below.

[Unhandled promise rejection: Error: Unable to activate keep awake]
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in   promiseMethodWrapper
- node_modules/@unimodules/react-native-adapter/build /NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
- node_modules/expo-keep-awake/build/index.js:10:58 in activateKeepAwake
- node_modules/expo/build/launch/registerRootComponent.expo.js:6:4 in <global>
- node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
- node_modules/expo/AppEntry.js:1:0 in <global>
- node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
- node_modules/metro/src/lib/polyfills/require.js:201:44 in guardedLoadModule
* http://192.168.1.96:19001/node_modules/expo/AppEntry.bundle?platform=android& dev=true&minify=false&hot=false:154700:3 in global code

Below is the code that I added that maybe resulted to that error

import { FloatingAction } from "react-native-floating-action";
const FloatingHomeButton = () => {
  const actions = [
    {
      text: "Accessibility",
      icon: require("../images/tweet.png"),
      name: "bt_accessibility",
      position: 2,
    },
  ];
  return (
    <View style={styles.button}>
      <FloatingAction
        actions={actions}
        onPressItem={() => {
          console.log(`selected button`);
        }}
      />
    </View>
  );
};

Can I please get help on how I can resolve this issue and if possible can I please be told what could be causing this error

1 Answers

I think you have missed importing the View component from 'react-native'. Try This:

import { View } from 'react-native';

I hope this helps your issue.

Related