BikeApp_demoss/src/views/Home/HomeScreen.tsx
2024-11-12 09:34:25 +08:00

43 lines
1.1 KiB
TypeScript

// src/views/HomeScreen.tsx
import React, { useEffect, useState } from 'react';
import { View, Text, StyleSheet, Image, TouchableOpacity } from 'react-native';
import http from '../../utils/http'; // Adjust the path as necessary
import { rpx } from '../../utils/rpx'; // Adjust the path as necessary
import NoDevice from './NoDevice';
import NormaIndex from "./NormaIndex";
const HomeScreen: React.FC = () => {
const [count, setCount] = useState(0);
const [data, setData] = useState(null);
const [pageIndex, setPageIndex] = useState(1);
useEffect(() => {
// 发起 GET 请求
http.get('/app/article/9') // Replace with your API endpoint
.then(response => {
// console.log(response);
// setData(response);
})
.catch(error => {
console.error('请求错误', error);
});
}, []);
return (
<View style={styles.container}>
{pageIndex === 0 && <NormaIndex />}
{pageIndex === 1 && <NoDevice />}
</View>
);
};
const styles = StyleSheet.create({
container: {
width: '100%',
height: '100%',
},
});
export default HomeScreen;