Giter Club home page Giter Club logo

react-native-smooth-swipe-list's Issues

Crash in release mode.

environment

react-native: 0.50.3
react: 16.0.0
react-native-smooth-swipe-list: 0.13.1

how to reproduce

Import something from react-native-smooth-swipe-list. Build iOS in release mode, and run. App crashes. (Android not tested.)

Works fine in dev mode.

causes

View.propTypes is undefined.

see: facebook/react-native#16542

Programatically opening row doesn't work

What I have:

image
(the row has been opened by swiping)

What I'm trying to achieve:
Open row when pressing the icon on the right of each row (the three vertical dots icon)

My code:

rowData = this.state.commands.map((x, i) => ({
        id: x.id + '',
        rowView: this.getRowView(x, i),
        rightSubView: this.getOptionsButton(x),
        style: styles.row
}))

getRowView(command, i) {
    return (
         <SwipeableCommand command={command} />
    );
}

render() {
     <SwipeList ref={x => this.swipeList = x} rowData={this.rowData} style={styles.listStyle} />
}

SwipeableCommand.js:

export default class SwipeableCommand extends Component {
    open = () => {
        //This doesn't work!
        this.row.open('right');
    }

    render() {
        return (
            <SwipeRow
                ref={x => this.row = x}
                startCloseTimeout={() => { }}
                clearCloseTimeout={() => { }}
            >
                <View style={styles.viewWrap}>
                   ...markup
                </View>
            </SwipeRow >
        )
    }
}

And whenever I press the '...' button the row just becomes frozen (the touchableopacity button doesnt even work anymore). I have looked inside the source code and couldn't figure out how to solve this, but I found out that animateOpenOrClose(toValue, vx, noBounce) { receives an undefined value for the toValue so it's going to try to animate the row towards undefined.

What am I missing/doing incorrectly?

Update to use FlatList

Yo! Are there plans to update this to use react-native's more performant FlatList?
It's faster, you no longer need to manage a dataSource, the api is much simpler!

[Typescript error] Swipelist not showing

i just implement this library, i follow each step, but list is not showing. if i render something else it will render successfully, but swipelist not working. is this because of this error?

screen shot 2018-11-14 at 3 41 51 pm

here is the complete code in case if i missing something:

import React from 'react';
import createReactClass from 'create-react-class';
import { View, Text, StyleSheet } from 'react-native';
import {Icon} from 'native-base';
import SwipeList from 'react-native-smooth-swipe-list';


const RowList = createReactClass({

    componentDidMount() {
      this.rowData = this.props.array.map(this.constructRowData);
    },

  constructRowData(item) {
      return {
          id: item,
          rowView: this.getRowView(item),
          rightSubView: this.getRemoveButton(),
          style: styles.rowFront //optional but recommended to style your rows
      };
  },
      
  getRowView(item) {
      console.log("Item>> ", item)
      return (
        <View style={styles.rowFront}>
            <Text>{`I am  a SwipeListView`}</Text>
        </View>
      );
  },

  getRemoveButton() {
    return(
      <View style={styles.rowBack}>
          <Icon name="close" style={styles.iconClose} type="FontAwesome" />
          <Text style={{ color: '#FFF', fontFamily: 'Gilroy-extrabold', marginLeft: 5}}>Remove</Text>
      </View>
    );
  },

  render() {
    return <SwipeList rowData={this.rowData}  />;
  }

});

const styles = StyleSheet.create({
  rowBack: {
    backgroundColor: "#5E368E",
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection: 'row'
  },
  iconClose: {
    color: '#FFF',
    fontSize: 24,
    fontWeight: 'bold',
  },
  rowFront: {
    borderBottomColor: '#EEE',
    borderBottomWidth: 1,
    paddingHorizontal: 100,
    paddingVertical: 15,
  }
});

export default RowList;
import RowList from './rowList';
class Watch extends Component {
  state = {
    array: [1,2,3,4,5]
  }

  render() {
    const { flexOne } = styles;
    const {array} = this.state;
    return (
      <View style={flexOne}>
          { array && array.length > 0 ? <RowList array={array} /> : <EmptyView title="watch" text="stories" />}
      </View>
    );
  }
}

version:

"react-native-smooth-swipe-list": "^1.4.7"

Right Button Edge Shrinking

Absolutely stunning implementation! I haven't seen anything come close to the quality of this!

I have this weird case where the rowView shrinks when swiping on the rightSubView

Nothing fancy going on here. I made a simple code snippet for testing and attached a gif. The rowView is a black box containing a white box. When swiping the rightSubView you can see the white view inside the rowView shrink.

Any thoughts?

  constructRowData(job) {
    return {
      style: {flex: 1},
      id: job.jobnumber,
      rowView: (
        <View style={{flex: 1, height: 150, backgroundColor: 'black', marginVertical: 8}}>
          <View style={{flex: 1, margin: 8, backgroundColor: 'white'}} />
        </View>
      ),
      rightSubView: <View style={{height: 150, width: 150, backgroundColor: 'red', marginVertical: 8}} />
    }
  }
 
  render() {
    return <SwipeList rowData={this.rowData} style={style.list}/>
  }

edge_shrinking

Remove particular row

I'm having trouble removing a particular row and having that one animate while the others stay put.

What am I doing wrong here?:

swipe-list-demo

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.