Native base header adding extra height in iPhone x - ios

I'm using the native base for the screen layout in react native. The Header component in the native base is adding an extra height apart from the actual height that I have specified.
My current native base version is 2.13.12.
I'm facing the issue in the iPhone only and for the iPhone x and above models.
Someone please helps me with fixing the issue.
Screenshot of the issue

Use forceInset={{ top: 'never' }} at the main root file to remove the extra padding. for example:
<SafeAreaView style={{flex: 1}} forceInset={{ top: 'never' }}>
<App />
</SafeAreaView>

Related

React Native Bottomsheet how to avoid bottom notch area?

I have a simple page component in react native. The issue is when I try to open the bottom sheet, I cannot avoid the bottom notch area in IOS. Any ways I can get over it?
return (
<SafeAreaView
<KeboardAvoidingView />
<BottomSheet
isOpen={isOpen}
onClosed={onClosed}
childComponent={...}
options={[]}
showTopKnob
rounded
/>
</SafeAreaView>
);
Give some extra padding from bottom for the devices that have bottom notch.
you can specify this by using this library.
react-native-iphone-x-helper
Example
import {isIphoneX} from 'react-native-iphone-x-helper';
const BOTTO_PADDING = isIphoneX() ? 44 : 20;
I hope this will help you out.

iOS Header overlaps layout for Iphone 11

I've got a react native app -> I've currently noticed that the text on my screen overlaps on iphone 10+ devices. How would I create a safearea for the new devices?
I've tried to add a tag to wrap my stack.navigator for the home screen but had no luck so far.
Is this something I would target on my react native or in xcode?
enter image description here
use
import { SafeAreaView } from 'react-native';
to handle safe area I have shown in below code how to handle safe area for iPhone 10 plus device
in below code I have divided the safe area in two-part one is for top safe area and another is the bottom safe area and you place your all component in bottom safe area
render() {
return (
<View style={{flex: 1} >
<SafeAreaView style={{flex: 0}} />
<SafeAreaView style={{flex: 1}}>
//here you can place your component
</SafeAreaView>
</View>
)
}

Correct approach to specific style code for small and big iOS screen in React Native?

Is there an easy way to make a different style (like smaller and bigger buttons etc. ) for small size ios devices and the big ones in React Native? Like here (https://reactnative.dev/docs/platform-specific-code#platform-specific-extensions) when I need different styles for a specific platform iOS and Android in React Native?
Thanks
All is explained in your link.
Two solutions:
One component where you handle the platform
:
import { Platform } from 'react-native';
...
<Button style={Platform.OS === 'ios' ? styles.iosButton: styles.androidButton} />
Two components for each platforms
:
BigButton.ios.js
BigButton.android.js
...
import BigButton from './BigButton';
Importing like this will load the correct component depending of the platform
To adjust depending of the screen size you can use Dimensions
import { Dimensions } from 'react-native';
const windowWidth = Dimensions.get('window').width;
<View style={windowWidth > 1200 ? styles.big_screen : styles.small_screen}>
...
</View>

React Native iOS StatusBar invisible after build?

I have a React Native project I've written using Expo -- when I develop and publish on Expo, the Status Bar up top (the time, wifi etc) is fine, I've never had to be concerned about it -- it's always been there, so I've never had to read-in a separate StatusBar component or anything like that.
But when I 'build' the app to get the IPA file and then deploy on TestFairy, the App's statusbar is completely invisible (not sure if the font is white or it's an overlay or what).
Any ideas? Thanks!
As mentioned in the Expo docs
Expo makes the status bar translucent by default on Android which is consistent with iOS, and more in line with material design.
Therefore using the react-native's StatusBar you can configure it as follows
<ParentWrapper style={{flex: 1}}>
<View style={{ height, backgroundColor }}>
<StatusBar { ...props } />
</View>
// ... Your navigation or the child components
</ParentWrapper>
and the height is Platform.OS === 'ios' ? 20 : StatusBar.currentHeight

TextInput is missing in ScrollView in iOS but not in Android

My TextInput is missing inside ScrollView for iOS. It works fine on android.
Included is the sample app using Playground.
https://rnplay.org/apps/KtTZ2g
You could see that android is showing the TextInput, but the iOS's one does not show it.
These kind of bugs is making me crazy...
When using the TextInput, be sure to provide a height:
<TextInput
style={{flex: 1, color: 'black', height:40}}
editable={false}
defaultValue="+"
underlineColorAndroid='#C8C7CC' />
https://rnplay.org/apps/a6i08w

Resources