Giter VIP home page Giter VIP logo

Comments (7)

xclidongbo avatar xclidongbo commented on June 2, 2024 1

貌似解决了. 改了源码.😂

from react-native-drag-sort.

mochixuan avatar mochixuan commented on June 2, 2024

大分类和大分类相互拖动、同一个大分类里小分类相互拖动 应该可以。但是不同大分类内里的小分类拖动不行

from react-native-drag-sort.

xclidongbo avatar xclidongbo commented on June 2, 2024

@mochixuan 这样就行.我试试. AnySizeDragSortableView 有没有和 SectionList的滚动冲突的解决方案? 我看了demo, 只写了DragSortableView的样例.

from react-native-drag-sort.

mochixuan avatar mochixuan commented on June 2, 2024

里面是有滚动适配的,你可以看下里面的代码

from react-native-drag-sort.

xclidongbo avatar xclidongbo commented on June 2, 2024

我看了滚动适配的demo, 是和ScrollView嵌套的. 我用AnySizeDragSortableView里嵌套DragSortableView来实现. 但AnySizeDragSortableView 这个组件没有对外暴露 是否控制它滚动的props.

from react-native-drag-sort.

JonsonHI avatar JonsonHI commented on June 2, 2024

表情解决了。改了源。😂

是否可以放出改了哪里 参考下 有个需求和你差不多

from react-native-drag-sort.

xclidongbo avatar xclidongbo commented on June 2, 2024

AnySizeDragSortableView 中修改源码, 如果是小分类拖动,就让大分类的scrollEnabled为false.

render() {
    const {selectedItem, selectedPosition, scrollEnabled} = this.state
    const {dataSource, keyExtractor, renderItem, movedWrapStyle, scrollEnabled: scroll} = this.props
    const scrollState = scroll === false ? scroll : scrollEnabled
    return (
      <View style={styles.box}>
        {
          selectedPosition && (
            <View style={[movedWrapStyle, { left: selectedPosition.left, top: selectedPosition.top, position: 'absolute', zIndex: 999 }]}>
              {renderItem(selectedItem, null, true)}
            </View>
          )
        }
        <ScrollView
          bounces={false}
          scrollEventThrottle={1}
          scrollIndicatorInsets={this.props.scrollIndicatorInsets}
          ref={(scrollRef)=> {
              if (this.props.onScrollRef) this.props.onScrollRef(scrollRef)
              this.scrollRef = scrollRef
              return this.scrollRef
          }}
          scrollEnabled = {scrollState}
          onScroll={this.onScrollListener}
          style={styles.scroll}>
          {this.props.renderHeaderView ? this.props.renderHeaderView : null} 
          <View style={styles.container}>
            {
              dataSource.map((item, index) => {
                const key = keyExtractor(item, index)
                this.keyToIndexMap.set(key, index)
                return (
                  <View
                    key={key}
                    {...this._panResponder.panHandlers}
                    onLayout={event => this._setLayoutData(key, event)}
                  >
                    {renderItem(item, index, false)}
                  </View>
                )
              })
            }
          </View>
          {this.props.renderBottomView ? this.props.renderBottomView : null}
        </ScrollView>
      </View>
    )
  }

scrollState 是我修改源码的部分.
@JonsonHI

from react-native-drag-sort.

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.