vue-native endless-scroll with impagination
up vote
0
down vote
favorite
I want to make an example that includes an infinite-scroll list contains CardImage components. I follow this blog and it is used impagination package. Only different from that example is that I use vue-native which is a wrapper around React Native APIs.
When I start the app on the emulator, CardImage component is rendered successfully. But when I call the setupImpagination() function I get an error that "_impagination.Dataset is not a constructor". Did I missed something or is this a compatibility issue between react-native and vue-native? Any help would be great.
App.vue
<template>
<nb-container>
<nb-header />
<nb-content padder>
<nb-card>
<nb-card-item>
<nb-left>
<nb-thumbnail :source="logo"></nb-thumbnail>
<nb-body>
<nb-text>NativeBase</nb-text>
<nb-text note>GeekyAnts</nb-text>
</nb-body>
</nb-left>
</nb-card-item>
<nb-card-item cardBody>
<image :source="cardImage" class="card-item-image" :style="stylesObj.cardItemImage"/>
</nb-card-item>
<nb-card-item>
<nb-left>
<nb-button :onPress="setupImpagination">
<nb-icon name="thumbs-up" active></nb-icon>
<nb-text>4923 Likes</nb-text>
</nb-button>
</nb-left>
<nb-body>
<nb-button transparent>
<nb-icon name="chatbubbles" active></nb-icon>
<nb-text>89 Comments</nb-text>
</nb-button>
</nb-body>
<nb-right>
<nb-text>11h ago</nb-text>
</nb-right>
</nb-card-item>
</nb-card>
</nb-content>
</nb-container>
</template>
<style>
.container {
background-color: white;
align-items: center;
justify-content: center;
flex: 1;
}
.text-color-primary {
color: blue;
}
.card-item-image {
align-self: center;
height: 150;
margin-vertical: 5;
}
</style>
<script>
import { Dataset } from "impagination";
import logo from "./assets/logo.png";
import cardImage from "./assets/drawer-cover.png";
import { Dimensions } from "react-native";
const deviceWidth = Dimensions.get("window").width;
export default {
data: function() {
return {
logo,
cardImage,
stylesObj: {
cardItemImage: {
resizeMode: "cover",
width: deviceWidth / 1.18
}
}
};
},
methods: {
setupImpagination:function(){
console.log("setupImpagination");
let dataset = new Dataset({
pageSize: 15,
loadHorizon: 10,
fetch:function(pageOffset, pageSize, stats) {
return fetch('https://serene-beach-38011.herokuapp.com/api/faker?page='+${pageOffset + 1}+'&per_page='+${pageSize}+')'
.then(response => {response.json();
console.log(response.json())})
.catch((error) => {
console.error(error);
});
},
unfetch: function(records, pageOffset) {
console.log("unfetch")
},
filter: function(element, index, array) {
console.log("filter")
},
observe:(datasetState) => {
console.log("observe");
}
});
}
}
}
</script>
package.json
{
"name": "my_app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"impagination": "^1.0.0-alpha.3",
"native-base": "^2.8.1",
"react": "16.3.1",
"react-native": "0.55.4",
"vue-native-core": "0.0.8",
"vue-native-helper": "0.0.9"
},
"devDependencies": {
"babel-jest": "23.6.0",
"babel-preset-react-native": "4.0.1",
"jest": "23.6.0",
"react-test-renderer": "16.3.1",
"vue-native-scripts": "0.0.14"
},
"jest": {
"preset": "react-native"
}
}
react-native infinite-scroll endlessscroll vue-native vue-nativescript
add a comment |
up vote
0
down vote
favorite
I want to make an example that includes an infinite-scroll list contains CardImage components. I follow this blog and it is used impagination package. Only different from that example is that I use vue-native which is a wrapper around React Native APIs.
When I start the app on the emulator, CardImage component is rendered successfully. But when I call the setupImpagination() function I get an error that "_impagination.Dataset is not a constructor". Did I missed something or is this a compatibility issue between react-native and vue-native? Any help would be great.
App.vue
<template>
<nb-container>
<nb-header />
<nb-content padder>
<nb-card>
<nb-card-item>
<nb-left>
<nb-thumbnail :source="logo"></nb-thumbnail>
<nb-body>
<nb-text>NativeBase</nb-text>
<nb-text note>GeekyAnts</nb-text>
</nb-body>
</nb-left>
</nb-card-item>
<nb-card-item cardBody>
<image :source="cardImage" class="card-item-image" :style="stylesObj.cardItemImage"/>
</nb-card-item>
<nb-card-item>
<nb-left>
<nb-button :onPress="setupImpagination">
<nb-icon name="thumbs-up" active></nb-icon>
<nb-text>4923 Likes</nb-text>
</nb-button>
</nb-left>
<nb-body>
<nb-button transparent>
<nb-icon name="chatbubbles" active></nb-icon>
<nb-text>89 Comments</nb-text>
</nb-button>
</nb-body>
<nb-right>
<nb-text>11h ago</nb-text>
</nb-right>
</nb-card-item>
</nb-card>
</nb-content>
</nb-container>
</template>
<style>
.container {
background-color: white;
align-items: center;
justify-content: center;
flex: 1;
}
.text-color-primary {
color: blue;
}
.card-item-image {
align-self: center;
height: 150;
margin-vertical: 5;
}
</style>
<script>
import { Dataset } from "impagination";
import logo from "./assets/logo.png";
import cardImage from "./assets/drawer-cover.png";
import { Dimensions } from "react-native";
const deviceWidth = Dimensions.get("window").width;
export default {
data: function() {
return {
logo,
cardImage,
stylesObj: {
cardItemImage: {
resizeMode: "cover",
width: deviceWidth / 1.18
}
}
};
},
methods: {
setupImpagination:function(){
console.log("setupImpagination");
let dataset = new Dataset({
pageSize: 15,
loadHorizon: 10,
fetch:function(pageOffset, pageSize, stats) {
return fetch('https://serene-beach-38011.herokuapp.com/api/faker?page='+${pageOffset + 1}+'&per_page='+${pageSize}+')'
.then(response => {response.json();
console.log(response.json())})
.catch((error) => {
console.error(error);
});
},
unfetch: function(records, pageOffset) {
console.log("unfetch")
},
filter: function(element, index, array) {
console.log("filter")
},
observe:(datasetState) => {
console.log("observe");
}
});
}
}
}
</script>
package.json
{
"name": "my_app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"impagination": "^1.0.0-alpha.3",
"native-base": "^2.8.1",
"react": "16.3.1",
"react-native": "0.55.4",
"vue-native-core": "0.0.8",
"vue-native-helper": "0.0.9"
},
"devDependencies": {
"babel-jest": "23.6.0",
"babel-preset-react-native": "4.0.1",
"jest": "23.6.0",
"react-test-renderer": "16.3.1",
"vue-native-scripts": "0.0.14"
},
"jest": {
"preset": "react-native"
}
}
react-native infinite-scroll endlessscroll vue-native vue-nativescript
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to make an example that includes an infinite-scroll list contains CardImage components. I follow this blog and it is used impagination package. Only different from that example is that I use vue-native which is a wrapper around React Native APIs.
When I start the app on the emulator, CardImage component is rendered successfully. But when I call the setupImpagination() function I get an error that "_impagination.Dataset is not a constructor". Did I missed something or is this a compatibility issue between react-native and vue-native? Any help would be great.
App.vue
<template>
<nb-container>
<nb-header />
<nb-content padder>
<nb-card>
<nb-card-item>
<nb-left>
<nb-thumbnail :source="logo"></nb-thumbnail>
<nb-body>
<nb-text>NativeBase</nb-text>
<nb-text note>GeekyAnts</nb-text>
</nb-body>
</nb-left>
</nb-card-item>
<nb-card-item cardBody>
<image :source="cardImage" class="card-item-image" :style="stylesObj.cardItemImage"/>
</nb-card-item>
<nb-card-item>
<nb-left>
<nb-button :onPress="setupImpagination">
<nb-icon name="thumbs-up" active></nb-icon>
<nb-text>4923 Likes</nb-text>
</nb-button>
</nb-left>
<nb-body>
<nb-button transparent>
<nb-icon name="chatbubbles" active></nb-icon>
<nb-text>89 Comments</nb-text>
</nb-button>
</nb-body>
<nb-right>
<nb-text>11h ago</nb-text>
</nb-right>
</nb-card-item>
</nb-card>
</nb-content>
</nb-container>
</template>
<style>
.container {
background-color: white;
align-items: center;
justify-content: center;
flex: 1;
}
.text-color-primary {
color: blue;
}
.card-item-image {
align-self: center;
height: 150;
margin-vertical: 5;
}
</style>
<script>
import { Dataset } from "impagination";
import logo from "./assets/logo.png";
import cardImage from "./assets/drawer-cover.png";
import { Dimensions } from "react-native";
const deviceWidth = Dimensions.get("window").width;
export default {
data: function() {
return {
logo,
cardImage,
stylesObj: {
cardItemImage: {
resizeMode: "cover",
width: deviceWidth / 1.18
}
}
};
},
methods: {
setupImpagination:function(){
console.log("setupImpagination");
let dataset = new Dataset({
pageSize: 15,
loadHorizon: 10,
fetch:function(pageOffset, pageSize, stats) {
return fetch('https://serene-beach-38011.herokuapp.com/api/faker?page='+${pageOffset + 1}+'&per_page='+${pageSize}+')'
.then(response => {response.json();
console.log(response.json())})
.catch((error) => {
console.error(error);
});
},
unfetch: function(records, pageOffset) {
console.log("unfetch")
},
filter: function(element, index, array) {
console.log("filter")
},
observe:(datasetState) => {
console.log("observe");
}
});
}
}
}
</script>
package.json
{
"name": "my_app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"impagination": "^1.0.0-alpha.3",
"native-base": "^2.8.1",
"react": "16.3.1",
"react-native": "0.55.4",
"vue-native-core": "0.0.8",
"vue-native-helper": "0.0.9"
},
"devDependencies": {
"babel-jest": "23.6.0",
"babel-preset-react-native": "4.0.1",
"jest": "23.6.0",
"react-test-renderer": "16.3.1",
"vue-native-scripts": "0.0.14"
},
"jest": {
"preset": "react-native"
}
}
react-native infinite-scroll endlessscroll vue-native vue-nativescript
I want to make an example that includes an infinite-scroll list contains CardImage components. I follow this blog and it is used impagination package. Only different from that example is that I use vue-native which is a wrapper around React Native APIs.
When I start the app on the emulator, CardImage component is rendered successfully. But when I call the setupImpagination() function I get an error that "_impagination.Dataset is not a constructor". Did I missed something or is this a compatibility issue between react-native and vue-native? Any help would be great.
App.vue
<template>
<nb-container>
<nb-header />
<nb-content padder>
<nb-card>
<nb-card-item>
<nb-left>
<nb-thumbnail :source="logo"></nb-thumbnail>
<nb-body>
<nb-text>NativeBase</nb-text>
<nb-text note>GeekyAnts</nb-text>
</nb-body>
</nb-left>
</nb-card-item>
<nb-card-item cardBody>
<image :source="cardImage" class="card-item-image" :style="stylesObj.cardItemImage"/>
</nb-card-item>
<nb-card-item>
<nb-left>
<nb-button :onPress="setupImpagination">
<nb-icon name="thumbs-up" active></nb-icon>
<nb-text>4923 Likes</nb-text>
</nb-button>
</nb-left>
<nb-body>
<nb-button transparent>
<nb-icon name="chatbubbles" active></nb-icon>
<nb-text>89 Comments</nb-text>
</nb-button>
</nb-body>
<nb-right>
<nb-text>11h ago</nb-text>
</nb-right>
</nb-card-item>
</nb-card>
</nb-content>
</nb-container>
</template>
<style>
.container {
background-color: white;
align-items: center;
justify-content: center;
flex: 1;
}
.text-color-primary {
color: blue;
}
.card-item-image {
align-self: center;
height: 150;
margin-vertical: 5;
}
</style>
<script>
import { Dataset } from "impagination";
import logo from "./assets/logo.png";
import cardImage from "./assets/drawer-cover.png";
import { Dimensions } from "react-native";
const deviceWidth = Dimensions.get("window").width;
export default {
data: function() {
return {
logo,
cardImage,
stylesObj: {
cardItemImage: {
resizeMode: "cover",
width: deviceWidth / 1.18
}
}
};
},
methods: {
setupImpagination:function(){
console.log("setupImpagination");
let dataset = new Dataset({
pageSize: 15,
loadHorizon: 10,
fetch:function(pageOffset, pageSize, stats) {
return fetch('https://serene-beach-38011.herokuapp.com/api/faker?page='+${pageOffset + 1}+'&per_page='+${pageSize}+')'
.then(response => {response.json();
console.log(response.json())})
.catch((error) => {
console.error(error);
});
},
unfetch: function(records, pageOffset) {
console.log("unfetch")
},
filter: function(element, index, array) {
console.log("filter")
},
observe:(datasetState) => {
console.log("observe");
}
});
}
}
}
</script>
package.json
{
"name": "my_app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"impagination": "^1.0.0-alpha.3",
"native-base": "^2.8.1",
"react": "16.3.1",
"react-native": "0.55.4",
"vue-native-core": "0.0.8",
"vue-native-helper": "0.0.9"
},
"devDependencies": {
"babel-jest": "23.6.0",
"babel-preset-react-native": "4.0.1",
"jest": "23.6.0",
"react-test-renderer": "16.3.1",
"vue-native-scripts": "0.0.14"
},
"jest": {
"preset": "react-native"
}
}
react-native infinite-scroll endlessscroll vue-native vue-nativescript
react-native infinite-scroll endlessscroll vue-native vue-nativescript
edited Nov 11 at 22:09
asked Nov 11 at 22:03
ahmet burak
34
34
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253706%2fvue-native-endless-scroll-with-impagination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253706%2fvue-native-endless-scroll-with-impagination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown