Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@nativescript/camera] _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Utils.isNullOrUndefined is not a function #54

Open
kriefsacha opened this issue Dec 23, 2020 · 3 comments

Comments

@kriefsacha
Copy link

kriefsacha commented Dec 23, 2020

Hi,

I had this issue by using

"nativescript-camera": "^4.4.0"

So i saw it was fixed on version 5.0.2 of @nativescript/camera , i removed the last one and puted this. But now i have another error message :

TypeError: nativescript_core__WEBPACK_IMPORTED_MODULE_0_.Utils.isNullOrUndefined is not a function

I'm on nativescript (v6.5.1) angular, android 11, this is my package.json if needed:

{
  "nativescript": {
    "id": "myID",
    "tns-android": {
      "version": "6.5.3"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@nativescript/camera": "^5.0.2",
    "@nativescript/theme": "^3.0.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@nstudio/nativescript-camera-plus": "^3.1.0",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "nativescript-angular": "^8.20.4",
    "nativescript-background-http": "^3.4.0",
    "nativescript-datetimepicker": "^1.2.3",
    "nativescript-imagecropper": "^3.0.0",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-nfc": "4.0.1",
    "nativescript-permissions": "^1.3.8",
    "nativescript-plugin-firebase": "9.0.2",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-chart": "^7.1.1",
    "nativescript-ui-sidedrawer": "^8.0.1",
    "reflect-metadata": "~0.1.10",
    "rxjs": "^6.4.0",
    "tns-core-modules": "^6.3.2",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@nativescript/schematics": "~0.5.0",
    "@ngtools/webpack": "~8.2.0",
    "@types/jasmine": "^3.5.11",
    "nativescript-dev-webpack": "^1.4.1",
    "tns-platform-declarations": "6.0.1",
    "typescript": "~3.5.3"
  },
  "readme": "NativeScript Application"
}

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="__PACKAGE__"
	android:versionCode="20031"
	android:versionName="2.31">

	<supports-screens
		android:smallScreens="true"
		android:normalScreens="true"
		android:largeScreens="true"
		android:xlargeScreens="true"/>

	<uses-sdk
		android:minSdkVersion="26"
		android:targetSdkVersion="__APILEVEL__"/>
		
	<uses-permission android:name="android.permission.CAMERA"/>
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
	<uses-permission android:name="android.permission.INTERNET"/>
	
	
	<uses-feature android:name="android.hardware.camera" android:required="false" />
	<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
	<meta-data
	android:name="com.google.firebase.ml.vision.DEPENDENCIES"
	android:value="barcode"/>

	<application
		android:name="com.tns.NativeScriptApplication"
		android:allowBackup="true"
		android:icon="@drawable/icon"
		android:label="@string/app_name"
		android:requestLegacyExternalStorage="true"
		android:largeHeap="true"
		android:theme="@style/AppTheme">


		<activity
			android:name="com.tns.NativeScriptActivity" 
			android:label="@string/title_activity_kimera"
			android:configChanges="keyboardHidden|orientation|screenSize|uiMode" 
 		    android:theme="@style/LaunchScreenTheme"
			android:screenOrientation="portrait">

 			<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" /> 

			<intent-filter> 
 			<action android:name="android.intent.action.MAIN" /> 
 			<category android:name="android.intent.category.LAUNCHER" /> 
 			</intent-filter> 
		</activity>
		<activity android:name="com.tns.ErrorReportActivity"/>
	</application>
</manifest>

Please help ! Thanks !

@kriefsacha kriefsacha changed the title @nativescript/camera _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Utils.isNullOrUndefined is not a function @nativescript/camera - " _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Utils.isNullOrUndefined is not a function " Dec 23, 2020
@kriefsacha
Copy link
Author

kriefsacha commented Dec 28, 2020

Someone is still working on this plugin ? @NathanWalker maybe ? This is a big issue for us ..

@JonasLykke7
Copy link

JonasLykke7 commented Jan 12, 2021

Since your still on NS6 The nativescript-camera works fine.
But nativescript-camera does not support Android 11 new file system rules :/

@nativescript/camera is a NS7 plugin. And works with Android 11. But then you have to upgrade the whole app to an NS7 project.

@rigor789 rigor789 changed the title @nativescript/camera - " _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Utils.isNullOrUndefined is not a function " [@nativescript/camera] _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Utils.isNullOrUndefined is not a function Jan 26, 2021
@JonasLykkeIOspect
Copy link

@kriefsacha...

Here is a workaround :)

Edit index.android.js:

if (!permissions.hasPermission(android.Manifest.permission.CAMERA)) {
reject(new Error('Application does not have permissions to use Camera'));
return;
}
let types = require('tns-core-modules/utils/types');
let saveToGallery = true;
let reqWidth = 0;
let reqHeight = 0;
let shouldKeepAspectRatio = true;
let density = Utils.layout.getDisplayDensity();
if (options) {
saveToGallery = types.isNullOrUndefined(options.saveToGallery) ? saveToGallery : options.saveToGallery;
reqWidth = options.width ? options.width * density : reqWidth;
reqHeight = options.height ? options.height * density : reqWidth;
shouldKeepAspectRatio = types.isNullOrUndefined(options.keepAspectRatio) ? shouldKeepAspectRatio : options.keepAspectRatio;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants