rblalock / core

Titanium / Alloy Boilerplate
Other
75 stars 31 forks source link

viewNavigation Example: Swipe Left/Pinch Closes All Views #11

Closed asleson closed 10 years ago

asleson commented 10 years ago

Hello,

I just pulled the latest and got it running under 3.3GA (it required a few changes, along with a theme).

I installed the Core app using the "viewNavigation" example on my Android device. After opening the app, each time I tap the screen a new child window opens, as expected.

However, when I swipe right or pinch together, it seems that ALL the views close, not just the current view. When I swipe right or pinch together, only the top action bar with the "Core" title remains. Under it is a black view. Not even the "home" view, the white one with the "home" label, remains.

Is this expected behavior? The demo video seems to show that swiping right or pinching closes the current view, and the previous view is displayed.

Is this a bug? Is this an Android-only bug?

Thank you!!!

-Ryan

asleson commented 10 years ago

@rblalock @mcongrove @msdark

I think the problem lies in how the previous screen is animated back in, at least on Android. I haven't tried it on iOS, but I think this is an Android-only bug.

I think I have it fixed, at least as much as I can figure out. Within the navigation.js file, within the this.animateIn method, I updated the following code block:

if(OS_IOS) {
    _controller.getView().left = (_direction === "left") ? -that.parent.size.width : that.parent.size.width;

    //animation.left = 0;  //removed by me
}
animation.left = 0;  //added by me

Note that I commented out the first instance of animation.left = 0; and added the second instance of animation.left = 0; below the end of the if statement.

Both the close method and closeToHome method now appear to work on Android, as far as I can tell.

Devs, does this look correct, and did I miss something? If it is correct, can you please roll it into the master?

Thank you!!

rblalock commented 10 years ago

@mcongrove - This might be a behavior change in 3.3 I'm thinking. Previously if you set left: 0 on Android funky things would happen. Is my memory serving me right?

@asleson I think you're right. Will have to check it out later. If you could issue a pull request I can get it implemented faster.

Thanks!

mcongrove commented 10 years ago

@rblalock Yes, we put the animation inside the iOS block because of issues with off-screen rendering. I thought we hard-coded left: 0 for Android, though... just no animation?

asleson commented 10 years ago

@rblalock

I have never used Git or GitHub before (that is, for actual source code management) so please understand if I hosed something up. I created a pull request as you suggested. I changed two files that I think fixes the Android navigation error:

demo_app/app/lib/navigation.js demo_app/examples/viewNavigation/lib/navigation.js

I hope I created the pull request correctly, and that I fixed the errors without breaking anything else!

rblalock commented 10 years ago

Looks good to me. Just merged in. Thanks so much!