Open srokatonie opened 4 years ago
Can you log out the e.object
and ensure it's the CameraPlus instance?
@bradmartin
public camLoaded(e: any): void {
console.log('***** cam loaded *****');
console.log(e.object);
this.cam = e.object as CameraPlus;
const flashMode = this.cam.getFlashMode();
// ...
I am getting ProxProxyViewContaineryiew
:
CONSOLE LOG file: src/app/pages/progress-pictures/progress-pictures.component.ts:22:16: ***** cam loaded *****
CONSOLE LOG file: src/app/pages/progress-pictures/progress-pictures.component.ts:24:16: ProxyViewContainer(104)
CONSOLE ERROR [native code]: ERROR TypeError: this.cam.getFlashMode is not a function. (In 'this.cam.getFlashMode()', 'this.cam.getFlashMode' is undefined)
CONSOLE ERROR [native code]: ERROR CONTEXT {
"view": {
...
k so that does help
CONSOLE LOG file: src/app/pages/progress-pictures/progress-pictures.component.ts:24:16: ProxyViewContainer(104)
is definitely not the CamPlus
instance, I forget if the demo does similar, but you need to get the camera instance (which you seem to be aware of that). I think this used to work just fine. Have you registered the element via registerElement
in your angular app for this plugin?
Ok, that worked. I've missed registerElement
from the demo.
The README could contain a bit more info about the installation:
// iOS setup
// Add to App_Resources/iOS/Info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to the photo library.</string>
// Angular
// Add in AppComponent
import { CameraPlus } from '@nstudio/nativescript-camera-plus';
import { registerElement } from '@nativescript/angula
I don't mind creating a PR for that?
The demo is also not working, getting an error:
$npm run demo.ng.ios
...
../src/camera-plus.ios.ts:1419:5 - error TS2304: Cannot find name 'CGPointMake'.
1419 CGPointMake(50.61, 23.35)
...
I could look at this later as well.
PR appreciated for sure, thanks 👍 - as for the demo warning, we might just need to add skipLibCheck:true
to the tsconfig for that project since you normally dont scan node_modules for typing warnings.
I have copied the demo-ng (it wouldn't start after cloning the repo for some reason) and tried to run.
Install plugin:
Component:
Html:
Console:
I see the initial screen with 6 buttons, but the console log throws errors about undefined functions.
Any idea what's wrong?