You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { Box } from '@/components/ui/box';
|
|
|
|
import { Button, ButtonText } from '@/components/ui/button';
|
|
|
|
import { Center } from '@/components/ui/center';
|
|
|
|
import { HStack } from '@/components/ui/hstack';
|
|
|
|
import { Text } from '@/components/ui/text';
|
|
|
|
import { VStack } from '@/components/ui/vstack';
|
|
|
|
import { useCounterDispatch, useCounterState } from '@/states/ConterProvider';
|
|
|
|
import { View } from 'react-native';
|
|
|
|
|
|
|
|
export default function IndexPage() {
|
|
|
|
const state = useCounterState();
|
|
|
|
const dispatch = useCounterDispatch();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Box className="flex-1 justify-center items-center">
|
|
|
|
<Box className="w-64 h-64 border-secondary-600 border rounded-md p-3">
|
|
|
|
<Center>
|
|
|
|
<Text className="text-lg font-semibold">Count: {state.count}</Text>
|
|
|
|
</Center>
|
|
|
|
<HStack className="flex-1 flex-row gap-2 justify-between">
|
|
|
|
<Button onPress={() => dispatch({ type: 'INCREMENT' })}>
|
|
|
|
<ButtonText>+</ButtonText>
|
|
|
|
</Button>
|
|
|
|
<Button onPress={() => dispatch({ type: 'DECREMENT' })}>
|
|
|
|
<ButtonText>-</ButtonText>
|
|
|
|
</Button>
|
|
|
|
</HStack>
|
|
|
|
<HStack className="flex-row justify-between">
|
|
|
|
<Text className="text-red-600">Text1</Text>
|
|
|
|
<Text className="text-blue-600">Text2</Text>
|
|
|
|
</HStack>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|