Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LANDSCAPE View swipebar size issue #87

Closed
asela-wijesinghe opened this issue Dec 22, 2016 · 2 comments
Closed

LANDSCAPE View swipebar size issue #87

asela-wijesinghe opened this issue Dec 22, 2016 · 2 comments

Comments

@asela-wijesinghe
Copy link

@jemise111 This works like a charm but In the props we put the amount of pixels for left or right swipe but after the orientation of device the pixels changed and the sizes should be changed.is their a way to capture this functionality easily without working with orientation change? thanks in advance

@jemise111
Copy link
Owner

Hey @asela-wijesinghe, as a small perf optimization the layout is only calculated once by default. There is a prop you can pass to the SwipeListView called recalculateHiddenLayout={true} which I think should solve your issue. It should look like so:

<SwipeListView
	recalculateHiddenLayout={true}
	dataSource={this.ds.cloneWithRows(this.state.listViewData)}
	renderRow={ data => (
		<TouchableHighlight
			onPress={ _ => console.log('You touched me') }
			style={styles.rowFront}
			underlayColor={'#AAA'}
		>
			<View>
				<Text>I'm {data} in a SwipeListView</Text>
			</View>
		</TouchableHighlight>
	)}
	renderHiddenRow={ (data, secId, rowId, rowMap) => (
		<View style={styles.rowBack}>
			<Text>Left</Text>
			<View style={[styles.backRightBtn, styles.backRightBtnLeft]}>
				<Text style={styles.backTextWhite}>Right</Text>
			</View>
			<TouchableOpacity style={[styles.backRightBtn, styles.backRightBtnRight]} onPress={ _ => this.deleteRow(secId, rowId, rowMap) }>
				<Text style={styles.backTextWhite}>Delete</Text>
			</TouchableOpacity>
		</View>
	)}
	leftOpenValue={75}
	rightOpenValue={-150}
/>

After passing that prop it worked perfectly for me:

http://g.recordit.co/GsZ4vwkmsZ.gif

Let me know if this does the trick for you, thanks!

@asela-wijesinghe
Copy link
Author

@jemise111
It worked Thank You :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants