无法找出错误。我如何摆脱它? 参考错误:找不到变量:草坪护理。它没有提供太多细节,我无法调试错误
....
import React from 'react'
import { createStackNavigator, } from 'react-navigation-stack';
import { createAppContainer , createSwitchNavigator} from 'react-navigation';
import ProductScreen from './src/components/productScreen';
import UserDashboard from './src/components/userDashboard';
import LoginScreen from './src/components/loginScreen';
import ForgotPassword from './src/components/forgotPassword';
import SignUpScreen from './src/components/signUp';
import {Provider as AuthProvider} from './src/redux/authContext';
import LawnCareScreen from './src/components/lawnCare';
import CarDetailScreen from './src/components/carDetail';
const switchNavigator = createSwitchNavigator(
{
loginFlow:createStackNavigator({
Login: LoginScreen,
SignUp: SignUpScreen,
Password: ForgotPassword,
}),
Products: ProductScreen,
Dashboard: UserDashboard,
CarDetail: CarDetailScreen,
LawnCare: LawnCareScreen
}
)
const App = createAppContainer(switchNavigator);
export default () => {
return (
<AuthProvider>
<App/>
</AuthProvider>
)
}
我的导航屏幕通过反应导航链接到产品屏幕
....import React, {Component}from 'react';
import { StyleSheet,TouchableOpacity, View ,Text, ScrollView,ImageBackground} from 'react-native';
import {Card} from 'react-native-elements';
import {FontAwesome, Entypo, FontAwesome5, Ionicons} from '@expo/vector-icons';
import Spacer from './spacer';
const ProductScreen = ({navigation}) => {
console.log(navigate)
return (
<ImageBackground source={require('../assets/backgroundColor.jpg')} style={Styles.container}>
<ScrollView>
<Card>
<View style={Styles.spacing}>
<Text style={Styles.title}>Services</Text>
<Spacer/>
<TouchableOpacity onPress={()=>navigation.navigate("CarDetail")}>
<View style={Styles.background}>
<FontAwesome name='car' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Vehicle Detailing</Text>
</View>
</TouchableOpacity>
<Spacer/>
<TouchableOpacity onPress={()=>navigation.navigate("LawnCare")}>
<View style={Styles.background}>
<Entypo name='flower' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Commercial Lawn Care</Text>
</View>
</TouchableOpacity>
<Spacer/>
<TouchableOpacity onPress={()=>Linking.openURL('http://timbumperllc.zohosites.com/')}>
<View style={Styles.background}>
<FontAwesome5 name='pills' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Pharmaceuticals</Text>
</View>
</TouchableOpacity>
<Spacer/>
{/* <TouchableOpacity>
<View style={Styles.background}>
<Entypo name='credit-card' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Credit Repair</Text>
</View>
</TouchableOpacity> */}
<Spacer/>
<TouchableOpacity onPress={()=>Linking.openURL('https://moefitness33.com/')}>
<View style={Styles.background}>
<Ionicons name='md-fitness' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Personal Fitness</Text>
</View>
</TouchableOpacity>
{/* <Spacer/> */}
{/* <TouchableOpacity>
<View style={Styles.background}>
<Entypo name='home' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Brokerage with Saks</Text>
</View>
</TouchableOpacity> */}
<Spacer/>
<TouchableOpacity onPress={()=>Linking.openURL('https://www.catchthesehands-massage.com/')}>
<View style={Styles.background}>
<Entypo name='hand' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Massage with Catch These Hands</Text>
</View>
</TouchableOpacity>
<Spacer/>
{/* <TouchableOpacity>
<View style={Styles.background}>
<FontAwesome name='scissors' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Grooming with New York</Text>
</View>
</TouchableOpacity> */}
{/* <Spacer/> */}
<TouchableOpacity onPress={()=>Linking.openURL('http://yalajets.com/')}>
<View style={Styles.background}>
<Entypo name='aircraft' size={24} style={Styles.icons}/>
<Text style={Styles.name}>Luxury Private Flights with Yala Jets</Text>
</View>
</TouchableOpacity>
</View>
</Card>
</ScrollView>
</ImageBackground>
)
};
const Styles = StyleSheet.create({
container: {
flex:1,
alignItems: 'center',
justifyContent:'center'
},
image1:{
width: 175,
height:175,
marginTop:200
},
background: {
backgroundColor: '#d3d3d3',
height: 80,
borderRadius: 10,
marginHorizontal:19,
borderWidth: 1,
shadowRadius:3,
shadowColor: 'black'
},
name: {
fontSize: 15,
fontStyle: ('new times roman', 'italic'),
alignSelf: 'center'
},
icons:{
paddingLeft:5,
paddingTop: 5
},
title: {
fontSize:15,
fontFamily: 'AvenirNext-Heavy',
alignSelf: 'center',
marginTop: 15,
color: 'red'
}
})
export default ProductScreen;
,产品屏幕链接到草坪护理屏幕。但是导航屏幕无法读取它。
....import React from 'react'
import {View,StyleSheet, ImageBackground, ScrollView,Linking,TouchableOpacity} from 'react-native';
import {Text, Card} from 'react-native-elements';
import Spacer from './spacer';
const lawnCare = ({Children}) => {
return (
<ImageBackground source={require('../assets/landscapeBack.png')} style={styles.container}>
<ScrollView>
<Card containerStyle={{ height: 725,width:325, marginBottom:100 , marginTop:50, borderRadius: 10,backgroundColor: 'rgba(205, 199, 199, .3)'}}
style={styles.boxWithShadow} >
<Text style={styles.title}>Landscaping Services</Text>
<View>
<Text style={styles.paragraph}> ☑️ Landscape Maintenance</Text>
<Spacer/>
<Text style={styles.paragraph}> ☑️ Landscape Installation</Text>
<Spacer/>
<Text style={styles.paragraph}> ☑️ Tree Care</Text>
<Spacer/>
<Text style={styles.title}>We offer a Monthly maintenance Plan</Text>
<Text style={styles.title}>Or a one time project</Text>
</View>
<Spacer/>
<Spacer/>
<Spacer/>
<View style={styles.background}>
<TouchableOpacity onPress={()=>Linking.openURL('mailto:info@luxuryvipsvc.com')}>
<Text style={styles.emailLink}>Email us for a quote</Text>
</TouchableOpacity>
</View>
</Card>
</ScrollView>
</ImageBackground>
)
};
LawnCare.navigationOptions = {
headerShown: false
}
const styles = StyleSheet.create({
spacer: {
margin: 12
},
container: {
flex:1,
alignItems: 'center',
justifyContent:'center'
},
image1:{
width: 175,
height:175,
marginTop:200
},
title: {
fontSize:26,
fontFamily: 'Cochin',
alignSelf: 'center',
marginTop: 15,
color: 'black'
},
emailLink: {
fontSize:20,
fontFamily: 'Cochin',
alignSelf: 'center',
marginTop: 15,
color: 'white'
},
paragraph:{
fontSize:18,
fontFamily: 'Cochin',
alignSelf: 'baseline',
marginTop: 15,
color: 'black'
},
background: {
backgroundColor: 'red',
height: 80,
borderRadius: 10,
marginHorizontal:19,
borderWidth: 1,
shadowRadius:3,
shadowColor: 'black'
}
});
export default lawnCare;