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 Detected a division by zero in Animated.divide node #764

Merged
merged 2 commits into from
Oct 25, 2017

Conversation

chaitanya-bhagavan
Copy link
Contributor

On first render width is 0 which is causing Detected a division by zero in Animated.divide node.

On first render width is 0 which is causing Detected a division by zero in Animated.divide node.
@developer239
Copy link

+1 this is a major issue

Copy link

@syzer syzer left a comment

Choose a reason for hiding this comment

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

lgtm

index.js Outdated
@@ -329,7 +329,7 @@ const ScrollableTabView = createReactClass({
_handleLayout(e) {
const { width, } = e.nativeEvent.layout;

if (Math.round(width) !== Math.round(this.state.containerWidth)) {
if (width > 0 && Math.round(width) !== Math.round(this.state.containerWidth)) {
Copy link

@syzer syzer Oct 23, 2017

Choose a reason for hiding this comment

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

Did you consider returning early ?
ex:

 if (!width || Math.round(width) === Math.round(this.state.containerWidth) { 
  return 
}

@chaitanya-bhagavan
Copy link
Contributor Author

@syzer returning early now.

@skv-headless skv-headless merged commit 093579a into ptomasroos:master Oct 25, 2017
@developer239
Copy link

@chaitanya0bhagvan Why did you delete the branch? It still does not work.

@chaitanya-bhagavan chaitanya-bhagavan restored the patch-1 branch December 5, 2017 15:18
@chaitanya-bhagavan
Copy link
Contributor Author

@adamski This is already merged but a new version is not pushed to npm.

@adamski
Copy link

adamski commented Dec 5, 2017

Ok great, I'll use the git url instead, thanks

anchengjian pushed a commit to anchengjian/react-native-scrollable-tab-view that referenced this pull request Sep 29, 2018
Fix Detected a division by zero in Animated.divide node
caglaruba pushed a commit to caglaruba/react-native-scrollable-tab-view that referenced this pull request Aug 22, 2019
Fix Detected a division by zero in Animated.divide node
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.

7 participants