I'm using Titanium Alloy to build an app and I'm trying to create a header bar with buttons in it, similar to the contacts app, as pictured below:
This header has the title in the middle and buttons either site.
I've been looking everywhere for a way to do this in Titanium but I can't find anything yet. It seems that this is not in the documentation, do I need to create something completely custom?
I have tried to add a button inside a navigation view, but it doesn't work - it comes up with an error saying that you the child element of a navigation view has to be a window.
If possible, I'd like to create this using Alloy.
That's pretty easy view to create. The only trick is to wrap Window with NavigationWindow as it was suggested in error you mentioned. NavBar buttons are created and attached in controller. As far as I remember, you can't create them in xml file. However by using $.UI.create() method you make sure that all classes and styles will apply to them, too.
index.html:
<Alloy>
<NavigationWindow>
<Window title="Contacts" id="contacts">
<SearchBar hintText="Search" />
<TableView />
</Window>
</NavigationWindow>
</Alloy>
index.js:
$.contacts.leftNavButton = $.UI.create('Button', { title: 'Groups' });
$.contacts.rightNavButton = $.UI.create('Button', { systemButton: Ti.UI.iPhone.SystemButton.ADD });
$.index.open();
index.tss:
"Window": {
backgroundColor: "white",
layout: "vertical",
},
Related
How can I remove default toolbar and add a custom toolbar as per my requirements and not get the default Save button with Floppy Disk in SimpleForm?
I am able to style the buttons and remove the icons on the toolbar but not able to proceed further as I am new to react-admin.
As mentioned in the documentation : React-Admin Toolbar, you can always override the default layout of the toolbar with toolbar={<CustomToolbarComponent />} props in the SimpleForm component.
As for disabling the toolbar altogether, you can use toolbar={false} in SimpleForm and that would remove it.
You can also let toolbar be false, and maybe add the CustomToolbarComponent inside the SimpleForm component.
Something like :
<SimpleForm toolbar={false}>
<FormComponent1 />
<FormComponent2 />
<CustomToolbarComponent />
</SimpleForm>
As someone who was new to react-admin a few weeks ago too, please read the documentation thouroughly and their code and play with it, you'll come across the solution.
Background Transparency with BLUR
Is it possible to blur view without using background Image? I want to show the parent content on top of the background blur view in modal.
Similar kind of this:
Tried with react-native-blur :
Its actually blurring the background image. I want to blur and show the content which is behind the modal.
Tried along with react-native-overlay : But no change.
well if you are
using expo
then you should go and check out this link here
else if you are like me
who loves to use 'react-native init' and want some blurry effect based views then i have this for you!
https://github.com/voronianski/react-native-effects-view
an awesome library
it would be very simple to use it like
"if the dialogbox is open then render The blur view else render simple",
here is a simple example for basic how to use!
...imports
var EffectsView = require('react-native-effects-view');
var App = React.createClass({
renderVibrant() {
return (
<View>
<Text style={styles.text}>Do you feel blurry??</Text>
</View>
);
},
render() {
return (
<EffectsView
style={styles.view}
blurStyle="dark"
vibrantContent={this.renderVibrant()}
>
<Image style={styles.bg} source={require('image!bg')} />
</EffectsView>
);
}
});
I try to add shoutem to other app but when i work with NaviagtionBar and #shoutem/animation i got issue like picture below here:
this i got when using props style NavigationBar 'inline',
and here is my code:
<NavigationBar
styleName="inline"
animationName="solidify"
title={restaurant.name}
share={{
title: restaurant.name,
link: restaurant.url,
}}
/>
but i dont want like that. I want props style is 'clear' for make tranparent navigationbar when start app, i still want show it when scroll down like this:
but when i change props style of NavigationBar to 'clear' i got this issue(when scroll down, NavigationBar still not show up):
Anyone can help me to resolve it?
I can't t seem to find any complete examples for creating your own navBar component and then wiring it up to react-native-router-flux. Can anyone help me out? Looking at the github issues it seems like this is a big need for the library. What I'm looking to do is:
Create a new component with a left button and an image to the right.
Have the button icon change depending on the scene, but use the same image to the right.
Wire it to react-native-router-flux so that the navBar displays properly and keeps track of the users position in the same way that the default navBar does.
Thanks!
This a similar problem I faced. No tutorials online that tell you how to use custom navbar. I have found a way that works for me. Try this:
<Router navBar = {MainNavBar}>
<Scene key = "home" component = {HomeScreenContainer} title = "Home" initial = {true} />
</Router>
This is the code for main Root component where you define scene. You have to pass the Nav bar component in router or in any scene where you want your navbar.
And your Navbar will be something like this:
<NavigationBar
leftComponent = {<TouchableOpacity><Icon name="sidebar" /></TouchableOpacity>}
centerComponent = {<Title>{props.title}</Title>}
/>
Hope this helps :)
In a Classic Titanium project if i want to create a button i use this code ↓
var btn = Ti.UI.createButton();
How can i do the same for an Alloy project using js?
The question title is different from the description.
To add a widget to Alloy project use this code in the xml file:
<Widget src="widgetName" id="myWidget" />
And to create a button in xml file:
<Button id="btn" class="btn">My Button</Button
To Access the widget or the button from the js file, use the $ that access the controller and then the id you assigned to them:
$.btn.backgroundColor = "red";
$.myWidget.initialize(fooParameter);
If you need to create a button in the js file, use the same code you mentioned and add the created button to the opened window:
var btn = Ti.UI.createButton({ title: 'My Button' });
var win = Ti.UI.createWindow({ backgroundColor: 'white' });
win.add(btn); // If you created the window in the xml file --> $.win.add(btn);
win.open();
Click the next links for Buttons and Widgets documentation.
Titanium docs is best place to find the answer of this, Please refer Ti.UI.Button