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

fix:runAfterInteractions leads to wrapperLayout undefined #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

souhaiebtar
Copy link

@souhaiebtar souhaiebtar commented Apr 9, 2019

@deanmcpherson @chetstone @nihgwu
when starting to drag and drop element, an error wrapperLayout undefined is generated,
from 'KittenTeam/react-native-sortable-listview' commit 0264c3db324e3c86dabef63f269aa7d9ad9c7579

from 'KittenTeam/react-native-sortable-listview'  commit `0264c3db324e3c86dabef63f269aa7d9ad9c7579`
InteractionManager.runAfterInteractions(() => {
this.timer = setTimeout(() => this && this.measureWrapper(), 0)
})
if (this.props.runAfterInteractions) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runAfterInteractions is not documented, now I think a prop like that is necessary as seems a lot people are facing the problem, we should provide a switch to turn on/off that
Coulud you add document for the new prop? BTW I think measureAfterInteractions would be better?

Copy link
Author

@souhaiebtar souhaiebtar Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nihgwu, the idea was to replace the function with,

componentDidMount() {
this.timer = setTimeout(() => this && this.measureWrapper(), 5)
}

if we keep InteractionManager.runAfterInteractions(() => {, it will give us an error,
on ios and android,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, I don't know why it throws error now, I don't write react native code for more than two years, I just checked the doc seems nothing changed to InteractionManager
The idea is that if the list is in a modal, the measured layout would be wrong as the view is not in the right place yet, that's why I added InteractionManager.runAfterInteractions to make sure we should only measure when animation finished
So I think we could provide a prop to switch the behavior and we could get rid of InteractionManager.runAfterInteractions by default
BTW, why you changed the timeout from 0 to 5?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is another PR #167 for this

@souhaiebtar
Copy link
Author

the change from 0 to 5 was to fix hovering row position on Android, i will try to fix it in another way, because right now it's doesn't work with presence of runAfterInteractions,

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

Successfully merging this pull request may close these issues.

2 participants