I am using Grid with a View of fixed height 150 and a Row with the rest of the height
In the view i am showing a text input and in the Row i am showing a Webview
When i touch the input the keyboard opens and if i press the back button the app crashes
If i remove the webview and do the same the app is not crashing
<Grid>
<View style={styles.screenView}>
<ImageBackground
source={size(course.image_url) > 0 ? { uri: course.image_url } : logo}
resizeMode="cover"
style={styles.imageBackground}
>
......
</ImageBackground>
</View>
<View style={styles.screenView}>
<View style={styles.container}>
<TextInput
style={styles.reviewInput}
onChangeText={addReview.bind(props)}
placeholder="Your reviews about the course"
value={review}
multiline={true}
/>
</View>
<LoadingButton
isLoading={isLoading}
isFormDirty={size(review) > 0 ? false : true}
loadingText="Saving"
text="Save Review"
block={true}
color={Color.primaryText}
loaderColor="#FFFFFF"
textColor={styles.lightText}
style={styles.reviewButton}
onPress={saveReview.bind(props)}
/>
</View>
<Row>
<View style={styles.scroller}>
<WebView originWhitelist={['*']} source={{ html: courseDescription }} />
</View>
</Row>
</Grid>
Styles for webview:
scroller: {
flex: 1,
overflow: 'hidden',
},
There is only one Row area in your code. It means the whole thing. You should mark the area separately.
<Grid>
<Row size={9}>
<View>
...
</Row>
<Row size={1}>
<View style={styles.scroller}>
<WebView originWhitelist={['*']} source={{ html: courseDescription }} />
</View>
</Row>
</Grid>
Related
So this is my code :
const imageSource = autoData.imgSource ? autoData.imgSource : autoData.downloadURL;
return (
<View style={styles.main}>
(!imageSource? <ActivityIndicator size="large" /> :
<Image source={imageSource} style={styles.image} />
)
</View>
So basically I want to display that spinner if there is no info bu I get
Invariant Violation: Text strings must be rendered within a <Text> component.
You try braces.
If your image is uri, you should use it as follows:
<Image
source={{
uri: 'https://facebook.github.io/react/logo-og.png',
}}
style={{ width: 400, height: 400 }}
/>
Usage
const imageSource = autoData.imgSource ? autoData.imgSource : autoData.downloadURL;
return (
<View style={styles.main}>
{!imageSource ? (<ActivityIndicator size="large" />) :
(<Image source={{ uri:imageSource }} style={styles.image} />)
}
</View>
I think the issue is related to the image component,
Please try the following,
const imageSource = autoData.imgSource ? autoData.imgSource : autoData.downloadURL;
return (
<View style={styles.main}>
(!imageSource? <ActivityIndicator size="large" /> :
<Image source={uri:imageSource} style={styles.image} />
)
</View>
And this will work only if the 'imageSource' is a uri/url or use directly as above.
I use the KeyboardAvoidingView, to display the input focused, but when the KeyBoard is showing, the scrollView paddingBottom changes and overlaps the Form.
<Container style={styles.container}>
<Content contentContainerStyle={{flex:1}} scrollEnabled={false} enableOnAndroid >{/* styles.content */}
<ScrollView style={{flex: 1}} automaticallyAdjustContentInsets={true} indicatorStyle="white" >
<KeyboardAvoidingView behavior="padding" enabled={Platform.OS === 'android' ? true : false} style={styles.keyboardAvoidingView} keyboardVerticalOffset={60} >
<Form style={{margin:20,marginRight:35}}>
<Input>
{/*... Some Inputs*/}
</Input>
</Form>
</KeyboardAvoidingView>
</ScrollView>
</Content>
</Container>
Image 1:
Image 2:
Image 3:
I want to put Search Input between two View border,but half input hides behind another View.
Click Here To Show Image.
There are two views. One View's backgroundColor is purple and another view's backgroundColor is white.And half Input type is hide behind another view.
<Container>
<Header style={{ backgroundColor: "#635DB7" }}>
<Left>
<Button
transparent
onPress={() => this.props.navigation.navigate("DrawerOpen")}
>
<Icon name="ios-menu" />
</Button>
</Left>
<Right />
</Header>
<View style={{flex:1,zIndex:2}}>
<View style={{height:192,backgroundColor: "#635DB7"}}>
<View style={{position:'absolute',opacity: 1,flex:1,flexDirection:"row",marginTop:160}}>
<Input style={{flexDirection:"row",borderRadius:20,marginLeft:30,marginRight:30,backgroundColor:"#434353", zIndex: 2,opacity: 1}} placeholder="Search" />
</View>
</View>
<View style={{height:448,backgroundColor: "#ffffff",zIndex:1}}>
</View>
</View>
</Container>
Try to put the search bar as a last item in the container, and with absolute position. If that does not work, then you might have hit a bug in RN android, which does not support overflow:
https://github.com/facebook/react-native/issues/6802
https://github.com/facebook/react-native/issues/3198
I am using rn-viewpager
I want a view like this:
but I am getting it like this :
Here is my code:
<IndicatorViewPager
style={{flex:1,width:60}}
onPageSelected={(position) => this.onChangeRound(position)}
>
<View>
<Image style={{marginLeft:40,justifyContent:'center',
resizeMode:'center'}}
source={this.state.firstRound}
/>
</View >
<View>
<Image style={{marginLeft:40,justifyContent:'center',
resizeMode:'center' }}
source={this.state.secondRound}
/>
</View >
<View>
<Image style={{marginLeft:40,justifyContent:'center',
resizeMode:'center' }}
source={this.state.thirdRound}
/>
</View>
<View>
<Image style={{marginLeft:40,justifyContent:'center',
resizeMode:'center' }}
source={this.state.fourthRound}
/>
</View>
<View>
<Image style={{marginLeft:40,justifyContent:'center',
resizeMode:'center' }}
source={this.state.fifthRound}
/>
</View>
</IndicatorViewPager>
Please Ignore the 'SCROLL' text.
I want 2 images at a time in my screen one active and one inactive and on scrolling it should change. Here everything happens properly except (2 images come on one screen)
How can i solve this issue .
keyboard overlapping like this below
Code Here
<View style={styles.container}>
<View style={styles.Subcontainer}>
<ScrollView contentContainerStyle={styles.scrolViewFlex} ref='scrollView' automaticallyAdjustContentInsets={true} showsHorizontalScrollIndicator={true} showsVerticalScrollIndicator={true}>
<View style={styles.logoView}>
<Image source={require('#images/Icon_K.png')} style={styles.imageStyles} />
</View>
<View style={styles.textInputView}>
<ActivityIndicator
animating = {this.state.animating}
color = '#494949'
size = "large"
style = {styles.activityIndicator}
/>
<View style={styles.namesContainer}>
{/*<View style={styles.exploreContainerDirection}> */}
<View style={styles.pincodeContainer}>
<TextInput
underlineColorAndroid="transparent"
autoCapitalize="words"
style={[styles.firstnameTextInput,{borderColor:this.state.backgroundColor,color: this.state.color}]}
placeholder=" First Name"
placeholderTextColor="#494949"
returnKeyType='next'
onChangeText={this.handleChange.bind(this,'FirstName')}
value={this.state.updateAccountValues.FirstName}
onFocus={this.inputFocused.bind(this,'FirstName')}
onSubmitEditing={(event)=>{
this.refs.SecondInput.focus();
}}/>
</View>
<View style={styles.spaceview}/>
<View style={styles.mobileNoContainer}>
<TextInput
underlineColorAndroid="transparent"
autoCapitalize="words"
ref="SecondInput"
style={[styles.lastnametextInput,{borderColor:this.state.backgroundColor,color: this.state.color}]}
placeholder=" Last Name"
placeholderTextColor="#494949"
returnKeyType='next'
onChangeText={this.handleChange.bind(this,'LastName')}
onFocus={this.inputFocused.bind(this,'LastName')}
value={this.state.updateAccountValues.LastName}
onSubmitEditing={(event)=>{
this.refs.ThirdInput.focus();
}}/>
</View>
{/* </View>*/}
</View>
</ScrollView>
</View>
</View>
So this is my Screen short when i enter in textinput keyboard appers some times like this below screen
So, Please check it once and find Our my Issue
I followed this: Set
android:windowSoftInputMode="adjustPan" in MainfestFile.xml file
React-native: How to control what keyboard pushes up