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

Set dynamic open values #424

Closed
sadikyalcin opened this issue Feb 28, 2020 · 3 comments
Closed

Set dynamic open values #424

sadikyalcin opened this issue Feb 28, 2020 · 3 comments

Comments

@sadikyalcin
Copy link

Describe the bug
Open values expect a number so we cannot pass a string. Is there anyway we can modify the module to allow a percentage value? This is an issue when a device is rotated. Unless I do a orientation change detection and update the value.

rightOpenValue={-Dimensions.get('window').width / 2} => rightOpenValue={'-50%'}

To Reproduce
Set a fixed number on an open value and rotate the device.

Screenshots
Portrait:

Screenshot 2020-02-28 at 14 14 27

Landscape:
Screenshot 2020-02-28 at 14 14 33

Environment (please complete the following information):

  • OS: Both
  • RNSLV Version: v2.3.0
  • RN Version: 0.61.5
@jemise111
Copy link
Owner

Hey @sadikyalcin unfortunately if you look through the code of SwipeRow.js you'll see that we're doing a good amount of math with the assumption that the rightOpenValue and leftOpenValue are numbers. It would take a significant rewrite to allow for percentage strings, and even then I'm not sure how it would work.

I would ask that you apply the percentage to the window width like you showed above i.e. Dimensions.get('window').width * 0.5.

As for the value not updating on an orientation change, can you try setting the prop recalculateHiddenLayout={true} and give it another go, I think this may fix your issue.

See more here: #87

@sadikyalcin
Copy link
Author

Hey @sadikyalcin unfortunately if you look through the code of SwipeRow.js you'll see that we're doing a good amount of math with the assumption that the rightOpenValue and leftOpenValue are numbers. It would take a significant rewrite to allow for percentage strings, and even then I'm not sure how it would work.

I would ask that you apply the percentage to the window width like you showed above i.e. Dimensions.get('window').width * 0.5.

As for the value not updating on an orientation change, can you try setting the prop recalculateHiddenLayout={true} and give it another go, I think this may fix your issue.

See more here: #87

Hi Jesse, thanks for that, that has solved my problem.

@jemise111
Copy link
Owner

Awesome, glad to hear it

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