How to rotate Fontisto icon in react native - react-native

I Import Fontisto import { Fontisto } from "#expo/vector-icons";
Add an Icon <Fontisto style={styles.windDirectionArrow} name='arrow-up' />
and the styling to rotate it
const styles = StyleSheet.create({
windDirectionArrow: {
fontSize: 40,
transform: [{ rotate: "90deg" }],
},
});
But the transform is not working, does anyone know any other solutions for this?
The view I am rendering looks like this
return (
<View style={styles.container}>
{error ? (
<View style={styles.centeredContainer}>
<Text style={styles.text}>Unable to load weather data</Text>
<Text style={styles.text}>{error}</Text>
</View>
) : isLoading ? (
<View style={styles.centeredContainer}>
<Text style={styles.text}>Loading Weather Data</Text>
<ActivityIndicator
style={styles.activityIndicator}
size='large'
color='rgb(255,179,25)'
/>
</View>
) : (
<View style={[styles.centeredContainer]}>
<Fontisto style={styles.text} name={icon} />
<Text style={styles.text}>{temperature}˚C</Text>
<Text style={styles.text}>
<Fontisto name='arrow-up' style={styles.windDirectionArrow} />
{windSpeed}mph
</Text>
<Text style={styles.text}>{weatherCondition}</Text>
</View>
)}
</View>
);
It works if I have the Icon element wrapped in its own but I think that is not a clean solution
<Text style={styles.text}>
<View>
<Fontisto name='arrow-up' style={styles.windDirectionArrow} />
</View>
{windSpeed}mph
</Text>

It works perfectly for me
// With Rotation
<Fontisto name="arrow-up" style={styles.windDirectionArrow} />
// Without Rotation
<Fontisto name="arrow-up" style={styles.withoutRottion} />
// When icon is wrapped inside a View and that View is rotated
<View style={styles.windDirectionArrow}>
<Fontisto name="arrow-up" style={{ fontSize: 40 }} />
</View>
My Styles :
windDirectionArrow: {
fontSize: 40,
transform: [{ rotate: '90deg' }],
},
withoutRottion: {
fontSize: 40,
},
Working Example
And also why don't you use arrow-right from Fontisto
And for Text Side by side
<View style={{ justifyContent: 'center', alignItems: 'center', flexDirection: 'row' }}>
<View style={styles.windDirectionArrow}>
<Fontisto name="arrow-up" style={{ fontSize: 40 }} />
</View>
<Text style={styles.text}>{windSpeed}mph</Text>
</View>

Related

I want to implement a submit button just like this with a transparent background but since I'm new to RN, I can't quite figure it out

It isn't turning out how I want it to be
Figma Design and the
Coded in React Native
I want it to float and have a transparent background while being stuck to the bottom of the screen like I have shown in the Figma design.
const TicketDetails = () => {
return (
<View style={{backgroundColor:'#D0DEEA', flex:1, position: 'relative'}}>
<ScrollView style={styles.containerMain} showsVerticalScrollIndicator={false}>
<View style={styles.topNavigation}>
<Back/>
<Close/>
</View>
<View style={styles.headingContainer}>
<Text style={styles.heading}>Create New Ticket</Text>
</View>
<View style={styles.formContainer}>
<View style={{flexDirection:'row', justifyContent:'space-between'}}>
<Text style={styles.formHeading}>Enter Ticket Details</Text>
<Filter/>
</View>
<CustomDropdown data={serviceType} text={'Service Type'} placeholderText={'Select Service Type'}/>
<CustomInput2 heading={'Assign Dealer'} placeholder={''}/>
<CustomInput2 heading={'HMR'} placeholder={'Enter HMR Value'}/>
<CustomDropdown data={criticality} text={'Criticality'} placeholderText={'Select Criticality'}/>
<CustomDropdown text={'Customer Concerns'} placeholderText={'Select..'}/>
<CustomInput2 heading={'Expected Date'} placeholder={'31 Dec 2022'}/>
</View>
</ScrollView>
<View style={styles.nextButton}>
<Submit text='Next' style={{position:'absolute'}}/>
</View>
</View>
)
}
const styles = StyleSheet.create({
containerMain:{
marginTop:60,
backgroundColor:'#D0DEEA',
opacity:1,
position:'relative'
},
formContainer:{
flex:0.7,
backgroundColor: 'white',
borderRadius: 35,
marginTop:40,
shadowColor: '#000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.4,
},
nextButton:{
flexDirection: 'column',
flexGrow: 1,
justifyContent: 'space-between',
},
topNavigation:{
marginLeft:13,
marginRight:13,
flexDirection: 'row',
justifyContent: 'space-between'
}
})
It's either there at the scroll end or does not appear to be floating.
example for you:
import React from 'react';
import { Image,View, ScrollView,
Text,TouchableOpacity } from 'react-
native';
const logo = {
uri:
'https://reactnative.dev/img/tiny_logo.png',
width: 64,
height: 64
};
const App = () => (
<View>
<ScrollView>
<Text style={{ fontSize: 96 }}>Scroll me
plz</Text>
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Image source={logo} />
<Text style={{ fontSize: 96 }}>Scrolling
down</Text><Image source={logo} />
<Text style={{ fontSize: 96 }}>What's the
best</Text>
<Text style={{ fontSize: 96 }}>Framework
around?</Text>
<Text style={{ fontSize: 80 }}>React
Native</Text>
</ScrollView>
<TouchableOpacity style={{
position: 'absolute',
width: '90%',
height: 50,
alignItems: 'center',
justifyContent: 'center',
bottom: 30,
left:15,
right:5,
backgroundColor:'#ff00ff',
borderRadius:20
}} >
<Text >text</Text>
</TouchableOpacity>
</View>
);
export default App;
This request is a basic CSS knowledge.
Add position: 'relative' to the styles of the area that should snap under.
Add position: 'absolute' to your button styles. And your wish will come true.
If that doesn't help please share your sample code.
// this card component
<View style={{position: 'relative'}}>
// this button component
<TouchableOpacity style={{position: 'absolute', bottom: 0}}>
<Text>Hello World</Text>
</TouchableOpacity>
</View>
const TicketDetails = () => {
return (
<View style={{backgroundColor:'#D0DEEA', flex:1, position: 'relative'}}>
<ScrollView style={styles.containerMain} showsVerticalScrollIndicator={false}>
<View style={styles.topNavigation}>
<Back/>
<Close/>
</View>
<View style={styles.headingContainer}>
<Text style={styles.heading}>Create New Ticket</Text>
</View>
<View style={styles.formContainer}>
<View style={{flexDirection:'row', justifyContent:'space-between'}}>
<Text style={styles.formHeading}>Enter Ticket Details</Text>
<Filter/>
</View>
<CustomDropdown data={serviceType} text={'Service Type'} placeholderText={'Select Service Type'}/>
<CustomInput2 heading={'Assign Dealer'} placeholder={''}/>
<CustomInput2 heading={'HMR'} placeholder={'Enter HMR Value'}/>
<CustomDropdown data={criticality} text={'Criticality'} placeholderText={'Select Criticality'}/>
<CustomDropdown text={'Customer Concerns'} placeholderText={'Select..'}/>
<CustomInput2 heading={'Expected Date'} placeholder={'31 Dec 2022'}/>
</View>
</ScrollView>
<TouchableOpacity style={{
position: 'absolute',
width: '90%',
height: 50,
alignItems: 'center',
justifyContent: 'center',
bottom: 30,
left:15,
right:5,
backgroundColor:'#ff00ff',
borderRadius:20
}} >
<Text >text</Text>
</TouchableOpacity>
</View>
)
}

Expo App on Android device some onPress() not firing

Several issues are happening here:
Only the delete icon fires onPress()
I've tried different nesting of JSX components to get the update icon to fire with no luck
If it matters, for some reason the 'back' arrow in the StackNavigator on this same page doesn't work either.
This code works perfectly on AVD and IOS simulator
The alpha effect of the TouchableOpacity component isn't being rendered
I've googled extensively, and the only similar problem has to with absolute positioning the TouchableOpacity component, which isn't my case.
I've also tried to onPress = {() Alert('click')} and nothing happened on the Android device.
return (
<View style={styles.container}>
<View style={styles.detailsPanel}>
{/* first row */}
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<AppText size={16} color={STYLES.blue} weight='bold'>
{route.params.item.date}
</AppText>
</View>
<View style={styles.secondColumn}>
<View style={{ flex: 1, flexDirection: "row" }}>
<AppText size={16} color={STYLES.blue} weight='bold'>
{route.params.item.aircraft_type}
</AppText>
<AppText>{" "}</AppText>
<AppText size={16} color={STYLES.blue} weight='bold'>
{route.params.item.registration}
</AppText>
</View>
</View>
<View style={styles.thirdColumn}>
<AppText size={16} color={STYLES.blue} weight='bold'>
{route.params.item.duration}
</AppText>
</View>
</View>
{/* second row */}
<Separator />
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<AppText size={16} color={STYLES.black}>
{route.params.item.route}
</AppText>
</View>
<View style={styles.thirdColumn}>
<AppText size={16} color={STYLES.black}>
{route.params.item.pilot_in_command ? "PIC" : ""}
{route.params.item.second_in_command ? "SIC" : ""}
{route.params.item.solo ? "Solo" : ""}
{route.params.item.dual ? "Dual" : ""}
</AppText>
</View>
</View>
{/* third row */}
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<View style={styles.rowContainer}>
<AppText size={16} color={STYLES.black}>
Landings:
</AppText>
{route.params.item.landings_day ? (
<AppText size={16} color={STYLES.black}>
{" "}
Day {route.params.item.landings_day}
</AppText>
) : null}
{route.params.item.landings_night ? (
<AppText size={16} color={STYLES.black}>
{" "}
Night {route.params.item.landings_night}
</AppText>
) : null}
</View>
</View>
<View style={styles.secondColumn}></View>
<View style={styles.thirdColumn}>
<AppText size={16} color={STYLES.black}>
{route.params.item.instructor ? " CFI" : ""}
</AppText>
</View>
</View>
{/* fourth row */}
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<View style={styles.rowContainer}>
{route.params.item.night ? (
<AppText size={16} color={STYLES.black}>
Night {route.params.item.night}
{" "}
</AppText>
) : null}
{route.params.item.instrument ? (
<AppText size={16} color={STYLES.black}>
Inst {route.params.item.instrument}
{" "}
</AppText>
) : null}
{route.params.item.simulated_instrument ? (
<AppText size={16} color={STYLES.black}>
Hood {route.params.item.simulated_instrument}
{" "}
</AppText>
) : null}
</View>
</View>
<View style={styles.thirdColumn}>
<AppText size={16} color={STYLES.black}>
{route.params.item.cross_country ? "XC" : ""}
{route.params.item.simulator ? " Sim" : ""}
</AppText>
</View>
</View>
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<View style={styles.rowContainer}>
{approaches.map((appr, index) => (
<AppText size={16} color={STYLES.black} key={index}>
{appr.approach_type}-{appr.number}{" "}
</AppText>
))}
</View>
</View>
<View style={styles.thirdColumn}>
{route.params.item.hold ? <AppText size={16}>Hold</AppText> : null}
</View>
</View>
{/* fifth row */}
<View style={styles.rowContainer}>
<View style={styles.firstColumn}>
<AppText>{route.params.item.remarks}</AppText>
</View>
</View>
{/* sixth row */}
<Separator />
<View style={{ flexDirection: "row", marginBottom: 5 }}>
<TouchableOpacity
style={{
flex: 2,
backgroundColor: STYLES.danger,
alignItems: "center",
justifyContent: "center",
}}
onPress={() => {
showAlert(
route.params.item.id,
route.params.item.date,
route.params.item.route
);
}}
>
<View>
<MaterialCommunityIcons
name={"delete"}
size={30}
color={STYLES.white}
/>
</View>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
navigation.navigate("FlightUpdate", {
item: route.params.item,
});
}}
style={{
flex: 2,
backgroundColor: STYLES.blue,
alignItems: "center",
justifyContent: "center",
}}
>
<View>
<MaterialCommunityIcons
name={"update"}
size={30}
color={STYLES.white}
style={{ padding: 5 }}
/>
</View>
</TouchableOpacity>
</View>
</View>
<MapView
style={styles.map}
mapPadding={{
top: 60,
bottom: 10,
right: 40,
left: 40,
}}
ref={mapRef}
>
{markers.map((marker) => (
<Marker
key={marker.key}
coordinate={marker.coordinates}
title={marker.title}
/>
))}
<Polyline
strokeColor={STYLES.blue}
strokeWidth={3}
geodesic={true}
coordinates={polylines}
/>
</MapView>
<ActivityModal visible={Context.activityVisibleValue}></ActivityModal>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: "column",
},
detailsPanel: {
flexDirection: "column",
width: "100%",
margin: 0,
backgroundColor: STYLES.white,
borderRadius: STYLES.borderRadius,
padding: STYLES.borderRadius,
backgroundColor: STYLES.white,
borderRadius: STYLES.borderRadius,
},
rowContainer: {
flexDirection: "row",
paddingBottom: 5,
},
firstColumn: {
flex: 1,
flexDirection: "column",
},
secondColumn: {
flex: 2,
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
},
thirdColumn: {
flex: 1,
flexDirection: "column",
alignItems: "flex-end",
},
text: {
fontFamily: STYLES.font,
color: STYLES.blue,
},
map: {
flex: 1,
width: Dimensions.get("window").width,
height: Dimensions.get("window").height,
borderRadius: STYLES.borderRadius,
},
});```
As you're using Expo and React Navigation, I expected that react-native-gesture-handler package is already installed.
Try to import any touchable component ( TouchableOpacity or TouchableHighlight) from react-native-gesture-handler in place of react-native
import {TouchableOpacity, TouchableHighlight} from "react-native-gesture-handler"
Make sure that your code is not wrapped inside any modal component or Bottom Sheet.
Some of those modals wrapped child components inside another touchable component which blocks touch events to propagate to nested children components.
I had the same issue. I would recommend importing {ScrollView, TouchableOpacity} from react-native, not react-native-gesture-handler; Worked for me; Expo Version 45

ScrollView making View disappear in React Native

I am new to react native, I have a screen that its quite long and when like to use scrollview in order to allow all the important to be viewed by scrolling.
When I add scrollview the information disappears and I don't know why. What is the best way to fix this?
The screen without scrollview
The screen with scrollview
Here is my code.
export default class FindScreen extends React.Component {
render() {
return (
<View style={{height: 200}}>
<Image
style={{width: '100%', height: '100%'}}
source={require('./image.png')}
/>
<ScrollView>
<View>
<Text style={styles.MainText}>Directions</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>Address
{'\n'}
Address
{'\n'}
Address
{'\n'}
Address</Text>
<View>
<Entypo name="location-pin" size={30} color={'#E8AA65'} style={styles.IconImage} />
</View>
</View>
<View>
<Text style={styles.MainText}>Phone</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>+44 0000 000000</Text>
<View>
<Entypo name="phone" size={30} color={'#E8AA65'} style={styles.IconImage2} />
</View>
</View>
</View>
<View>
<Text style={styles.MainText}>Email</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>example#gmail.com</Text>
<Entypo name="mail" size={30} color={'#E8AA65'} style={styles.IconImage3} />
</View>
</View>
</View>
</ScrollView>
</View>
)
}
}
const styles = StyleSheet.create({
MainText: {
paddingLeft: 20,
paddingTop: 40,
fontSize: 16,
color: '#E8AA65'
},
MainView:
{
flexDirection: 'row',
},
IconImage: {
paddingLeft: 160,
paddingTop: 45,
},
IconImage2: {
paddingLeft: 160,
paddingTop: 15
},
IconImage3: {
paddingLeft: 70,
paddingTop: 20
},
AddressText: {
paddingLeft: 20,
paddingTop: 20,
fontSize: 16
}
});
Your first View has only 200 of height... and that's encapsulating all the content.. You probably wanted only on the image so change the first one to flex:1 and create another with the 200 height
export default class FindScreen extends React.Component {
render() {
return (
<View style={{flex: 1}}>
<View style={{height: 200}}>
<Image
style={{width: '100%', height: '100%'}}
source={require('./image.png')}
/>
</View>
<ScrollView>
<View>
<Text style={styles.MainText}>Directions</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>Address
{'\n'}
Address
{'\n'}
Address
{'\n'}
Address</Text>
<View>
<Entypo name="location-pin" size={30} color={'#E8AA65'} style={styles.IconImage} />
</View>
</View>
<View>
<Text style={styles.MainText}>Phone</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>+44 0000 000000</Text>
<View>
<Entypo name="phone" size={30} color={'#E8AA65'} style={styles.IconImage2} />
</View>
</View>
</View>
<View>
<Text style={styles.MainText}>Email</Text>
<View style={styles.MainView}>
<Text style={styles.AddressText}>example#gmail.com</Text>
<Entypo name="mail" size={30} color={'#E8AA65'} style={styles.IconImage3} />
</View>
</View>
</View>
</ScrollView>
</View>
)
}
}
const styles = StyleSheet.create({
MainText: {
paddingLeft: 20,
paddingTop: 40,
fontSize: 16,
color: '#E8AA65'
},
MainView:
{
flexDirection: 'row',
},
IconImage: {
paddingLeft: 160,
paddingTop: 45,
},
IconImage2: {
paddingLeft: 160,
paddingTop: 15
},
IconImage3: {
paddingLeft: 70,
paddingTop: 20
},
AddressText: {
paddingLeft: 20,
paddingTop: 20,
fontSize: 16
}
});

ImageBackground not showing image on some devices

I am trying to use a CustomCallout with a ImageBackground in it. I notice a really strange behavior when testing the application on two different devices (both Android). The image is showed correctly on the older device with lower display, but on the new device (p30 lite) the image is not appearing.. any ideas? here is my code:
class CustomCallout extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.calloutStyle}>
<View>
<View style={{ ...styles.placeRow, ...styles.placeHeader }}>
<ImageBackground
source={{ uri: this.props.image }}
style={styles.bgImage}
>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>
{this.props.placeName}
</Text>
</View>
</ImageBackground>
</View>
<View style={{ ...styles.placeRow, ...styles.placeDetail }}>
<Text>{this.props.distance}m</Text>
<Text>{this.getPlaceType(this.props.placeType)}</Text>
</View>
<View style={{ ...styles.placeRow, ...styles.placeRating }}>
<StarRating
disabled={false}
emptyStar={'ios-star-outline'}
fullStar={'ios-star'}
halfStar={'ios-star-half'}
iconSet={'Ionicons'}
maxStars={7}
rating={4}
fullStarColor={'#FDCC0D'}
starSize={20}
/>
</View>
</View>
</View>
);
}
}
CustomCallout.propTypes = propTypes;
const styles = StyleSheet.create({
calloutStyle: {
height: 200,
width: 280,
backgroundColor: '#61adc8',
shadowOffset: { width: 0, height: 2},
shadowRadius: 6,
shadowOpacity: 0.26,
elevation: 55,
padding: 12,
borderRadius: 20,
shadowColor: 'black',
overflow: 'hidden'
},
bgImage: {
width: '100%',
height: '100%',
justifyContent: 'flex-end',
},
placeRow: {
flexDirection: 'row'
},
placeHeader: {
height: '80%'
},
placeDetail: {
justifyContent: 'space-between',
height: '10%'
},
placeRating: {
height: '10%',
justifyContent:'flex-start',
},
titleContainer: {
backgroundColor: 'rgba(0,0,0,0.5)',
shadowOffset: { width: 0, height: 2},
shadowRadius: 6,
shadowOpacity: 0.26,
elevation: 55,
borderRadius: 10,
alignItems: 'center'
},
title: {
color: 'white',
fontSize: 20
}
});
export default CustomCallout;
We cant put ImageBackground wherever we want.. I don't know the exact theory. But Just put the ImageBackgroung tag outside the view and try to even put on different views too.. If anyone know plz correct me. Here is a working example.
Put ImageBackground to entire component
render() {
return (
<View style={styles.calloutStyle}>
<View>
<ImageBackground
source={{ uri: 'https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg' }}
style={styles.bgImage}
>
<View style={{ ...styles.placeRow, ...styles.placeHeader }}>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>
{this.props.placeName}
</Text>
</View>
</View>
</ImageBackground>
<View style={{ ...styles.placeRow, ...styles.placeDetail }}>
<Text>{this.props.distance}m</Text>
<Text>{this.getPlaceType(this.props.placeType)}</Text>
</View>
<View style={{ ...styles.placeRow, ...styles.placeRating }}>
<StarRating
disabled={false}
emptyStar={'ios-star-outline'}
fullStar={'ios-star'}
halfStar={'ios-star-half'}
iconSet={'Ionicons'}
maxStars={7}
rating={4}
fullStarColor={'#FDCC0D'}
starSize={20}
/>
</View>
</View>
</View>
);
}
}
Or you can put to only both components
render() {
return (
<View style={styles.calloutStyle}>
<View>
<ImageBackground
source={{ uri: 'https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg' }}
style={styles.bgImage}
>
<View style={{ ...styles.placeRow, ...styles.placeHeader }}>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>
{this.props.placeName}
</Text>
</View>
</View>
<View style={{ ...styles.placeRow, ...styles.placeDetail }}>
<Text>{this.props.distance}m</Text>
<Text>{this.getPlaceType(this.props.placeType)}</Text>
</View>
<View style={{ ...styles.placeRow, ...styles.placeRating }}>
<StarRating
disabled={false}
emptyStar={'ios-star-outline'}
fullStar={'ios-star'}
halfStar={'ios-star-half'}
iconSet={'Ionicons'}
maxStars={7}
rating={4}
fullStarColor={'#FDCC0D'}
starSize={20}
/>
</View>
</ImageBackground>
</View>
</View>
);
}
}
or put ImageBackground to inside view only
render() {
return (
<View style={styles.calloutStyle}>
<View>
<ImageBackground
source={{ uri: 'https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg' }}
style={styles.bgImage}
>
<View style={{ ...styles.placeRow, ...styles.placeHeader }}>
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>
{this.props.placeName}
</Text>
</View>
</View>
</ImageBackground>
<View style={{ ...styles.placeRow, ...styles.placeDetail }}>
<Text>{this.props.distance}m</Text>
<Text>{this.getPlaceType(this.props.placeType)}</Text>
</View>
<View style={{ ...styles.placeRow, ...styles.placeRating }}>
<StarRating
disabled={false}
emptyStar={'ios-star-outline'}
fullStar={'ios-star'}
halfStar={'ios-star-half'}
iconSet={'Ionicons'}
maxStars={7}
rating={4}
fullStarColor={'#FDCC0D'}
starSize={20}
/>
</View>
</View>
</View>
);
}
}
Try this out and let me know the result.. :)

KeyboardAvoidingView is not working when using flex - React Native

I have a Registration form with one form header and 3 input fileds.
When I am using KeyboardAvoidingView the deisgn is getting distorted.
My code is below:-
Index.js code:-
const Registration = (props)=>{
return (
<SafeAreaView style={styles.container}>
<Form submitForm={submitForm} />
</SafeAreaView>
)
}
Form.js
const Form = (props)=>{
return (
<View style={{flex:1}}>
<View style={[styles.headerTextContainer]}>
<Text style={styles.headerText}>
Enter details to get started
</Text>
</View>
<KeyboardAvoidingView behavior="height" style={styles.formContainer}>
<View style={{flex:.20,marginBottom:25}}>
<View style={{flex:1.5,}}>
<Text style={styles.labelText}>First Name</Text>
</View>
<View style={{flex:3}}>
<TextInput
value={userinfo.firstName}
onChangeText={(text)=>setFormValue('firstName',text)}
style={styles.input}
/>
</View>
<View style={{flex:1}}>
<Text style={styles.error}>{formError.first_name_error}</Text>
</View>
</View>
</KeyboardAvoidingView>
</View>
)
}
Corresponding css:-
const styles = StyleSheet.create({
headerTextContainer:{
flex:.15,
flexDirection:'column-reverse'
},
headerText:{
color:'#000',
fontSize:23,
textAlign:'center'
},
formContainer:{
flex:.75,
padding:40
},
input:{
height: 50,
borderColor: '#DFE4EB',
borderWidth: 1,
borderRadius:10
},
labelText:{
color:'#BDBDBD',
// marginLeft:12,
marginBottom:10
},
buttonContainer:{
flex:.20,
alignContent:'center',
justifyContent:'center',
paddingLeft: 50,
paddingRight: 50,
}
})
I am very new to react native. I am unable to find the problem in this code.I have tried changing the behaviour, but it does nothing.It will be helpful if any one can guide me about what I am doing wrong
Here are the Images of the screen:-