NativeScript / NativeScript/plugins
imagepicker with NativeScript Vue is not working
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 206
- フォーク
- 123
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 1
説明
Hello,
I'm writing an application in nativescript vue where I need to pick an image on iOS Photo Library.
For that I wanted to use the imagepicker plugin.
Authorization is working and I can select the pictures, but unfortunately as result I got that the uri is undefined.
Here after my code :
<template>
<Page @loaded="onPageLoaded">
<ActionBar title="Select Image" />
<StackLayout>
<Button text="Select Image" @tap="onSelectImageTap" />
<Image v-if="selectedImage" :src="selectedImage" stretch="aspectFill" />
</StackLayout>
</Page>
</template>
<script>
import * as ImagePicker from 'nativescript-imagepicker';
export default {
data() {
return {
selectedImage: null,
imagePicker: null // Initialize imagePicker property
};
},
methods: {
onPageLoaded() {
this.imagePicker = ImagePicker.create({
mode: 'single' // or 'multiple'
});
},
async onSelectImageTap() {
try {
if (!this.imagePicker) {
console.error('ImagePicker is not initialized.');
return;
}
await this.imagePicker.authorize();
const selection = await this.imagePicker.present();
console.log('Selection:', selection.map(item => ({ uri: item.uri })));
if (selection && selection.length > 0 && selection[0].uri) {
this.selectedImage = selection[0].uri;
} else {
console.error('No image selected or URI is undefined.');
}
} catch (error) {
console.error('Error selecting image:', error);
}
}
}
};
</script>
It seems that the same issue is happing also on the demo available under : https://www.npmjs.com/package/@nativescript/imagepicker#demo -> https://stackblitz.com/edit/nativescript-vue3-beta-krjk9k?file=app%2Fcomponents%2FHome.vue,app%2Fapp.css
Can you support me on this issue?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンクされている StackBlitz デモを iOS で実行し、app/components/Home.vue を確認します。app/app.css はデモの一部として利用できます。画像選択を再現し、返された選択オブジェクトを issue に記録された undefined uri と比較します。NativeScript Vue の例で、選択した画像から使用可能な URI が取得できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ios, typescript
- 領域
- mobile-dev
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100