Merge branch 'feat/liujie'
This commit is contained in:
@@ -11,9 +11,6 @@ interface PickerProps {
|
|||||||
setvisible: (visible: boolean) => void;
|
setvisible: (visible: boolean) => void;
|
||||||
options?: PickerOption[][] | PickerOption[];
|
options?: PickerOption[][] | PickerOption[];
|
||||||
value?: (string | number)[];
|
value?: (string | number)[];
|
||||||
type?: "month" | "day" | "hour" | "ntrp" | null;
|
|
||||||
img?: string;
|
|
||||||
onConfirm?: (options: PickerOption[], values: (string | number)[]) => void;
|
|
||||||
onChange?: (value: (string | number)[]) => void;
|
onChange?: (value: (string | number)[]) => void;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
@@ -22,7 +19,6 @@ const PopupPicker = ({
|
|||||||
visible,
|
visible,
|
||||||
setvisible,
|
setvisible,
|
||||||
value = [],
|
value = [],
|
||||||
onConfirm,
|
|
||||||
onChange,
|
onChange,
|
||||||
options = [],
|
options = [],
|
||||||
style,
|
style,
|
||||||
@@ -33,7 +29,6 @@ const PopupPicker = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
console.log(defaultValue, "defaultValue");
|
|
||||||
onChange?.(defaultValue);
|
onChange?.(defaultValue);
|
||||||
setvisible(false);
|
setvisible(false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,15 +23,8 @@ interface IProps {
|
|||||||
function CityPicker(props) {
|
function CityPicker(props) {
|
||||||
const { visible, setVisible, cities, area, setArea } = props;
|
const { visible, setVisible, cities, area, setArea } = props;
|
||||||
console.log(cities, "cities");
|
console.log(cities, "cities");
|
||||||
const [index, setIndex] = useState(0);
|
|
||||||
const [value, setValue] = useState(area);
|
const [value, setValue] = useState(area);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (visible) {
|
|
||||||
setIndex(index + 1);
|
|
||||||
}
|
|
||||||
}, [visible]);
|
|
||||||
|
|
||||||
function onChange(value: any) {
|
function onChange(value: any) {
|
||||||
console.log(value, "value");
|
console.log(value, "value");
|
||||||
setValue(value);
|
setValue(value);
|
||||||
@@ -40,7 +33,6 @@ function CityPicker(props) {
|
|||||||
return (
|
return (
|
||||||
visible && (
|
visible && (
|
||||||
<PopupPicker
|
<PopupPicker
|
||||||
key={index}
|
|
||||||
options={cities}
|
options={cities}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
setvisible={setVisible}
|
setvisible={setVisible}
|
||||||
@@ -177,13 +169,15 @@ const ListHeader = (props: IProps) => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<CityPicker
|
{cityPopupVisible && (
|
||||||
visible={cityPopupVisible}
|
<CityPicker
|
||||||
setVisible={setCityPopupVisible}
|
visible={cityPopupVisible}
|
||||||
cities={cities}
|
setVisible={setCityPopupVisible}
|
||||||
area={area}
|
cities={cities}
|
||||||
setArea={updateArea}
|
area={area}
|
||||||
/>
|
setArea={updateArea}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</CustomNavbar>
|
</CustomNavbar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user