|
|
@@ -1,18 +1,35 @@
|
|
|
-import React from "react";
|
|
|
-import { Text } from "react-native";
|
|
|
+import React, { useState } from "react";
|
|
|
+import { Button, Text } from "react-native";
|
|
|
+import SingleSelectButtonGroup from "../../../component/global/select_button";
|
|
|
|
|
|
export default function Index() {
|
|
|
- /**********************************狀態管理**********************************/
|
|
|
- /**********************************狀態管理**********************************/
|
|
|
- /**********************************組件初始化**********************************/
|
|
|
- /**********************************組件初始化**********************************/
|
|
|
- /**********************************異步函數**********************************/
|
|
|
- /**********************************異步函數**********************************/
|
|
|
+ /**********************************狀態管理**********************************/
|
|
|
+ /**********************************狀態管理**********************************/
|
|
|
+ /**********************************組件初始化**********************************/
|
|
|
+ /**********************************組件初始化**********************************/
|
|
|
+ /**********************************異步函數**********************************/
|
|
|
+ /**********************************異步函數**********************************/
|
|
|
|
|
|
- return (
|
|
|
- ////testing component here
|
|
|
- <>
|
|
|
- <Text>Test Here</Text>
|
|
|
- </>
|
|
|
- );
|
|
|
+ //receiving option value from child component
|
|
|
+ const [selectedOption, setSelectedOption] = useState<string | null>(null);
|
|
|
+
|
|
|
+ //Imitating the next button for testing purpose
|
|
|
+ const [nextIsClicked, setNextIsClicked] = useState<boolean>(false);
|
|
|
+
|
|
|
+ const options = [{ label: "信用卡" }, { label: "支付寶" }, { label: "微信支付" }];
|
|
|
+
|
|
|
+ return (
|
|
|
+ ////testing component here
|
|
|
+ <>
|
|
|
+ <SingleSelectButtonGroup
|
|
|
+ options={options}
|
|
|
+ selectedOption={selectedOption}
|
|
|
+ onSelectionChange={setSelectedOption}
|
|
|
+ //only show red outline when next button is clicked AND no value is selected
|
|
|
+ shouldShowRedOutline={nextIsClicked === true && selectedOption === null}
|
|
|
+ />
|
|
|
+
|
|
|
+ <Button title="next" onPress={() => setNextIsClicked(true)} />
|
|
|
+ </>
|
|
|
+ );
|
|
|
}
|