Not scrolling down to bottom - react-native

I tried different solutions who had similar problem but none worked for me. My flatlist is not scrolling to the bottom and scroll bar goes out of the screen as i scroll down. In the flat list the item(LoneAlert)components that belong to the same day have a Date separator(Separator)component on top.
As the number of items increase in the list the number of items being pushed down aloso increase.ex: if the list contains 10 items, 1 items is pushed down , if the list has 25 items then 3 items are pushed down.
if I remove the Header Component then it works fine. But i don't know how to fix this. How do i do it?
I tried wrapping the flatList component with a view and giving a flex:1 to the view but it doesn't work.
in App.js, (there is no styling).
return (
<View>
<AlertList allAlert={this.state.alerts}/>
</View>
);
In AlertList.js
_renderItem = ({item, index}) => {
console.log(index);
console.log(item);
// if the alert day is equal to current day or
// alert day is equal to previous day or
// first alert day in the array is equal to current day
// separator bar display none for that alert by passing props showSeparator
if(current_day == item.alert_time.toDate().getDay()
|| index > 0 &&item.alert_time.toDate().getDay() == all_alerts[index -1].alert_time.toDate().getDay()
|| index==0 && item.alert_time.toDate().getDay() == current_day ){
return (
<LoneAlert
alertObject = {item} showSeparator ={false}/>
)
}else{
return(
<LoneAlert
alertObject = {item} showSeparator ={true}/>
)
}
};
checkConnection = () =>{
if (netInfo.isConnected == false || netInfo.isReachable == false ){
return <ConnectionMsg/>
}else{
return(
<View>
<HeaderBar/>
<View style = {{ flex:1 }}>
<FlatList data={props.allAlert}
renderItem = {this._renderItem}
/>
</View>
</View>
);
}
};
return(
<View>
{this.checkConnection()}
</View>
);
};
export default AlertList;
In LoneAlert.js (the items in side flatlist)
return(
<View>
<View>
{this.renderTimeSeparator(props.alertObject.alert_time.toDate(), props.showSeparator)}
</View>
<View style = {styles.wrapper}>
<View style = {styles.alertImageWrapper}>
{this.renderAlertImage(props.alertObject.alert_reason,70,70,'alertImage')}
</View>
<View style = {styles.textWrapper}>
<Text style = {styles.bedNumber}>{props.alertObject.bedNo}</Text>
{this.capitalizeAlertMessage(props.alertObject.alert_reason, styles.alertMessage)}
<Text style = {styles.dateTime}>{this.timeFormatConverter(props.alertObject.alert_time.toDate())}</Text>
</View>
<View style = {styles.dismissalWrapper}>
{this.renderDismissalImage(props.alertObject.dismissal_reason,30,30,styles.dismissalImage)}
{this.renderDismissalText(props.alertObject.dismissal_reason, styles.dismissalText)}
</View>
</View>
</View>
);
};
const styles = StyleSheet.create({
wrapper:{
flexDirection: 'row',
padding: 10,
paddingRight:0,
borderBottomWidth: 1,
borderBottomColor: "#D0D0D0",
backgroundColor: '#E7EAED',
},
alertImageWrapper:{
// backgroundColor: "red",
height:"100%",
width:60,
marginRight: 13,
flexDirection: 'row',
alignItems: 'center'
},
alertImage:{
},
textWrapper:{
// backgroundColor:"green"
paddingLeft: 15
},
bedNumber:{
color:"#434343",
fontFamily:"Arial",
fontWeight:'bold',
fontSize: 24,
},
alertMessage:{
color:"#434343",
fontFamily:"Arial",
fontWeight:'bold',
fontSize: 14,
},
dateTime:{
color:"#434343",
fontFamily:"Arial",
fontSize: 14,
},
dismissalWrapper:{
marginLeft: 'auto',
// backgroundColor:"green",
width:70,
},
dismissalImage:{
marginLeft: 'auto',
marginRight:'auto',
// backgroundColor:"red"
},
dismissalText:{
// backgroundColor:"blue",
textAlign: 'center'
}
});
export default LoneAlert;
In Separator.js
render(){
return(
<View style={styles.Bar}>
<Text style ={styles.dateStyle}>{this.props.date[0]},
{this.props.date[1]} {this.props.date[2]}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
Bar:{
// height: 34,
paddingTop: 5,
paddingLeft: 10,
// backgroundColor: "#7C7C7C",
backgroundColor: '#E7EAED',
fontFamily:"Arial",
fontWeight:'bold',
fontSize: 14,
color:"#FFFFFF",
textAlign: "center",
flexDirection: 'row',
alignItems: 'center'
},
dateStyle:{
// backgroundColor: 'blue',
color:"#9B9B9B",
fontWeight:'bold',
}
});
export default Separator;
In HeaderBar.js
const HeaderBar = (props) => {
return(
<View>
<View style={styles.HeaderBar}>
<Image style = {styles.spIcon} source={require('../../assets/images/smartPeep-icon.png')}/>
<Text style = {styles.alertTitle}>
Alert history
</Text>
</View>
<View style = {styles.FirstSeparator}>
<Text style = {styles.AlertDetailLabel}>Alert Type</Text>
<Text style = {styles.DismissalLabel}>Resolved by</Text>
</View>
</View>
)
};
const styles = StyleSheet.create({
HeaderBar:{
width: "100%",
padding: 7,
backgroundColor:"#E7EAED",
height:58,
flexDirection: 'row',
alignItems: "center"
},
spIcon:{
width: 40,
marginRight: 22,
height: "100%",
// backgroundColor: "green"
},
alertTitle:{
maxWidth:180,
fontFamily:"Arial",
fontWeight:'bold',
fontSize: 18,
// backgroundColor: "blue"
},
FirstSeparator:{
height: 35,
backgroundColor:"#434343",
flexDirection: 'row',
},
AlertDetailLabel:{
// backgroundColor:"red",
fontFamily:"Arial",
fontSize: 14,
color: "white",
textAlignVertical:'center',
paddingLeft: 10
},
DismissalLabel:{
marginLeft: 'auto',
fontFamily:"Arial",
fontSize: 14,
color: "white",
textAlignVertical:'center',
paddingRight: 10
}
});
export default HeaderBar;

OK i was able to fix this by addding flex:1 on View in App.js and then setting the height to 100% of parent View in AlertList.js
App.js
<View style = {{ flex: 1}}>
<AlertList allAlert={this.state.alerts}/>
</View>
AlerList.js
<View style = {{ height:"100%"}}>
<HeaderBar/>
<FlatList data={props.allAlert}
renderItem = {this._renderItem}
/>
</View>

Related

React-Native, space-between and wrap in FlatList

I have implemented what I want with View but not with FlatList, I don't know how to pass some styles to the Flatlist.
FlatList
<FlatList
columnWrapperStyle= {{flexWrap: "wrap"}}
numColumns = {6}
data={vols}
renderItem={({item}) => (
<Text style={styles.box}>{item}</Text>
)}
/>
</View>
View
<View style={styles.itemslist}>
{ vols.map(vol => (
<Text style = {styles.box}>{ vol }</Text>
)) }
</View>
Styles
const styles = StyleSheet.create({
itemslist: {
marginTop: 50,
flexDirection: 'row',
justifyContent: 'space-between',
flexWrap:"wrap",
padding: 10,
},
box: {
marginTop: 20,
fontSize: 20,
backgroundColor: 'skyblue',
padding: 10,
}
});

Flatlist not re-rendering after deleting an item from the state

I'm working on a react native application,
In this application I have an image capturing the view, If the user captures an image it will be stored in the state hook, if something stored it will be displayed in Flatlist.
If we think the user needs to remove an item from the list, that I have provided a delete button. When a user clicks on it the item should be removed from the state and update the Flatlist.
My question is: after removing an item from the state my view is not re-render. I can guarantee that data is successfully removed from the state, but my Flatlist not updating.
My code as follows, please help me to find an answer. Thanks in advance.
below code used to remove the item from the state.
const [selectedFiles, setSelectedFiles] = useState([]);
const removeItemFromArray = (index: number) => {
let imagesArray = selectedFiles;
imagesArray.splice(index, 1);
setSelectedFiles(imagesArray);
}
flatlist
<FlatList
showsHorizontalScrollIndicator={false}
data={selectedFiles}
renderItem={({ item, index }) => {
return (
<ImagePreviewSlider
itemData={item}
viewImage={() => viewImage(index)}
deleteItem={() => removeItemFromArray(index)}
/>
);
}}
/>
---------- complete code --------------
photoUpload.tsx
import React, { useState } from "react";
import {
View,
Text,
StyleSheet,
ScrollView,
Image,
ImageBackground,
TouchableOpacity,
Modal,
FlatList
} from "react-native";
import ImagePicker from 'react-native-image-picker/lib/commonjs';
import ComponentStyles, { FONT_FAMILY, COLORS } from "../../../../constants/Component.styles";
import IconF from 'react-native-vector-icons/FontAwesome';
import ActionButton from "../../../../components/ActionButton";
import ImagePreviewSlider from "../../../../subComponents/ProgressBarWithImage";
import InspectionCheckListItem from './InspectionCheckListRow';
const ImageUpload = props => {
/**
* image capturing and upload tab view
*/
const [modalVisible, setModalVisible] = useState(false);
const [selectedFiles, setSelectedFiles] = useState([]);
/**
* used to open popup dialog / state hook will be updated.
*/
const openModal = () => {
// setModalVisible(true);
props.navigation.navigate('Inspection result');
}
/**
* when user click on previous button this method will be worked.
*/
const previousTab = () => {
props.navigation.navigate('Inspection checkList');
}
/**
* below method used to close the popup dialog.
*/
const colseModal = () => {
setModalVisible(false);
}
/**
* #chooseFile method is a alert dialog / here user can select camera or galery
* #ImagePicker method used to open camera and collect picture / select picture from galery(function)
*/
const chooseFile = () => {
const options = {
title: 'Select an option',
storageOptions: {
skipBackup: true,
path: 'images',
},
};
ImagePicker.showImagePicker(options, (response) => {
// console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else {
// let source = response;
// You can also display the image using data:
let source = {
uri: 'data:image/jpeg;base64,' + response.data
};
setImagesToHooks(source);
}
});
};
/**
*
* #param newImage base64- converted image
*/
const setImagesToHooks = (newImage) => {
// This will update the array. Refer the blog link for more information.
let imagesArray = [...selectedFiles, newImage];
setSelectedFiles(imagesArray);
};
const removeItemFromArray = (index: number) => {
let imagesArray = selectedFiles;
imagesArray.splice(index, 1);
setSelectedFiles(imagesArray);
}
const viewImage = (index: number) => {
console.log("view item : ######## : ");
}
return (
<View style={{ backgroundColor: COLORS.WHITE_BG, flex: 1, borderTopLeftRadius: 30, borderTopRightRadius: 30 }}>
<View style={{ flexDirection: 'row', width: '100%', height: '90%' }}>
<View style={{ width: '50%', height: '100%', padding: "2%" }}>
<TouchableOpacity style={{ width: '100%', height: 300, alignItems: 'center', justifyContent: 'center' }} onPress={chooseFile}>
<ImageBackground style={{ width: '100%', height: 300, alignItems: 'center', justifyContent: 'center' }} resizeMode={'stretch'}
source={require('../../../../assets/images/Rectangle_image_upload.png')} >
<IconF style={{ color: COLORS.ASH_AE }} name="camera" size={80} />
<Text style={{ color: COLORS.ASH_AE }}>Take image or upload from device</Text>
</ImageBackground>
</TouchableOpacity>
</View>
<View style={{ width: '50%', marginTop: 5, }}>
{/* <ProgressBar array={selectedFiles} deleteItem={(value) => deleteItemFromArray(value)}/> */}
<FlatList
showsHorizontalScrollIndicator={false}
data={selectedFiles}
renderItem={({ item, index }) => {
return (
<ImagePreviewSlider
itemData={item}
viewImage={() => viewImage(index)}
deleteItem={() => removeItemFromArray(index)}
/>
);
}}
/>
</View>
</View>
<View style={styles.actionButton}>
<ActionButton
title={'Previous'}
color={COLORS.PINK}
customBtnStyle={{
height: 65,
width: '85%',
}}
onPress={() => previousTab()}
/>
<ActionButton
title={'Next'}
color={COLORS.GREEN_42}
customBtnStyle={{
height: 65,
width: '100%',
}}
onPress={() => openModal()}
/>
</View>
<View>
<Modal
animationType="fade"
transparent={true}
visible={modalVisible} >
<View style={styles.modalContainer}>
<View style={styles.centeredView}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<TouchableOpacity style={{ flex: 0.2 }} onPress={colseModal}>
<Image source={require('../../../../assets/images/ic-close.png')} style={{ height: 20, width: 20, marginRight: 10 }} />
</TouchableOpacity>
</View>
<View style={styles.columnView}>
<Text style={styles.contentTitle}>Inspection of pharmacies</Text>
<Text style={styles.contentSubTitle}>Checklist:</Text>
<View style={styles.rowView}>
<View style={{ flex: 1, alignSelf: 'center' }} >
<Text style={styles.tableText}>Description</Text>
</View>
<View style={{ flex: 1, alignSelf: 'center' }} >
<Text style={styles.tableText}>Validiry</Text>
</View>
<View style={{ flex: 1, alignSelf: 'center' }} >
<Text style={styles.tableText}>Remark</Text>
</View>
</View>
</View>
<View style={{ flex: 2, width: '100%', flexDirection: 'column' }}>
{/* <InspectionCheckListItem array={InspectionList.items} /> */}
</View>
</View>
</View>
</Modal>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
},
modalContainer: {
position: 'absolute',
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(100,100,100, 0.5)',
padding: 20,
},
centeredView: {
position: 'relative',
width: '90%',
height: '90%',
backgroundColor: COLORS.WHITE_FC,
padding: 20,
},
inspectionNumber: {
flex: 1.5,
fontSize: 18,
color: COLORS.BLUE_69,
fontFamily: FONT_FAMILY.BOLD
},
modalTitle: {
flex: 2,
fontSize: 12,
color: COLORS.GREEN_42,
fontFamily: FONT_FAMILY.BOLD
},
contentTitle: {
fontSize: 18,
color: COLORS.BLUE_69,
fontFamily: FONT_FAMILY.REGULAR,
},
contentSubTitle: {
fontSize: 18,
color: COLORS.BLUE_69,
fontFamily: FONT_FAMILY.BOLD,
},
columnView: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'
},
rowView: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
marginTop: '5%'
},
tableText: {
fontSize: 18,
color: COLORS.BLUE_69,
fontFamily: FONT_FAMILY.LIGHT,
justifyContent: 'center',
alignSelf: 'center'
},
actionButton: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'flex-end',
position: 'relative',
bottom: '2%',
left: 0,
}
});
export default ImageUpload;
ProgressBarWithImage.tsx
import React, { Component } from "react";
import {
View,
Text,
StyleSheet,
TouchableOpacity
} from "react-native";
import IconMC from 'react-native-vector-icons/MaterialCommunityIcons';
import { ProgressBar } from '#react-native-community/progress-bar-android';
import { COLORS, FONT_FAMILY } from "../constants/Component.styles";
const ProgressBarWithImage = props => {
return (
<View style={styles.container}>
<View style={{ justifyContent: 'center', alignItems: 'center', backgroundColor: COLORS.PINK, opacity: 0.3, height: 40, width: 40, borderRadius: 100 }}>
<TouchableOpacity onPress={props.viewImage}>
<IconMC style={{ color: COLORS.PINK, opacity: 100 }} name="file-image" size={30} />
</TouchableOpacity>
</View>
<View style={{ marginLeft: 20, }}>
<View style={{ flexDirection: 'row', alignItems: 'center', width: '100%' }}>
<Text style={{ fontSize: 15, color: COLORS.BLUE_2C, fontFamily: FONT_FAMILY.SEMI_BOLD }}>Photo01.PNG</Text>
<View style={{ flex: 1 }} />
<TouchableOpacity onPress={props.deleteItem}>
<IconMC style={{ color: COLORS.ASH_AE, opacity: 100, marginLeft: 60, }} name="close" size={20} />
</TouchableOpacity>
</View>
<Text style={{ fontSize: 15, color: COLORS.ASH_AE, fontFamily: FONT_FAMILY.SEMI_BOLD }}>7.5Mb</Text>
<ProgressBar
styleAttr="Horizontal"
indeterminate={false}
progress={1}
/>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
width: '100%',
marginTop: 20,
},
});
export default ProgressBarWithImage;
Just use extraData prop of flatList to re-render flatList.
Simply add this state
const [refreshFlatlist, setRefreshFlatList] = useState(false);
And on in removeItemFromArray function add the following line
setRefreshFlatList(!refreshFlatlist)
finally, in flatList add this prop
extraData(refreshFlatlist)

Wrapped TouchableNativeFeedback component with View doesn't show anything on screen with flex:1 on both

The style is added to the wrapping view because TouchableNativeFeedback didn't work either. I have tried alignItems, justifyContent, flexGrow and other experimentations but still doesn't behave properly. GridItem style is the one I want to use but nothing shows in the screen; not even misaligned contents or something similar.
const CategoryGridTile = props => {
let TouchableCmp = TouchableOpacity;
if (Platform.OS == 'android' && Platform.Version >= 21) {
TouchableCmp = TouchableNativeFeedback;
}
return (
<View style={styles.gridItem}>
<TouchableCmp
style={{ flex: 1 }}
onPress={props.onSelect}
>
<View style={{ ...styles.container, ...{ backgroundColor: props.color } }}>
<Text style={styles.title} numberOfLines={2}>{props.title}</Text>
</View>
</TouchableCmp>
</View>
);
};
const styles = StyleSheet.create({
gridItem: {
flex: 1,
margin: 15,
height: 150,
borderRadius:10,
overflow:'hidden'
},
container: {
flex: 1,
borderRadius: 10,
shadowColor: 'black',
shadowOpacity: 0.26,
shadowOffset: { width: 0, height: 2 },
shadowRadius: 10,
elevation: 3,
padding: 15,
justifyContent: 'flex-end',
alignItems: 'flex-end'
},
title: {
fontFamily: 'open-sans-bold',
fontSize: 18,
textAlign: 'right'
}
});
can you try this...
TouchableCmp is working
const CategoryGridTile = () => {
let TouchableCmp = TouchableOpacity;
if (Platform.OS == 'android' && Platform.Version >= 21) {
TouchableCmp = TouchableNativeFeedback;
}
return (
<View style={styles.gridItem}>
<TouchableCmp style={{flex: 1}} onPress={() => alert('onpress')}>
<View style={{...styles.container, ...{backgroundColor: 'pink'}}}>
<Text style={styles.title} numberOfLines={2}>
text here
</Text>
</View>
</TouchableCmp>
</View>
);
};
I've removed prop elements to check, you can add later if this works for you

React-native TouchableOpacity button doesn't respect border/border-radius

I have created a generic button which I'd like to have round edges instead of being a square. My button component is as such:
const Button = ({ onPress, children }) => {
const { buttonStyle, textStyle } = styles;
return (
<TouchableOpacity onPress={onPress} style={buttonStyle}>
<Text style={textStyle}>
{children}
</Text>
</TouchableOpacity>
);
};
const styles = {
textStyle: {
alignSelf: 'center',
color: colors.primaryTeal,
fontSize: 16,
fontWeight: '600',
paddingTop: 10,
paddingBottom: 10,
},
buttonStyle: {
flex: 1,
backgroundColor: colors.whiteText,
marginLeft: 5,
marginRight: 5,
borderRadius: 50
}
};
However, it remains to be square and doesn't respond to borderRadius at all.
It's invoked as such:
<Button onPress={this.onButtonPress.bind(this)}>
Log in
</Button>
How do I make it respect borderRadius and get round edges?
The login form in which it appears(Render)
render() {
return (
<Card>
<CardSection>
<Input
placeholder="user#gmail.com"
label="Email"
value={this.state.email}
onChangeText={email => this.setState({ email })}
/>
</CardSection>
<CardSection>
<Input
secureTextEntry
placeholder="password"
label="Password"
value={this.state.password}
onChangeText={password => this.setState({ password })}
/>
</CardSection>
<View style={styles.btnWrapper}>
<CardSection>
{this.state.loading ?
<Spinner size="small" /> :
<Button onPress={this.onButtonPress.bind(this)}>
Log in
</Button>}
</CardSection>
</View>
<Text style={styles.errorTextStyle} disabled={this.state.error !== null}>
{this.state.error}
</Text>
</Card>
CardSection component:
const CardSection = (props) => {
return (
<View style={styles.containerStyle}>
{props.children}
</View>
);
};
const styles = {
containerStyle: {
borderBottomWidth: 1,
padding: 5,
backgroundColor: '#fff',
justifyContent: 'flex-start',
flexDirection: 'row',
borderColor: '#ddd',
position: 'relative'
}
};
Works perfectly fine. Just make sure to use react native's StyleSheet.create to get cached styles.
Maybe your button container view background is white and you're not seeing the rounded corners.
Heres my working snack
Code snippet i used, but refer to the snack as you'll see it live in action.
import React, { Component } from 'react';
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';
const Button = ({ onPress, children }) => {
return (
<TouchableOpacity onPress={onPress} style={styles.buttonStyle}>
<Text style={styles.textStyle}>
{children}
</Text>
</TouchableOpacity>
);
};
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Button>
Log in
</Button>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex:1,
backgroundColor: 'black',
},
textStyle: {
alignSelf: 'center',
color: 'teal',
fontSize: 16,
fontWeight: '600',
paddingTop: 10,
paddingBottom: 10,
},
buttonStyle: {
flex: 1,
backgroundColor: 'white',
marginLeft: 5,
marginRight: 5,
borderRadius: 50
},
});
You have to add style overflow: hidden to TouchableOpacity
Try add attribute borderWidth and borderColor on buttonStyle, like below:
buttonStyle: {
backgroundColor: colors.whiteText,
marginLeft: 5,
marginRight: 5,
borderRadius: 50,
borderWidth: 2,
borderColor: "#3b5998"
}
A complete example:
<TouchableOpacity
onPress={() => handleSubmit()}
disabled={!isValid}
style={{
alignSelf: "center",
marginBottom: 30,
overflow: 'hidden',
borderColor: "#3b5998",
borderWidth: 2,
borderRadius: 100,
}}
>
<View
style={{
flexDirection: "row",
alignSelf: "center",
paddingLeft: 15,
paddingRight: 15,
minHeight: 40,
alignItems: 'center',
}}
>
<Text style={{ fontSize: 20, fontWeight: "bold", color: "#3b5998" }}>
SEND
</Text>
</View>
</TouchableOpacity>
I think you might be looking for the containerStyle prop
<TouchableOpacity containerStyle={ViewStyleProps}>

styling fields with flex not shown

I have a file weatherProject.js :
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
You input {this.state.zip}.
</Text>
<Forecast
main={this.state.forecast.main}
description={this.state.forecast.description}
temp={this.state.forecast.temp}/>
<TextInput
style={styles.input}
returnKeyType='go'
onSubmitEditing={this._handleTextChange} />
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
input: {
fontSize: 20,
borderWidth: 2,
height: 40
}
});
weatherProject require the forecast module var Forecast = require('./Forecast');:
var Forecast = React.createClass({
render: function() {
return (
/*<View>
<Text style={styles.bigText}>
{this.props.main}
</Text>
<Text style={styles.mainText}>
Current conditions: {this.props.description}
</Text>
<Text style={styles.bigText}>
{this.props.temp}°F
</Text>
</View>*/
<View>
<Text style={styles.bigText}>
{this.props.main}
</Text>
<Text>
Current conditions: {this.props.description}
</Text>
<Text>
{this.props.temp}°F
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
bigText: {
flex: 2,
fontSize: 20,
textAlign: 'center',
margin: 10,
color: '#FFFFFF'
},
mainText: {
flex: 1,
fontSize: 16,
textAlign: 'center',
color: '#FFFFFF'
}
})
module.exports = Forecast;
However, after integrating the forecast module, i don' t see the texts and inputs anymore on the android virtual mobile. my guess is that it' s coming from the styling and flexbox as the codes compile fine, if i remove the flex: 1 syntaxes its shows the texts, why according to you the present codes does not show anything on the screen ? ( my avd machine is a Nexus 4 model )
Thanks for your helps