I am forced to use multiline={false} and set the height of TextInput in order to show it like it is a text area. Reason is that multiline={true} doesn't work very well with KeyboardAvoidingView (https://github.com/facebook/react-native/issues/16826).
So here is a simple code:
<TextInput placeholder="Input text here..." style={{height: 200}} multiline={false} />
and the output is: Screenshot
I just want to make it the text align at the top. Works properly with Android though
Set style property textAlignVertical to top on the TextInput
<TextInput ... multiline={true} textAlignVertical: 'top' />
Related
I have a problem on iOS with KeyboardAvoidingView that put the scrollview scrollbar on left or in the middle of the screen. The code is like following
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={{ flex: 1 }}
>
<ScrollView
style={{flex: 1}}
/>
</KeyboardAvoidingView>
I notive that embedding this code inside a SafeAreaView fix the problem (scrollbar on right) but visually I can't use it.
Does anyone encountered that strange behaviour ?
I have one window it's layout is vertical,i have added two child views for that window ,those views height will dynamically change.After adding the views to window,First view is not fit to it's contents some gap is coming.Please help me how to solve this.
below is my code
<Alloy>
<NavigationWindow id="profBidPostNav" platform="ios">
<Window id="profBidPostWin" layout="vertical">
<View id="MainView" height="Ti.UI.SIZE"></View>
<View id="customerServiceMainView" height="Ti.UI.SIZE" top="0%"></View>
</Window>
</NavigationWindow>
Can you add a screenshot to see the problem ?
I see two errors on your code, hieght instead of height and top="0%". If your Window have vertical layout, no need to add top property.
<Window id="profBidPostWin" layout="vertical">
<View id="MainView" height="Ti.UI.SIZE"></View>
<View id="customerServiceMainView" height="Ti.UI.SIZE"></View>
</Window>
I moved from android to Swift. In android we could assign a drawable to the left or right of the text, we could do this in XML.
for example this XML for a textView with picture on the left:
<TextView
android:id="#+id/myTextView"
android:layout_width="match_parent"
android:text="This is test text view and it is showing"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/myImage" />
so the image "myImage.png" will be same as the picture below.
I wonder if there is something similar in swift for ios ?
In Xcode Interface Builder, you can't really do that with one item. The best solution is to create a textView and an imageView, then pin the two together with aligning and margins in auto layout.
I have problems to set the width of my XUL button. I have this code:
<button label="Ok" width="16" maxwidth="16" height="16" maxheight="16"/>
By with that code, the size of my entire window is changed and not only the button.
And when I write that :
<button label="Ok" width="16" height="16"/>
Only the height is changed. Why is that?
XUL uses the flexible box model for positioning. The width and height attributes define the intrinsic size of the element, not the size at which they are displayed. Your button is apparently placed in a vertical box (not necessarily the actual vbox element, rather any element with orient="vertical"). By default, the align attribute of a box is assumed to have the value stretch - so a vertical box will always stretch the elements inside it horizontally:
<vbox>
<!-- this button is stretched horizontally to match the width of its container -->
<button label="Ok" width="16" height="16"/>
</vbox>
You can set the align attribute explicitly to avoid this:
<vbox align="center">
<!-- this button is centered inside its container -->
<button label="Ok" width="16" height="16"/>
</vbox>
I have stackPanel created in design (xmal) which has Auto height and width. Adding list of image controls dynamically in Code on Load to stackPanel. Now it works fine. But when i try to resize the window, though the stack panel gets resized due to auto, but not the image contrl.
How to bind the actualheight of stackpanel dynamically to image control height, (so when ever stakpanl height gets changed ,image control also should get changed !!).
thanks
Use a ViewBox
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Viewbox MaxWidth="500" MaxHeight="500" Name="vb1">
<Image Source="tulip_farm.jpg"/>
</Viewbox>
</StackPanel>
How to: Apply Stretch Properties to the Contents of a Viewbox
Or you could use binding as below:
<StackPanel x:Name="MyStackPanel">
<Image Source="C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg" Stretch="Uniform" Height="{Binding ElementName=MyStackPanel, Path=ActualHeight}"></Image>
</StackPanel>