leecade / leecade/react-native-swiper

dynamic views

Open
#752 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Which OS ?

Both

Version

Latest

Expected behaviour

Add new component without recreate any other component

Actual behaviour

Everytime when I add dynamic components to Swiper all the old components are recreated.

My issue is about dynamic views.
I have a component called Table inside a Swiper. According to some events on my component the system will add more tables to Swiper but when it happens all the components added are recreated but I need to add news components to the swiper keeping the state of the components already added.

example code:

 render() {
         return (
             <Swiper loop={false}  showsPagination={false} showsButtons={false}>
                 {this.tables.map((item,key)=>{
                     return (<View key={item.id} style={{flex: 1}}><Table
                                    game_id = {item.game_id}
                                    name={item.name}
                                    id={item.id}
                                    button={item.button}
                                    lateEnter={item.lateEnter}
                                    mynavigation={item.mynavigation}/></View>)
                 })}
             </Swiper>
         );
     }
 };

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the render method shown, especially the tables.map output passed to Swiper and the nested Table components. Trace how adding an item changes the rendered views and determine whether existing Table state is preserved; done means new tables appear without recreating the previously added components.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.