feat: 添加键盘滚动视图支持,优化确认模态框布局;移除调试日志;更新生成记录加载逻辑
This commit is contained in:
parent
8e313705c5
commit
e720969d2e
|
|
@ -1,5 +1,6 @@
|
||||||
import { Ionicons } from '@expo/vector-icons'
|
import { Ionicons } from '@expo/vector-icons'
|
||||||
import React, { type ReactNode } from 'react'
|
import React, { type ReactNode } from 'react'
|
||||||
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'
|
||||||
|
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import Text from './Text'
|
import Text from './Text'
|
||||||
|
|
@ -49,6 +50,7 @@ const ConfirmModal: React.FC<ConfirmModalProps> = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<KeyboardAwareScrollView bottomOffset={100}>
|
||||||
<Block className="fixed inset-0 z-[60] items-center justify-center p-[24px]">
|
<Block className="fixed inset-0 z-[60] items-center justify-center p-[24px]">
|
||||||
<Block className="relative w-full max-w-[320px] -skew-x-3 border-4 border-black bg-white p-[24px] shadow-[10px_10px_0px_#e61e25]">
|
<Block className="relative w-full max-w-[320px] -skew-x-3 border-4 border-black bg-white p-[24px] shadow-[10px_10px_0px_#e61e25]">
|
||||||
<Block className="absolute left-[-12px] top-[-12px] skew-x-3 border-[3px] border-black bg-accent px-[8px] py-[4px] shadow-[2px_2px_0px_rgba(0,0,0,0.2)]">
|
<Block className="absolute left-[-12px] top-[-12px] skew-x-3 border-[3px] border-black bg-accent px-[8px] py-[4px] shadow-[2px_2px_0px_rgba(0,0,0,0.2)]">
|
||||||
|
|
@ -84,15 +86,14 @@ const ConfirmModal: React.FC<ConfirmModalProps> = ({
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Text className="text-black">{confirmText}</Text>
|
<Text className="text-black">{confirmText}</Text>
|
||||||
{title==='确认支付?' && (
|
{title === '确认支付?' && <Ionicons color="#000" name="flash" size={16} style={{ marginLeft: 4 }} />}
|
||||||
<Ionicons color="#000" name="flash" size={16} style={{ marginLeft: 4 }} />
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Block>
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
|
</KeyboardAwareScrollView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ export default observer(function TabTwoScreen() {
|
||||||
|
|
||||||
const isConnected = bleStore.state.isConnected
|
const isConnected = bleStore.state.isConnected
|
||||||
|
|
||||||
console.log('isConnected----------', isConnected)
|
// console.log('isConnected----------', isConnected)
|
||||||
|
|
||||||
const { galleryList: contents } = bleStore
|
const { galleryList: contents } = bleStore
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -582,11 +582,6 @@ const GooActions = observer<GooActionsProps>(function GooActions({ gooPoints, on
|
||||||
{isDev && isPolling && <Block className="ml-[4px] size-[6px] rounded-full bg-green-500" />}
|
{isDev && isPolling && <Block className="ml-[4px] size-[6px] rounded-full bg-green-500" />}
|
||||||
</Block>
|
</Block>
|
||||||
)}
|
)}
|
||||||
{!!isLogin && (
|
|
||||||
<Block onClick={() => router.push('/settings')}>
|
|
||||||
<Ionicons color="white" name="settings-outline" size={22} />
|
|
||||||
</Block>
|
|
||||||
)}
|
|
||||||
<Block
|
<Block
|
||||||
className="size-[48px] items-center justify-center rounded-full border-[3px] border-black bg-white shadow-[4px_4px_0px_#000]"
|
className="size-[48px] items-center justify-center rounded-full border-[3px] border-black bg-white shadow-[4px_4px_0px_#000]"
|
||||||
onClick={onOpenSearch}
|
onClick={onOpenSearch}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ const Sync = observer(() => {
|
||||||
// 加载生成记录
|
// 加载生成记录
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isFocused) {
|
if (isFocused) {
|
||||||
loadGenerations()
|
// loadGenerations()
|
||||||
}
|
}
|
||||||
}, [isFocused])
|
}, [isFocused])
|
||||||
|
|
||||||
|
|
@ -423,7 +423,7 @@ const Sync = observer(() => {
|
||||||
<FlashList
|
<FlashList
|
||||||
contentContainerStyle={{ paddingHorizontal: 12, paddingBottom: 200 }}
|
contentContainerStyle={{ paddingHorizontal: 12, paddingBottom: 200 }}
|
||||||
data={posts}
|
data={posts}
|
||||||
drawDistance={300}
|
// drawDistance={300}
|
||||||
maxItemsInRecyclePool={0}
|
maxItemsInRecyclePool={0}
|
||||||
removeClippedSubviews={true}
|
removeClippedSubviews={true}
|
||||||
ItemSeparatorComponent={() => <Block style={{ height: 6 }} />}
|
ItemSeparatorComponent={() => <Block style={{ height: 6 }} />}
|
||||||
|
|
@ -499,6 +499,9 @@ const DeviceItem = observer(({ device }: { device: any }) => {
|
||||||
|
|
||||||
const canEdit = !!bindDevice && isConnected
|
const canEdit = !!bindDevice && isConnected
|
||||||
|
|
||||||
|
// 绑定过的设备
|
||||||
|
const hasBind = !!bleStore.bindDeviceList?.find((d) => d?.id === id)
|
||||||
|
|
||||||
const { id: userId } = userStore.user || {}
|
const { id: userId } = userStore.user || {}
|
||||||
const onConnectToggle = async (device: any) => {
|
const onConnectToggle = async (device: any) => {
|
||||||
if (device.connected) {
|
if (device.connected) {
|
||||||
|
|
@ -623,6 +626,16 @@ const DeviceItem = observer(({ device }: { device: any }) => {
|
||||||
{isConnected ? '已连接' : '未连接'}
|
{isConnected ? '已连接' : '未连接'}
|
||||||
</Text>
|
</Text>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
||||||
|
{hasBind && (
|
||||||
|
<Block className="">
|
||||||
|
<Text
|
||||||
|
className={`border-2 border-black px-[6px] text-[10px] font-[900] ${isConnected ? 'bg-black text-accent' : 'bg-gray-200 text-gray-500'}`}
|
||||||
|
>
|
||||||
|
绑定过
|
||||||
|
</Text>
|
||||||
|
</Block>
|
||||||
|
)}
|
||||||
</Block>
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
</Block>
|
</Block>
|
||||||
|
|
@ -856,13 +869,10 @@ const HeaderBanner = observer(({ connectedDevice, onPick }: { connectedDevice: a
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
signOut().then(() => {
|
router.push('/settings')
|
||||||
Toast.show({ title: '已登出' })
|
|
||||||
router.replace('/auth')
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const loginText = isLogin ? '登出' : '登录'
|
const loginText = isLogin ? '设置' : '登录'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block className="relative z-40 flex-row items-center justify-between py-[12px]">
|
<Block className="relative z-40 flex-row items-center justify-between py-[12px]">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { root } from '@repo/core'
|
import { root } from '@repo/core'
|
||||||
import { type ListTemplateGenerationsInput, type TemplateGeneration, TemplateGenerationController } from '@repo/sdk'
|
import { type ListTemplateGenerationsInput, type TemplateGeneration, TemplateGenerationController } from '@repo/sdk'
|
||||||
import { useCallback, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
import { type ApiError } from '@/lib/types'
|
import { type ApiError } from '@/lib/types'
|
||||||
|
|
||||||
|
|
@ -19,14 +19,13 @@ export const useTemplateGenerations = () => {
|
||||||
const load = useCallback(async (params?: ListTemplateGenerationsInput) => {
|
const load = useCallback(async (params?: ListTemplateGenerationsInput) => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
currentPageRef.current = 1
|
currentPageRef.current = 1
|
||||||
const templateGeneration = root.get(TemplateGenerationController)
|
const templateGeneration = root.get(TemplateGenerationController)
|
||||||
|
|
||||||
const { data, error } = await handleError(
|
const { data, error } = await handleError(
|
||||||
async () =>
|
async () =>
|
||||||
await templateGeneration.list({
|
await templateGeneration.list({
|
||||||
page: currentPageRef.current,
|
page: 1,
|
||||||
limit: params?.limit || pageSize,
|
limit: params?.limit || pageSize,
|
||||||
...params,
|
...params,
|
||||||
}),
|
}),
|
||||||
|
|
@ -93,6 +92,10 @@ export const useTemplateGenerations = () => {
|
||||||
[load],
|
[load],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load()
|
||||||
|
}, [])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
loading,
|
loading,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue