-
Notifications
You must be signed in to change notification settings - Fork 235
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
base: master
Are you sure you want to change the base?
Conversation
from 'KittenTeam/react-native-sortable-listview' commit `0264c3db324e3c86dabef63f269aa7d9ad9c7579`
InteractionManager.runAfterInteractions(() => { | ||
this.timer = setTimeout(() => this && this.measureWrapper(), 0) | ||
}) | ||
if (this.props.runAfterInteractions) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
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, |
@deanmcpherson @chetstone @nihgwu
when starting to drag and drop element, an error
wrapperLayout undefined
is generated,from 'KittenTeam/react-native-sortable-listview' commit
0264c3db324e3c86dabef63f269aa7d9ad9c7579