question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SwipeRow dynamic toggle method

See original GitHub issue

Is there any way to call a function to switch (open/close) the SwipeRow by the reference, something like this: this.refs.view.toggle() and the JSX <SwipeRow ref="view" ...

Or is there another way to toggle?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
akhil-gacommented, Feb 20, 2018

@hjJunior get the reference of the <SwipeRow/> you want to close and call the closeRow() function like below

Code

import React, { Component } from 'react';
import { Container, Header, Content, SwipeRow, View, Text, Icon, Button } from 'native-base';
export default class SwipeRowExample extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content scrollEnabled={false}>
          <SwipeRow
            ref={(c) => { this.component = c }}
            leftOpenValue={75}
            rightOpenValue={-75}
            left={
              <Button success onPress={() => alert('Add')}>
                <Icon active name="add" />
              </Button>
            }
            body={
              <View>
                <Text>SwipeRow Body Text</Text>
              </View>
            }
            right={
              <Button danger onPress={() => alert('Delete')}>
                <Icon active name="trash" />
              </Button>
            }
          />
          <Button style={{ margin: 20 }} onPress={() => this.component._root.closeRow()}><Text>Close row</Text></Button>
        </Content>
      </Container>
    );
  }
}

Gif

closerow

Read more comments on GitHub >

github_iconTop Results From Across the Web

A ListView With rows that Swipe Open and Closed - Morioh
The following values can be dynamic by passing them as props on the <SwipeRow> : leftOpenValue; rightOpenValue; stopLeftSwipe; stopRightSwipe ...
Read more >
A ListView with rows that swipe open and closed
The following values can be dynamic by passing them as props on the <SwipeRow> : leftOpenValue; rightOpenValue; stopLeftSwipe ...
Read more >
Dynamically Create Toggle Switch List for Attendance w
Most toggle tutorials statically set a toggle value (see Resources below for useful articles on this method). However, we need a dynamic method...
Read more >
Components - NativeBase
NativeBase Accordion renders with pre-defined icons on toggle of text block, ... openLeftRow, openRightRow, -, Function, Dynamically toggle SwipeRow.
Read more >
using swipeable in react native Code Example - Grepper
... swiperow react native · swiperow react native react-native-swipe-list-view · swipe in raect native · using swipeable in react native · toggle swiper...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found