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

Refactored animations to work in iOS and Android. Breaking changes #42

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

thireven
Copy link

@thireven thireven commented Nov 4, 2016

Replaced react-tween-state with native Animated library so that the animations work in both iOS and Android. For this reason, there is one breaking change: the easing property no longer takes a string, but an Easing function.

@thireven thireven changed the title Refacted animations to work in iOS and Android. Breaking changes Refactored animations to work in iOS and Android. Breaking changes Nov 4, 2016
@atlanteh
Copy link

atlanteh commented Nov 5, 2016

Works great for me! Thx!

@atlanteh
Copy link

atlanteh commented Nov 6, 2016

You have a small bug that expanded prop (If the accordion is expanded by default when mounted.) doesn't work..to fix this:

  getInitialState() {
    return {
      is_visible: false, // change false to this.props.expanded
      height: null,
      content_height: 0
    };
  },

@thireven
Copy link
Author

thireven commented Nov 7, 2016

Fixed. Thanks!

@compojoom
Copy link

I'm getting cannot read property 'nativeEvent' of undefined. on line 73

That's when my view get loaded. If I dismiss the error I can interract with the accordion? Any ideas?

I just copied the modified accordion to my installation. Do I need to do anything else?

@thireven
Copy link
Author

@compojoom It could be a race condition. From the documentation for onLayout (which is used to get the dimensions):

Invoked on mount and layout changes with:

{nativeEvent: { layout: {x, y, width, height}}}

This event is fired immediately once the layout has been calculated, but the new layout may not yet be reflected on the screen at the time the event is received, especially if a layout animation is in progress.

I'm wondering if it's possible that something else is slowing it down so much that the onLayout is called before the component is rendered. Could you provide more information like what version of RN you're using, platform, os version, etc?

@naoufal
Copy link
Owner

naoufal commented Nov 15, 2016

Thanks for taking the initiative @thireven! Is this in a good state to be reviewed or are you still addressing bugs?

@thireven
Copy link
Author

I believe it's in a good state to be reviewed. Haven't personally run into any other bugs.

@compojoom
Copy link

I just tried it again and this time it seems to work. Not sure what I've done wrong last time.

@compojoom
Copy link

I was too fast. So upon reloading my js(not jut hot loading) I get the same error as before.

I'm trying this with RN 0.36

@compojoom
Copy link

I'm trying to debug what's wrong but so far without success. It seems that in my case render get's called twice and this calls _getContentHeight twice. The first time the event is undefined, the second time the event is correct. So adding a check if the event is defined solved that for me.

However I have another issue. In my case the content can be dinamic. If the accordion is open, when I add a new item to the content I need to recalculate the height. I can't figure out how to do that with the current modifications.

In the past I was able use willReceiveProps and call _getContentHeight from there, but with your modifications _getContentHeight now expects an event and I can't pass one. Ideas?

@thireven
Copy link
Author

@compojoom I'm not able to reproduce the behavior you're describing with the Accordion example. Could you update the example to replicate your issue and post the code here?

@ciceroneves
Copy link

Any ETA for when this is going to be merged? I really would like to remove the dependency on react-tween-state package

@atlanteh
Copy link

atlanteh commented Jun 6, 2017

This project hasn't been updated in almost a year. it seems abandoned.
You have to options.
You can either fork this project and use your fork or use this PR as a dependency:
"react-native-accordion": "https://github.com/naoufal/react-native-accordion#pull/42"

ChrisHughes and others added 2 commits July 31, 2017 18:15
Fixes for PropTypes and React.createClass deprecation changes in Reac…
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.

6 participants