Warning: React.jsx: 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.

Đang mở
#929 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, react, react-native
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu từ component Splash được hiển thị trong issue, đặc biệt là phương thức render của nó cùng các module React Native và module cục bộ được import. Tái hiện cảnh báo trong quá trình khởi động app, sau đó truy vết giá trị được render nào là undefined; hoàn thành khi cảnh báo về kiểu không hợp lệ không còn xuất hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

import React, { Component } from "react";
import {PermissionsAndroid,View,StyleSheet,Animated,Dimensions,AsyncStorage} from "react-native";
import { CommonActions } from '@react-navigation/native';
import { Constants } from '../common';
import utils from "../utils";
import DeviceInfo from 'react-native-device-info';
import { getUniqueId, getManufacturer } from 'react-native-device-info';
const { width } = Dimensions.get('window');

const resetLoginAction = CommonActions.reset({
index: 1,
routes: [
{ name: 'Home' },
],
})
const resetActionApp = CommonActions.reset({
index: 1,
routes: [
{ name: 'SignIn' },
],
})
let uniqueId = DeviceInfo.getUniqueId();
export default class Splash extends Component {
constructor(props) {
super(props);
this.state = {
ready: false,
SlideInLeft: new Animated.Value(0),
slideUpValue: new Animated.Value(0),
fadeValue: new Animated.Value(0),
}
}

async componentDidMount() {
this._start()
setTimeout(() => {
this._retrieveData()
}, 3000);
}
_start = async () => {
return Animated.parallel([
Animated.timing(this.state.SlideInLeft, {
toValue: 1,
duration: 500,
useNativeDriver: true
}),
Animated.timing(this.state.fadeValue, {
toValue: 1,
duration: 500,
useNativeDriver: true
}),
Animated.timing(this.state.slideUpValue, {
toValue: 1,
duration: 500,
useNativeDriver: true
})
]).start();
};

_retrieveData = async () => {
try {
const value = await AsyncStorage.getItem('LoginDetails');
// console.log(value+"data get")
if (value !== null) {
if(JSON.parse(value).is_guest) {
this.props.navigation.dispatch(resetLoginAction);
}
else {
utils.setUserData(value);
this.props.navigation.dispatch(resetLoginAction);
}
} else {
this.props.navigation.dispatch(resetActionApp);
}
} catch (error) {
console.log(error);
// Error retrieving data
}
};

render() {
let { slideUpValue, fadeValue, SlideInLeft } = this.state;
return (

<Animated.Image
source={Constants.Splash_bg}
style={{
transform: [
{
translateY: slideUpValue.interpolate({
inputRange: [0, 1],
outputRange: [-200, 0]
})
}
],
flex: 1,
width: width,
resizeMode: 'contain',
justifyContent: "center"
}}
/>

);

}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#FFF",
alignItems: "center"
},
item: {},
btn: {
backgroundColor: "#480032",
width: 100,
height: 40,
padding: 3,
justifyContent: "center",
borderRadius: 6,
marginTop: 29
},
text: {
fontSize: 20,
color: "#fff",
fontWeight: "bold",
textAlign: "center"
},
item1: {
backgroundColor: "red",
padding: 20,
width: 100,
margin: 10
},

textBtn: {
color: "#f4f4f4",
fontWeight: "bold",
textAlign: "center"
}
});

Ngôn ngữ chính
JavaScript
Star
13.2k
Fork
1.3k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của expo/create-react-native-app

Tất cả issue của expo/create-react-native-app

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.