Giter Club home page Giter Club logo

Comments (4)

rilyu avatar rilyu commented on August 18, 2024 2

type = 'carousel' 时使用 Carousel 组件,目前暂时不支持自动按需加载,改动的影响太大了,如需要你可以自行实现,例:

  constructor(props) {
    super(props);
    this.state = {
      activeIndex: 0,
      loads: [true, false, false],
    }
  }

  renderPage() {
    let {loads} = this.state;
    return (
      <View style={{flex: 1}}>
        <SegmentedView
          style={{flex: 1}}
          onChange={index => {
            loads[index] = true;
            this.setState({activeIndex: index, loads});
          }}
        >
          <SegmentedView.Sheet title='0'>
            {loads[0] ? <YourPage0 /> : <View />}
          </SegmentedView.Sheet>
          <SegmentedView.Sheet title='1'>
            {loads[1] ? <YourPage0 /> : <View />}
          </SegmentedView.Sheet>
          <SegmentedView.Sheet title='2'>
            {loads[2] ? <YourPage0 /> : <View />}
          </SegmentedView.Sheet>
        </SegmentedView>
      </View>
    );
  }

from teaset.

rilyu avatar rilyu commented on August 18, 2024

1 type = 'projector' 时,首次切换到该页面时加载;type = 'carousel' 时,一次加载全部页面
2 如果你需要滚动事件,SegmentedView 使用 Carousel 组件实现滚动页面,Carousel 支持 ScrollView 的所有属性与事件,你可以参照 SegmentedView 或 SegmentedBarExample 自行实现 SegmentedView 同样的功能,可以自行监听 Carousel.onScroll 事件,代码也比较简单

from teaset.

CodeRabbitYu avatar CodeRabbitYu commented on August 18, 2024

不能按需 加载吗? 一次性加载,对性能影响太高了... 如果要是做新闻那种效果. 那一次性加载十几个会崩溃的

from teaset.

CodeRabbitYu avatar CodeRabbitYu commented on August 18, 2024

好的 。谢谢啦。

from teaset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.