shprink / ionic-native-transitions

[Maintenance only] Native transitions (iOS & Android) for Ionic Framework
https://www.npmjs.com/package/ionic-native-transitions
MIT License
572 stars 112 forks source link

+1 Allow to set fixedPixelsBottom, fixedPixelsTop onfly #61

Open Sangd8 opened 8 years ago

Sangd8 commented 8 years ago

Can you make the options (fixedPixelsBottom, fixedPixelsTop) be changed dynamically onfly? Because there some screens has tab in the top, i dont want the transition include the tab too. Is it able to do this? Something like:

$ionicNativeTransitions.nextViewOptions({
   fixedPixelsBottom: 50,
   fixedPixelsTop: 100
});
$ionicNativeTransitions.stateGo('yourState', {}, {
    "type": "slide",
    "direction": "up", // 'left|right|up|down', default 'left' (which is like 'next')
    "duration": 1500, // in milliseconds (ms), default 400
});

But this adjustment only happen for the next transition like the $ionicHistory.nextViewOptions http://ionicframework.com/docs/api/service/$ionicHistory/

shprink commented 8 years ago

Have you tried using states?

.state('home', {
    url: '/home',
    nativeTransitions: {
        "type": "flip",
        "direction": "up",
        "fixedPixelsBottom": 50,
        "fixedPixelsTop": 100
    }
    templateUrl: "templates/home.html"
})
Sangd8 commented 8 years ago

It not working @shprink

shprink commented 8 years ago

it should, will try that tomorrow.

Sangd8 commented 8 years ago

@shprink It's working. But There 's a problem. I create an app. I set default fixedPixelsTop and fixedPixelsBottom default is 50 Then i create page A, and page B I set fixedPixelsTop page B is 100 in route configuration When i change page from page A to page B, the header will take 100 px and you will see the content of page A before the transition complete

daominhsangvn commented 8 years ago

Hi @shprink . I have add nextViewOptions method, please take a look on this PR, Merge it if you interesting. https://github.com/shprink/ionic-native-transitions/pull/62

shprink commented 8 years ago

I definitely like the idea @daominhsangvn :)

Will check that later but your code looks great, good job.

tskweres commented 8 years ago

@shprink actually after much testing doesn't work, the setDefaultOptions fixedPixelsBottom always overrides everything else.

In default options I have fixedPixelsBottom: 0, and in states code:

.state('home', {
    url: '/home',
    nativeTransitions: {
        "type": "flip",
        "direction": "up",
        "fixedPixelsBottom": 50,
        "fixedPixelsTop": 100
    }
    templateUrl: "templates/home.html"
})

The bottom is always 0

tskweres commented 8 years ago

Correction, if you use native-ui-sref in the HTML, this overrides the app.js settings, and you must specify all of your settings there.

For example if I have fixedPixelsBottom specified in app.js, but not in native-ui-sref, the fixedPixelsBottom will not change.