0

Hi everyone need help with this package react-native-snap-carousel. I want to implement it just like this https://i.pinimg.com/originals/d5/6a/06/d56a06bffbd19494fc8596b984789e29.gif

Code used for Carousel

    _renderItem=({ item, index})=>{
        return  (

            <View style={{backgroundColor:'#fff',height:'80%',margin:'3%',elevation:2,justifyContent:'center',alignItems:'center'}}>
                <Text style={{fontFamily:'Poppins-Regular',fontSize:15,fontWeight:'300',color:'#444'}}>{item}</Text>
            </View>
        );
    }
   <Carousel
       data={this.state.packageList}
       renderItem={this._renderItem}
    /> 

How can I pass this array of objects as data to the Carousel component,

{"packageList": [{"amount": 300, "characterization": "A", "description": "Entry level package.", "durationType": "M", "isFree": "N", "name": "Basic Package", "packageId": 1, "status": "A", "type": 4}, {"amount": 500, "characterization": "A", "description": "Premium package allows real-time displaying of the services and caters larger client base. Valid for 3 months ", "durationType": "TM","isFree": "N", "name": "Premium", "packageId": 2, "status": "A", "type": 4}, {"amount": 700, "characterization": "A","description": "Provides larger client base and features.", "durationType": "SM","isFree": "N", "name": "Extra Premium   ","packageId": 3,"status": "A","type": 4}]}
haridev
  • 5
  • 7
  • 1
    This question is too broad for SO, and you've not attempted to solve this yourself. You might find reading the site [help section](https://stackoverflow.com/help) useful when it comes to [asking a good question](https://stackoverflow.com/help/how-to-ask), and this [question checklist](https://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist). Code that you've worked on to solve the problem should include a [mcve], _and be included in your question_. – Andy Sep 30 '21 at 14:11
  • @Andy Sorry for making to so broad. I have edited it and I had installed the package and tried to feed the above mentioned json as data to the Carousel component, but i got an error saying React objects cant be added as child components . – haridev Sep 30 '21 at 14:39

0 Answers0