import React, { useState } from 'react'; import { Button, Space, Picker, PickerOption, FloatingLayer, Fill, } from '@xrnjs/ui'; import Card from '_global/Card'; import { View } from 'react-native'; import styles from './style'; // 自定义样式选项数据 const customOptions: PickerOption[] = new Array(12).fill(0).map((_, index) => ({ label: `自定义选项${index + 1}`, value: `custom_${index + 1}`, disabled: index % 4 === 3, // 每4个选项禁用一个 })); // 时间选择数据 const timeColumns: PickerOption[][] = [ new Array(24).fill(0).map((_, index) => ({ label: `${index.toString().padStart(2, '0')}时`, value: `hour_${index}`, })), new Array(60).fill(0).map((_, index) => ({ label: `${index.toString().padStart(2, '0')}分`, value: `minute_${index}`, })), new Array(60).fill(0).map((_, index) => ({ label: `${index.toString().padStart(2, '0')}秒`, value: `second_${index}`, })), ]; // 大数据量选项 const largeDataOptions: PickerOption[] = new Array(1000) .fill(0) .map((_, index) => ({ label: `大数据选项${index + 1}`, value: `large_data_${index + 1}`, disabled: index % 100 === 99, // 每100个选项禁用一个 })); const { PickerComponent } = Picker; const AdvancedFeatures = () => { // 自定义样式示例 const [customResult, setCustomResult] = useState(''); // 嵌套弹框示例 const [floatingVisible, setFloatingVisible] = useState(false); const [nestedPickerVisible, setNestedPickerVisible] = useState(false); const [nestedResult, setNestedResult] = useState([]); // 大数据量示例 const [largeDataResult, setLargeDataResult] = useState(''); // 自定义高度示例 const [customHeightResult, setCustomHeightResult] = useState([]); // 加载状态示例 const [loadingVisible, setLoadingVisible] = useState(false); const [isLoading, setIsLoading] = useState(false); return ( {customResult && ( )} setFloatingVisible(false)} onPressTextButton={() => setFloatingVisible(false)} onConfirm={() => setFloatingVisible(false)} onCancel={() => setFloatingVisible(false)} enableSlidingClose footer={ } > { console.log('嵌套选择器值变化:', values); setNestedResult(values as string[]); }} onPressOverlay={() => setNestedPickerVisible(false)} onCancel={() => setNestedPickerVisible(false)} onConfirm={() => setNestedPickerVisible(false)} /> {nestedResult.length > 0 && ( )} {largeDataResult && ( )} {customHeightResult.length > 0 && ( )} { console.log('加载状态选择器值变化:', values); }} onPressOverlay={() => setLoadingVisible(false)} onCancel={() => setLoadingVisible(false)} onConfirm={() => { setIsLoading(true); // 模拟异步操作 setTimeout(() => { setIsLoading(false); setLoadingVisible(false); }, 2000); }} /> ); }; export default AdvancedFeatures;