I'm using a package to that allows to render views in a slide.
I am trying to go through each view by creating an an array of objects that include a text and image source string.
I have done it two ways:
creating a this. function in the render() method and calling it inside inside "{this. function}" inside the page element.
&
import React, { Component } from 'react'
import { View, Text, StyleSheet, Image } from 'react-native'
import { Pages } from 'react-native-pages'
const styles = StyleSheet.create({
container: {
flex: 1,
},
})
export default class Walkthrough extends Component {
render() {
const pages = [{
text: 'first slide',
imageSource: './images/hello.png',
},
{
text: 'second slide',
imageSource: './images/hello.png',
},
{
text: 'third slide',
imageSource: './images/hello.png',
}]
return (
<Pages>
{ pages.map(([value, index]) => {
return (
<View key={index}>
<Image uri={value.imageSource} />
<Text> {value.text} </Text>
</View>
)
})}
</Pages>
)
}
}
I continue to get this error: "Invalid attempt to destructure non-iterable instance" relating to babel.
My babel related dependencies:
"devDependencies": {
"babel-eslint": "^8.0.1",
"babel-jest": "21.2.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-react-native": "4.0.0",
},