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.

Does recenter() work with RN 0.49?

See original GitHub issue

I cannot for some reason get the recenter() to fire or do anything.

this.swipeable = null;

const rightButtons = [<TouchableOpacity onPress={() => this.swipeable.recenter()}><Text>Recenter Me</Text></TouchableOpacity>]

<Swipeable onRef={ref => this.swipeable = ref} rightButtons={rightButtons}> ... <Swipeable/>

Any ideas why this would not work? Does onRef actually work with RN0.49? Anyone on RN0.49 that has this Swipeable recenter() working?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:8
  • Comments:10

github_iconTop GitHub Comments

2reactions
Yandamuricommented, Jan 24, 2019

@nsbruce Great!. This example gave idea to solve my problem. Thank you so much.

1reaction
memePushpenducommented, Apr 22, 2018

Yes , recenter not working. How to recenter. can any body help ?

` swipeable = null;

recenter = () => {
    this.swipeable.recenter();
}

render() {
    return (
        (this.props.user.name.toLowerCase().includes(this.props.search) || this.props.user.number.includes(this.props.search)) ?
            <View>
                <Swipeable leftActionActivationDistance={30} leftButtonWidth={30} onLeftActionRelease={() => { console.log('call'); this.recenter() }} rightActionActivationDistance={30} rightButtonWidth={30} onRightActionRelease={() => { console.log('message'); }} onRef={ref => this.swipeable = ref} leftContent={leftContent} rightButtons={rightButtons}>
                    <View style={styles.container}>
                        {
                            (this.props.user.avatar) ?
                                <Image
                                    source={{ uri: this.props.user.avatar }}
                                    style={styles.photo}
                                /> :
                                <Image source={{ uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAA51BMVEX///9Kxsbb9PQqUIP/Tko8w8NBxMQjTIFac5rL7u7Z8/Py+/s9xMTe9fXE6url9vaC1dVsz8+c3d2r4uJUycl709P3/Pzs+PjR7+9fzMy45uaP2dnA6OgAPnmL2Nj/TkYWRX1/ka7/Qj0AUIbq7fL6Tkt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Bp2ifBWxd/s6vMYk3sfRr0XNXJYGmqSBCPuuvq9LWzHTjCpOehiMlyVA1CyJ+DoVOvt2Qx8K6a8OMlKyHrqoRJczcGgdjyRiO9Z37zIxdJcwfw5G+hdJYe2elJB644mlDTsI0QlLCkvGc4n/SQtPmPCVk3b97hylM111bMs9oSEdTsadN4SYJVJsya7wg2Ywa76go3U2xlBnddJeOwTVAFS1WHiytpEhC8VaLH4nuJNfyd17WnITlqX4NLkpZ9pept/OtoaOWrpo7VuqvkqUXx0GeLhcEcewtk5WfWvJjwbvrf4GvDW5k91m3AAAAAElFTkSuQmCC' }} style={styles.photo} />
                        }
                        <Text style={styles.text}>
                            {this.props.user.name}
                        </Text>
                    </View>
                </Swipeable>
                <Seperator />
            </View>
            :
            <View></View>
    );
}

}`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 6 Item Analysis for Educational Achievement Tests (Exams ...
Item 21 The most appropriate score for comparing scores across two or more distributions (e.g., exam scores in math and art classes) is...
Read more >
Experimental and Analytical Study of the XY ... - UB Engineering
experimental work was conducted using a one 1/4-length-scale truss-bridge model (Warn, 2006) supported on XY-FP bearings. The truss-bridge model is a ...
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