Commit 0526817f authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

correctly get color activities response

parent de63baba
......@@ -15,7 +15,7 @@ const Stack = createNativeStackNavigator();
const AppRouter = () => {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Splash">
<Stack.Navigator initialRouteName="Start">
<Stack.Screen
options={{headerShown: false}}
name="Home"
......
......@@ -6,46 +6,42 @@ import { StyleSheet, View, Text, Pressable, SafeAreaView, ScrollView, Image, Ima
import ImageButton from "../component/ImageButton";
import ColorActivity from "../component/colorActivity";
// const {width,height} = Dimensions.get('screen');
const webUrel = "http://192.168.8.101:5000/ru";
const webUrel = "http://192.168.8.101:5000/getColorActivities";
export default function Color(){
const[names,setNames] = useState([]);
const[datas,setData] = useState([]);
const navigation = useNavigation();
function getColorActivities() {
axios
.get(webUrel)
.then((response) => {
setData(response.data);
console.log(response.data);
})
.catch((err) => {
setNotify({
isOpen: true,
message: err.message,
type: "warning",
});
});
}
React.useEffect(() => {
getColorActivities()
const unsubscribe = navigation.addListener("focus", () => {
// The screen is focused
// Call any action
Orientation.unlockAllOrientations();
Orientation.lockToPortrait();
});
// Return the function to unsubscribe from the event so it gets removed on unmount
return unsubscribe;
}, [navigation]);
// function getSMSReport() {
// axios
// .get(webUrel)
// .then((response) => {
// console.log(response.data);
// // setNames(response.data)
// })
// .catch((err) => {
// console.log(err);
// });
// }
// useEffect(() =>{
// getSMSReport();
// })
return (
<SafeAreaView>
......@@ -59,26 +55,6 @@ const[names,setNames] = useState([]);
</ImageBackground>
</View>
</View>
<ColorActivity>
</ColorActivity>
{/* <ColorActivity>
</ColorActivity>
<ColorActivity>
</ColorActivity>
<ColorActivity>
</ColorActivity>
<ColorActivity>
</ColorActivity> */}
</ScrollView>
</SafeAreaView>
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment