how can i change the theme or default background color for ios.. it's conflicting with my background image. I'd like to set it to transparent.. Thanks
First let's understand how scenes in react-native-router-flux works. When you define them in your navigator, like below,
<Scene sceneStyle={{marginTop: 64}} title="Home" key="home" component={Home} />
You simply say that, my content should render below the pre defined navbar. Which can be 54 or 64 depending on your OS. So when you use Router,
<Router navigationBarStyle={{backgroundColor: 'transparent'}}>
and add navigationBarStyle to every Scene you have by introducing that line, you almost forgot what you've done above, setting your Scene to align itself some margin below the navigationBar. Therefore you see nothing (white space) in your simulator.
In order to have what you need, do this where you want your image to appear full screen with navigation controls:
Actions.refresh({
key: 'home',
navigationBarStyle: {backgroundColor: 'transparent'},
sceneStyle: {marginTop: 0},
});
Or you can introduce this settings in your Scene component where you define it.
I tested this solution and it works on iOS, can't tell the same for Android, so please back up your code before making changes. You can further customize it to remove borderBottom line.
Related
With the introduction of Page Sheets in iOS 13, there is a white background in my app that I cannot seem to be able to change (behind the white Page Sheet, and the grey top of the underlying page):
Obviously, for most apps a black background color would look much better.
While for ejected React Native apps, one could use:
https://github.com/johniak/react-native-root-view-background
I'm curious if anyone using managed Expo has figured out a way to deal with this. As I cannot find much complaints about this issue, other than:
https://github.com/expo/expo/issues/1563
There is an simple trick using navigator...
<NavigationContainer>
<Stack.Navigator
screenOptions={{
cardStyle: {
backgroundColor: 'Your_Color_Here'
}
}}
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="Register" component={RegisterScreen} />
</Stack.Navigator>
</NavigationContainer >
You can use cardStyle to change default white backgroundColor to your desire backgroundColor. I hope this answer helps use it works for me.
For anyone out there who's using #react-navigation and looking for a way to change the background color of the root view between tab changes: simply add backgroundColor prop to app.json:
"backgroundColor": "#000000",
Might work in other scenarios as well.
I guess you are using react-navigation 5.x with createNativeStackNavigator and then using presentation:"modal" in your screen options. I could not find a way to set a black background the on the root view with this type of navigator.
Here's what I ended up doing :
create a standard StackNavigator with createStackNavigator, with mode='modal' property.
put all my modals within this navigator at the root of my app with ...TransitionPresets.ModalPresentationIOS in my screen options. This mimics the behavior you are looking for, as createStackNavigator respects the backgroundColor property set in your app.json file for it's root view.
I came up with this solution after finding this Snack (https://snack.expo.io/#satya164/modal-presentation-style-in-react-navigation). This is far from perfect but the best I could do for now using managed Expo. With nesting navigators, I keep using createNativeStackNavigator for push navigators to get nice, native push transitions for anything other than modals.
Since iOS 11, when the UIWebView is full screen, a fake background appears on the status bar with the same color of the UIWebView background.
Anyone knows how to get rid of it?
Even adding the IUWebView to a storyboard and make it full screen will make the status bar background to appear
I've been trying to edit the size and some other properties of the UIWebView and none of them worked, but it's definitely something from the UIWebView.
Also tried to see all the subviews and it's sizes and didn't see anything strange.
Attached a screenshot, see the grey "statusbar", it disappears when scrolling, and doesn't appear if the UIWebView is not over that part of the screen.
I want it as on the second screenshot, only remove the fake background, not the status bar.
This happens because of UIScrollView new behavior to adjust the content inset to include safe area insets like the status bar.
To fix it, just set it to UIScrollViewContentInsetAdjustmentNever
[self.webView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
Since iOS 11 Beta 4 you can add this to your viewport and will also remove the fake statusbar
viewport-fit=cover
To do this entirely in HTML/CSS, viewport-fit=cover in the Viewport meta tag is the correct way to handle this.
But you'll also want to adjust your padding dynamically to handle the differently sized status bar on iPhone X with its notched camera/speaker.
Luckily, Apple exposed some CSS constants for the safe area insets, so you can take advantage of those in your CSS:
i.e., padding-top: constant(safe-area-inset-top);
I wrote a bit more about this scenario and the new features for iOS 11 and iPhone X: https://ayogo.com/blog/ios11-viewport/
Swift version:
webView.scrollView.contentInsetAdjustmentBehavior = .never
I have recently ported my app from 3.1.1 to 3.20.0 and noticed a conflict in the label of the FullScreen control. The controls on my ol.Map look like this:
this.map = new ol.Map({
controls: ol.control.defaults().extend([
new ol.control.FullScreen(),
new ol.control.ScaleLine({minWidth:100, target:$('#scale-line')[0]})
])
When I load my map, this is what the fullScreen control looks like when not yet in full screen and here what it looks like after fullscreen view is enabled.
Even if I try to force ol.control.FullScreen to support a customised label, such as a span containing the icon fa fa-expand, I still get the WEST-EAST overlapping arrows.
Any ideas?
Ok I figured this out. I had left the old ol 3.1.1 css file instead of replacing it with the new ol.css. Once I did it, the Full screen icon changed as expected.
Very lame of me indeed.
I have been trying to center a PickerIOS, but I am probably missing the underlying logic behind a Picker, because I just want its width to be full screen.
I can manage to do that with iPhone 4s / 5s, but when I run it on the iPhone 6, the Picker seems to be on the left, with some space on the right side.
I have been trying to use alignItem:'center' with a wrapper around the picker, but that just makes it disappear. I have also tried alignSelf, but still doesn't work.
I thought that Picker, by default, had its width to full screen or does it adapt according to the length of the elements?
Do I have to place it in a Flexbox in order to get it centered with a full screen width?
mask1: {
height:120,
overflow:'hidden',
justifyContent:'space-around',
marginTop:50
}
I find out that the style of PickerIOSItem cannot change, and only works fine in NavigatorIOS. I review the example of UIExplorer and there is no more style binding to the Item. Maybe it's a bug.
I need to set the background of a window to be transparent programmatically, once the window is already created.
This creates a new window with a transparent background.
Titanium.UI.createWindow({url:location.href,transparentBackground:true}).open()
Background transparency can also be set in the tiapp.xml, but I need to set it after the window is loaded.
I also tried the following
var win = Titanium.UI.getCurrentWindow();
win.backgroundColor = 'transparent';
which does not have any effect...
Is there a way to achieve that?
Perhaps you could create 2 windows with the same components, one transparent and one not. Once you want the transparent background to show close the other window?
or win.setBackgroundColor('transparent');
I pasted your code into a click event and it worked fine for me. All i did was change the url to 'app://index.html' for testing purposes.
$('.button').click(function(){
// test
Titanium.UI.createWindow({url:'app://index.html',transparentBackground:true}).open();
});
Have you opened the web inspector to check for js errors?
If you want the initial window to be transparent, add this
<transparent-background>false</transparent-background>
to
<window />
on the tiapp.xml file.