0
我有一个函数requestSendSMSPermission
在PermissionManager
这是在utils目录中。TypeError:utils.requestSendSMSPermission不是函数
PermissionManager.js
module.export = {
requestSendSMSPermission: async function() {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.SEND_SMS
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
return true;
} else {
return false;
}
} catch (err) {
console.warn(err);
}
}
};
我曾经在我的组件进口这一点,并试图把这种
var utils = require("../utils/PermissionManager.js");
utils.requestSendSMSPermission()
我得到下面的错误,任何人都可以建议是什么,以及如何在事业我可以修好它 ?
D:\React Native\application\ui\CreateSMS.js:170 TypeError: utils.requestSendSMSPermission is not a function
at CreateSMS._onPress (D:\React Native\application\ui\CreateSMS.js:138)
at CreateSMS.proxiedMethod (D:\React Native\application\node_modules\react-proxy\modules\createPrototypeProxy.js:44)
at Object.onPress (D:\React Native\application\ui\CreateSMS.js:90)
at Object.touchableHandlePress (D:\React Native\application\node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js:129)
at Object._performSideEffectsForTransition (D:\React Native\application\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:746)
at Object._receiveSignal (D:\React Native\application\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:664)
at Object.touchableHandleResponderRelease (D:\React Native\application\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:433)
at Object.invokeGuardedCallback (D:\React Native\application\node_modules\react-native\Libraries\Renderer\ReactNativeStack-dev.js:130)
at Object.invokeGuardedCallback (D:\React Native\application\node_modules\react-native\Libraries\Renderer\ReactNativeStack-dev.js:166)
at Object.invokeGuardedCallbackAndCatchFirstError (D:\React Native\application\node_modules\react-native\Libraries\Renderer\ReactNativeStack-dev.js:169)
啊福气。谢谢:)为什么原子没有足够的智能这些有点错误:/ –