I have a problem only with nap drawer module.I have this code:
**drawer = NapDrawerModule.createDrawer({
//parameter for the drawer
});**
Then I have:
*
*drawer.getActivity().onCreateOptionsMenu = function(e) {
//code for creation menu**
}
Problem is that when I started application the method onCreateOptionsMenu() not called so my menu item not show up.When I pressed physical menu button it show up.
I noticed that this is problem only with NapDrawer.I tried make simple TI.UI.createWindow(),add method onCreateOptionsMenu() and it work.
I don't know what is a problem with drawer.I use titanium 5.0 and target android SDK 22.
I found the solution for the problem above.Anyone who has this kind of problem the next solution work for me.You need to add in your nap drawer create method next attribute:hamburgerIcon:true
Related
What is react-native component doing when the component is in background?
And What will react-native do when component re-active to foreground?
Like Page A navigate to Page B.
And Page B back to Page A.What happened to A and B?
Is there any ui update like onResume on Android or something?
Edit:
I have a TabNavagation with four tab.One of the tabs renders an Android UI Component which is a custom frameLayout(a listview is in the frameLayout).
When the frameLayout first rendered, the listview position is not correct(position is -4 item height).But when I navigate to a child page and goback, I found that the frameLayout is correct now and does't enter any android lifecycle.
So I'm wondering is it doing something background?
It is hard to tell without detail information on what type of navigation you are using but I can explain it considering you are using common navigation packages.
If your navigation is some sort of stack navigation, when you navigate/push a new screen to view the previous screen lays under the stack and doesn't un-mount. It is much like dealing a deck of card to a pile. It doesn't re-render unless the props or state of that specific component changes. When you navigate back the new screen un-mounts and the previous screen shows back.
Common packages lets you to pass props to the next screen and if you need to re-render a previous component a easy hack to achieve this by sending a function from the previous component and running it on componentWillUnmount life-cycle event of the current screen. I explained this sort of usage in this answer.
After debug many many times, I found that it is the react-navigation.
Four tabs in homepage with bottom tabbar.When I enter a child page with navigationOptions:{header:null}, the bottom bar is gone. And when I goback from the child page, the bottom bar has back meanwhile and the whole view has corrected.Seems the whole view is re-draw?So I called view.requestLayout() in createViewInstance().So the final result is the view need to requestLayout manual.
UPDATE:
answer top is not totally correct.The final problem is the custom view should measure self in its requestLayout.
I found the answer in https://github.com/facebook/react-native/issues/4990
#Override
public void requestLayout() {
super.requestLayout();
post(measureAndLayout);
}
private final Runnable measureAndLayout = new Runnable() {
#Override
public void run() {
measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
layout(getLeft(), getTop(), getRight(), getBottom());
}
};
And thanks for your answers.#bennygenel #Jouke
Does anyone know how a navigation drawer similar to the one in the Sonos app can be implemented? I have checked both Android and iOS versions of the app and see that the navigation drawer has been implemented in the same way for both platforms.
The two key things that I like and want to implement are:
the slide out drawer is below the navigation bar. When it slides out, the navigation bar is still visible
it appears as if it is the drawer that slides out, rather than the detail view moving to the right. I've noticed that the default master detail page slides out in a different way and it's not what we want.
Have a look at the images below so see I mean.
thanks
Although not technically a good practice, if you put a MasterDetailPage into a NavigationPage, it will slide out like in the above pictures. Here's how you do that:
In the App.cs constructor or your app's OnStart() method:
MainPage = new NavigationPage(new MyMasterDetailPage()) {
Title = "Your Title"
};
Create a new MasterDetailPage called MyMasterDetailPage.
In the constructor, add the following code:
Detail = new HomePage();
Master = new MenuPage()
{
Title = "Menu"
};
You then need to create a ContentPage for both HomePage and MenuPage.
One issue that you will run into if you use this method, is that if you don't call MyMasterDetailPage as the first page upon opening the app, the three horizontal bars on the NavigationBar won't appear, which will make it hard for users to tell there is a drawer. So if you need users to go to a login page or another page before your MasterDetailPage, you may want to find another implementation.
everyone
I am using titanium with alloy, I have two windows which are index.js and main.js.
The window of index.js will be opened when the app run, there is a button in index, main will be opened if someone click the button. Main have another button which is used to close the index.
As you see, I am trying to close index window in main window.
Everything works fine in IOS, but when I test it in Android, I found a strange problem: when I click the button in main.js to close index window, all windows(both of index and main) are closed.
I tried many methods, like use Ti.APP.trigger/Ti.APP.addEventListener and send $.index or a callback function to main.js.
Could anyone help me, thanks.
in index.js use this
$.index.exitOnClose = false
Your solution is to set this property : exitOnClose = false as answered by #genocsb. It's available only on Android.
Actually, this property tells that which window should close the app upon closing the window itself. So, by default, the very first window has the its property exitOnClose = true.
In your case, do something like this:
- index.js
Alloy.Globals.Index = $.index;
Alloy.Globals.Index.open();
// If you will do this and press back button on index screen, then you will land to splash screen.
// Alloy.Globals.Index.exitOnClose = false;
- main.js
$.button.addEventListener('click', function (){
$.main.exitOnClose = true; // setting it to true will cause your app to close from main.xml screen on back button press
Alloy.Globals.Index.exitOnClose = false; // setting it to false here will ensure that you will not land to splash screen if back button is pressed.
Alloy.Globals.Index.close();
Alloy.Globals.Index = null;
});
i 've a NavigationAnimatedView which rendering a ListView with pushed DetailsView.
In the NavigationHeader, on the rightComponent, i have a button and i want to display a view with NavigationCardStack from bottomToTop. How can i combine the two modes of navigation ?
Like the filters button on the F8 app on the home screen.
i don't understand how with a dispatch action (navigatePush ?) on the FiltersButton, i can't switch with a navigationCardStack to display a FilterViews from BottomToTop.
You can provide props to NavigationCard when you render it:
_renderScene(props) {
return (
<NavigationCard
style={NavigationCardStackStyleInterpolator.forVertical(props)}
...
Sorry that part isn't documented very well right now!
I use Durandal 2.0 & Breeze in my SPA.
I have a sidebar menu for my drivers (Chauffeurs) where user can click on submenus (Récents, Disponibles, Indisponibles) for calling my view with different parameters. This will fill a koGrid with data. The data is fetched in the activate call and the binding of the koGrid is done in the compositionComplete.
Everything goes well most of the time. Things goes wrong when I click very quickly on submenus (calling the same view). Example: I click on 'Récents' and immediately (without waiting for the view to display) I click on 'Disponibles'.
I have the following for the activate:
var activate = function (filterParam) {
filter(filterParam);
pagedDataSource.getDataFunction = getData;
pagedDataSource.getPredicatesFunction = getPredicates;
return pagedDataSource.reload();
};
And I have the following code for the compositionComplete:
var compositionComplete = function (view) {
bindEventToList(view, '.kgCellText', gotoDetails);
$('#mySearchGrid').attr('data-bind', 'koGrid: gridOptions');
ko.applyBindings(vm, document.getElementById('mySearchGrid'));
};
When I trace the activity, I noted that if user click quickly on submenus, the activate does not have the time to finish and is called again (for the second click of the user) and the compositionComplete does not execute. Then after that, nothing more happened visually. It seems blocked.
Any idea how can I prevent this problem?
Thanks.
The migration to the latest Durandal version 2.0.1 fixed the problem.