I want make full screen modal with translucent StatusBar
So, I made Modal with StatusBar.
it work well on ios simulator. but It is just below StatusBar on android, Not full screen
This is my code
<Modal>
<View>
<StatusBar
barStyle="dark-content"
translucent
backgroundColor="transparent"/>
<SomeComponent
...
/>
</View>
</Modal>
How can I fix this?
Related
I am using bare react-native CLI.
My modal has a text input field inside. In the modal, when I open the keyboard, the buttons next to the text input are not working. They close the keyboard when tapped instead of working.
I tried it using the native modal module (with KeyboardAvoidingView) and using the react-native-modal
Image
// with react-native-modal
<View style={styles.PostCommentArea}>
<View style={styles.PostBody}>
<Image
source={{ uri: UserDetails.profile_image }}
style={styles.UserImg}
/>
<InputField
ref={InputRef}
style={styles.InputField}
length={0.65}
hv={0.055}
placeholder="Add Comment..."
onSubmitEditing={postComment}
/>
<TouchableHighlight style={styles.PostBtn} onPress={postComment}>
{PostingComment ? (
<>
<Indicator size="small" color={Colors.WHITE} />
</>
) : (
<IconOutline
name="arrow-up"
size={height * 0.027}
color={Colors.WHITE}
/>
)}
</TouchableHighlight>
</View>
</View>
One way of fixing this is wrapping the component in a ScrollView and using the keyboardShouldPersistTaps prop.
'never' tapping outside of the focused text input when the keyboard is
up dismisses the keyboard. When this happens, children won't receive
the tap.
'always', the keyboard will not dismiss automatically, and
the scroll view will not catch taps, but children of the scroll view
can catch taps.
'handled', the keyboard will not dismiss automatically
when the tap was handled by children of the scroll view (or captured
by an ancestor).
<ScrollView keyboardShouldPersistTaps={'handled'}>
...
</ScrollView>
I'm using react native animatable to add animation to my app screens.
I've added bottom tab navigation and i want to make animation each time i click the tab icon to open the screen.
My problem is that the animation is launched only one time
<View style={styles.container}>
<Animatable.View animation="fadeInUpBig" duraton="1500">
<Text> Accueil </Text>
</Animatable.View>
</View>
enter code hereI want to show a toast when my modal is visible in my react native project.
I use react-native-modal.
I have a button in modal when i press it should show up a toast
I don't want to put my toast tag inside the modal tag
what should i do???
render(){
return(
<>
<Modal visible={this.state.visible}>
<Toast
ref="toast"
style={{backgroundColor:'red'}}
position='bottom'
positionValue={100}
fadeInDuration={1000}
fadeOutDuration={1000}
opacity={0.8}
textStyle={{color:'blue'}}
/>
<SafeAreaView style={{flex:1}}>
<View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
<TouchableOpacity onPress={()=>this.refs.toast.show('hello world!')} style={{height:200,width:100,justifyContent:'center',alignItems:'center',backgroundColor:'blue'}}>
<Text>Modal Button</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</Modal>
<SafeAreaView style={{flex:1}}>
<View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
<TouchableOpacity onPress={()=>{this.setState({visible:true})}} style={{height:100,width:100,justifyContent:'center',alignItems:'center',backgroundColor:'red'}}>
<Text>button</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</>
)
}
Actually i wanna be my toast out of my Modal tag but it show in top of screen when modal is visible
react native modal is a native view, so impossible to be covered by a js component.
I'm currently developing an app using react native and I'm using react-navigation to navigate between screens, using buttons in my header (back arrow for example).
It's working well, however even if my icon is the right size it seems like the click area is really narrow and I struggle with it.
Do you know how I could define a click zone on my button for it to be clicked easier? I've tried the hitslop prop but it's not working for me (maybe it's been deprecated?).
Here is my button:
var backArrow =
<TouchableOpacity onPress={() => this.props.navigation.goBack()}>
<Ionicons name="ios-arrow-back" size={22} color="#ff8c00" />
</TouchableOpacity>
I'm using Expo and testing on an iPhone 6s Plus.
Wrapping the Ionicons in a TouchableOpacity will only provide a clickable area as large as the Ionicons component. You can increase the size of the clickable area with the following structure:
<TouchableOpacity>
<View>
<Ionicons />
</View>
</TouchableOpacity>
by styling the View to be as large as you require it.
We need to implement pull to refresh functionality on scrollview in react native app with custom spinner. We have achieved this in iOS by using react native customControl. On iOS, ScrollView is scrolling and we are able to see the spinner on top, when we pull scroll view.
But the same code for android does not work. Because, In android the ScrollView is not scrolling when i pull the scrollview (May be the content is less than the screen height). The spinner will be visible only when we scroll the view. In this case, how to implement/achieve this functionality in android?
<View style={styles.containerStyle}>
<View style={styles.spinner}>
<Spinner />
</View>
<ScrollView
style={styles.scrollview}
contentContainerStyle={styles.contentContainer}
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh}
tintColor='transparent'
colors={[ 'transparent' ]}
style={backgroundColor : 'transparent'}
/>
} >
</ScrollView>
</View>