React Native View Navigate Problemi
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of Register.
React Native böyle bir hata alıyorum yardımcı olabilirmisiniz
Login Sayfası:
import React, { useState } from 'react';
import {
StyleSheet,
Text,
View,
ImageBackground,
TouchableOpacity,
KeyboardAvoidingView,
ScrollView,
} from 'react-native';
// Expo Linear Gradient
import { LinearGradient } from 'expo-linear-gradient';
// React Navigation
import { createStackNavigator } from '@react-navigation/stack';
// Components
import Input from '../../components/Auth/Input';
// Icons
import * as Icon from '../../components/icons';
// Views
import Register from './Register';
function Login({ navigation }) {
const [passwordShow, setPasswordShow] = useState(true);
return (
<KeyboardAvoidingView behavior="padding" style={styles.container}>
<ScrollView contentContainerStyle={{ flex: 1 }} bounces={false}>
<ImageBackground
source={require('../../../assets/posters.png')}
style={{ flex: 1 }}
>
<View style={styles.header}>
<Icon.Logo width={60} height={60} />
<TouchableOpacity
onPress={() => navigation.navigate('Register')}
>
<Text style={{ color: 'white' }}>ÜYE OL ➔</Text>
</TouchableOpacity>
</View>
<LinearGradient
colors={['transparent', 'rgba(39,40,44,1)']}
style={[
StyleSheet.absoluteFillObject,
{ borderRadius: 1 },
]}
/>
</ImageBackground>
<View style={styles.form}>
<Text style={styles.formTitle}>Giriş Yap</Text>
<View style={styles.inputContainer}>
<Input placeholder="E-Posta Adresi" />
<Icon.Mail
width={24}
height={24}
fill={'#DB2424'}
style={{ margin: 10 }}
/>
</View>
<View style={styles.inputContainer}>
<Input
placeholder="Şifre"
secureTextEntry={passwordShow}
/>
<TouchableOpacity
onPress={() => setPasswordShow(!passwordShow)}
>
{passwordShow == true ? (
<Icon.ClosedEye
width={24}
height={24}
stroke={'#DB2424'}
style={{ margin: 10 }}
/>
) : (
<Icon.OpenEye
width={24}
height={24}
stroke={'#DB2424'}
style={{ margin: 10 }}
/>
)}
</TouchableOpacity>
</View>
<TouchableOpacity style={styles.forgotPasswordButton}>
<Text style={{ color: '#a3a3a3' }}>
Şifremi Unuttum?
</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.submitButton}>
<Text style={styles.submitButtonText}>Giriş Yap</Text>
</TouchableOpacity>
</View>
</ScrollView>
</KeyboardAvoidingView>
);
}
const Stack = createStackNavigator();
export default function LoginStack() {
return (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName="Login"
>
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Register" component={Register} />
</Stack.Navigator>
);
}
Register Sayfası:
import React, { useState } from 'react';
import {
StyleSheet,
Text,
View,
ImageBackground,
TouchableOpacity,
KeyboardAvoidingView,
ScrollView,
} from 'react-native';
// Expo Linear Gradient
import { LinearGradient } from 'expo-linear-gradient';
// Components
import Input from '../../components/Auth/Input';
// Icons
import * as Icon from '../../components/icons';
export default function Register({ navigation }) {
const [passwordShow, setPasswordShow] = useState(true);
return (
<KeyboardAvoidingView behavior="padding" style={styles.container}>
<ScrollView contentContainerStyle={{ flex: 1 }} bounces={false}>
<ImageBackground
source={require('../../../assets/posters.png')}
style={{ flex: 1 }}
>
<View style={styles.header}>
<Icon.Logo width={60} height={60} />
<TouchableOpacity
onPress={() => navigation.goBack()}
>
<Text style={{ color: 'white' }}>GİRİŞ YAP ➔</Text>
</TouchableOpacity>
</View>
<LinearGradient
colors={['transparent', 'rgba(39,40,44,1)']}
style={[
StyleSheet.absoluteFillObject,
{ borderRadius: 1 },
]}
/>
</ImageBackground>
<View style={styles.form}>
<Text style={styles.formTitle}>Kayıt Ol</Text>
<View style={styles.inputContainer}>
<Input placeholder="Ad Soyadı" />
<Icon.Profile
width={24}
height={24}
stroke={'#DB2424'}
style={{ margin: 10 }}
/>
</View>
<View style={styles.inputContainer}>
<Input placeholder="E-Posta Adresi" />
<Icon.Mail
width={24}
height={24}
fill={'#DB2424'}
style={{ margin: 10 }}
/>
</View>
<View style={styles.inputContainer}>
<Input
placeholder="Şifre"
secureTextEntry={passwordShow}
/>
<TouchableOpacity
onPress={() => setPasswordShow(!passwordShow)}
>
{passwordShow == true ? (
<Icon.ClosedEye
width={24}
height={24}
stroke={'#DB2424'}
style={{ margin: 10 }}
/>
) : (
<Icon.OpenEye
width={24}
height={24}
stroke={'#DB2424'}
style={{ margin: 10 }}
/>
)}
</TouchableOpacity>
</View>
<TouchableOpacity style={styles.submitButton}>
<Text style={styles.submitButtonText}>Kayıt Ol</Text>
</TouchableOpacity>
</View>
</ScrollView>
</KeyboardAvoidingView>
);
}
Soru hatalı mı? 👎
Eğer sorunun kurallara aykırı olduğunu düşünüyorsanız lütfen bize bildirin!
Cevaplar (1)
hatayi hangi dosyada aldigina bak... error ekraninda yazar