React native 如何解决未处理的承诺拒绝:错误:无法激活keep-aweep React Native

React native 如何解决未处理的承诺拒绝:错误:无法激活keep-aweep React Native,react-native,React Native,您好,我是React Native的新手,所以我正忙于了解它的要点,所以在添加了这段代码后,我开始出现以下错误 [Unhandled promise rejection: Error: Unable to activate keep awake] - node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper - node_modules/@unimodul

您好,我是React Native的新手,所以我正忙于了解它的要点,所以在添加了这段代码后,我开始出现以下错误

[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
[未处理的承诺拒绝:错误:无法激活保持唤醒]
-promiseMethodWrapper中的node_modules/react native/Libraries/BatchedBridge/NativeModules.js:103:50
-moduleName.methodInfo.name中的node_modules/@unimodules/react native adapter/build/NativeModulesProxy.native.js:15:23
-activateKeepAwake中的node_modules/expo keep awake/build/index.js:10:58
-node_modules/expo/build/launch/registerRootComponent.expo.js:6:4 in
-loadModuleImplementation中的node_modules/metro/src/lib/polyfills/require.js:321:11
-node_modules/expo/AppEntry.js:1:0英寸
-loadModuleImplementation中的node_modules/metro/src/lib/polyfills/require.js:321:11
-GuardLoadModule中的节点\ modules/metro/src/lib/polyfills/require.js:201:44
* http://192.168.1.96:19001/node_modules/expo/AppEntry.bundle?platform=android& 全局代码中的dev=true&minify=false&hot=false:154700:3
下面是我添加的可能导致该错误的代码

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>
  );
};
从“react native floating action”导入{FloatingAction};
常量FloatingHomeButton=()=>{
常量动作=[
{
文本:“可访问性”,
图标:require(“../images/tweet.png”),
名称:“bt_可访问性”,
职位:2,
},
];
返回(
{
log(`selected button`);
}}
/>
);
};

我可以获得有关如何解决此问题的帮助吗?如果可能,可以告诉我是什么原因导致此错误

我认为您错过了从“react native”导入
视图
组件。 试试这个:

从'react native'导入{View};
我希望这有助于解决您的问题