leecade / leecade/react-native-swiper

🐛🐛🐛When data is acquired from the network, the display is abnormal

Open
#534 3 comments 0 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

Version
  • react-native-swiper v1.5.10
  • react-native v0.47.2
Which OS ?

ios

export default class index extends Component {

  constructor( props){
    super(props);
    this.state = {
      ads:[]
    }
  }

  componentDidMount() {
    this._fetchProducts();
  }

  _fetchProducts = () => {
    const req = new Request('http://XXXXX', {method: 'GET'});

    fetch(req).then((res)=>{
      return res.json();
    }).then((result, done) => {
      if (!done){
         this.setState({ads: result.data.result});
      }
    })
  };

render() {
    return (
      <View style={styles.container}>
        {/*状态栏设置白色*/}
        <StatusBar barStyle="light-content"/>

        <View style={styles.ad}>
          <Swiper showsButtons={false} autoplay={true}>

            {
              this.state.ads.map((ad, index)=>{
                return (
                  <TouchableHighlight key={index} onPress={()=>{}}>
                    <Image style={styles.ad} source={{uri: ad.img}}/>
                  </TouchableHighlight>
                )
              })
            }
          </Swiper>
        </View>

        <View style={styles.content}>

        </View>
      </View>
    );
  }

Automatic scrolling and manual scrolling Appear bug!!!

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

Use the supplied component as the reproduction entry point: run it on iOS with ads loaded through fetch, then compare automatic and manual Swiper scrolling with locally available data. Inspect the network-loaded render path and determine the exact display or scrolling failure; done means both scrolling modes behave normally with the fetched ads.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.