|
|
@ -5,24 +5,31 @@ import { HStack } from '@/components/ui/hstack'; |
|
|
|
import { Text } from '@/components/ui/text'; |
|
|
|
import { Text } from '@/components/ui/text'; |
|
|
|
import { VStack } from '@/components/ui/vstack'; |
|
|
|
import { VStack } from '@/components/ui/vstack'; |
|
|
|
import { useCounterDispatch, useCounterState } from '@/states/ConterProvider'; |
|
|
|
import { useCounterDispatch, useCounterState } from '@/states/ConterProvider'; |
|
|
|
|
|
|
|
import { View } from 'react-native'; |
|
|
|
|
|
|
|
|
|
|
|
export default function IndexPage() { |
|
|
|
export default function IndexPage() { |
|
|
|
const state = useCounterState(); |
|
|
|
const state = useCounterState(); |
|
|
|
const dispatch = useCounterDispatch(); |
|
|
|
const dispatch = useCounterDispatch(); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Box className="flex-1 justify-center"> |
|
|
|
<Box className="flex-1 justify-center items-center"> |
|
|
|
<Center className="p-3 bg-secondary-500 h-1/2 w-1/2"> |
|
|
|
<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> |
|
|
|
<Text className="text-lg font-semibold">Count: {state.count}</Text> |
|
|
|
<HStack className="gap-2"> |
|
|
|
</Center> |
|
|
|
<Button className="w-[250px]" onPress={() => dispatch({ type: 'INCREMENT' })}> |
|
|
|
<HStack className="flex-1 flex-row gap-2 justify-between"> |
|
|
|
|
|
|
|
<Button onPress={() => dispatch({ type: 'INCREMENT' })}> |
|
|
|
<ButtonText>+</ButtonText> |
|
|
|
<ButtonText>+</ButtonText> |
|
|
|
</Button> |
|
|
|
</Button> |
|
|
|
<Button className="w-[150px]" onPress={() => dispatch({ type: 'DECREMENT' })}> |
|
|
|
<Button onPress={() => dispatch({ type: 'DECREMENT' })}> |
|
|
|
<ButtonText>-</ButtonText> |
|
|
|
<ButtonText>-</ButtonText> |
|
|
|
</Button> |
|
|
|
</Button> |
|
|
|
</HStack> |
|
|
|
</HStack> |
|
|
|
</Center> |
|
|
|
<HStack className="flex-row justify-between"> |
|
|
|
|
|
|
|
<Text className="text-red-600">Text1</Text> |
|
|
|
|
|
|
|
<Text className="text-blue-600">Text2</Text> |
|
|
|
|
|
|
|
</HStack> |
|
|
|
|
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|