Gallery image selector screen opens behind custom dialog
See original GitHub issueHello,
I’m trying to upload an image from the Gallery and insert it inside a custom modal but when I call for the gallery, the image selector screen from IOS opens behind the dialog.
Note: I’m using Angular 2 and Typescript, Nativescript v2.3.0 and it’s happening on IOS emulator -> Iphone 6 - 8.1
Here is my modal xml:
<GridLayout rows="*,60,100,auto" columns="*,*" class="modal-height padding-m">
<Image row="0" colSpan="2" [src]="character.imageUrl" (tap)="uploadImage()" verticalAlignment="center" class="margin-bottom-s thumbnail"></Image>
<TextField row="1" colSpan="2" hint="Enter name" keyboardType="text" autocorrect="false" autocapitalizationType="none" class="margin-bottom-s" [(ngModel)]="character.name"></TextField>
<TextView row="2" colSpan="2" hint="Enter description" [editable]="true" class="margin-bottom-s" [(ngModel)]="character.description"></TextView>
<Button row="3" col="0" text="Save" (tap)="save(character)" class="btn-height btn-fontSize btn-positive"></Button>
<Button row="3" col="1" text="Cancel" (tap)="cancel()" class="btn-height btn-fontSize"></Button>
</GridLayout>
Here is my component code:
@Component({
selector: 'modal-content',
templateUrl: 'modal-content.html'
})
export class ModalContent {
public character: Character;
constructor(private params: ModalDialogParams) {
this.character = new Character();
this.character.imageUrl = "~/images/camera-icon.png";
}
public uploadImage(): void {
let context = imagepickerModule.create({
mode: "single"
});
if (platform.device.os === "Android" && platform.device.sdkVersion >= "23") {
permissions.requestPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE, "I need these permissions to read from storage")
.then(() => {
this.startSelection(context);
})
.catch((err) => {
console.log("Permiso denegado! :( ");
console.log("err", err);
});
} else {
this.startSelection(context);
}
}
public startSelection(context): void {
context
.authorize()
.then(() => {
return context.present();
})
.then((selection) => {
selection.forEach((selected) => {
this.character.imageUrl = selected.thumb;
});
})
.catch((e)=> {
console.log(e);
});
}
public save(res: Character): void {
this.params.closeCallback(res);
}
public cancel() {
this.params.closeCallback('Cancel');
}
Any ideas?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Dialogs | Android Developers
A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill...
Read more >android - Dialog to pick image from gallery or from camera
Just show a dialog with two options and upon selection, use the appropriate code. To take picture from camera: Intent takePicture = new...
Read more >P: Dialog boxes / error messages pop up invisibly - macOS
I am editing an image set and then as I'm working, the pop-up command box opens BEHIND the main panel. I cannot move...
Read more >How to Make Dialogs (The Java™ Tutorials > Creating ...
To create a custom dialog, use the JDialog class directly. The code for simple dialogs can be minimal. For example, here is an...
Read more >The Dialog element - HTML: HyperText Markup Language
Indicates that the dialog is active and can be interacted with. When the open attribute is not set, the dialog shouldn't be shown...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
no fix for this yet?
Had the same issue, in my case I opened a modal just to select “Camera” or “Gallery”, because of this issue I just closed the modal windows after user selection, basically the modal is not taking care of actually opening the gallery, just grab the source of the picture.
+1 to maybe fix this.