uberDriver.tsx 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { View, Text, StyleSheet } from 'react-native';
  2. import NormalButton from '../../../global/normal_button';
  3. import { useState } from 'react';
  4. import SingleSelectButtonGroup from '../../../global/select_button';
  5. import useSignUpStore from '../../../../providers/signup_form_store';
  6. type UberDriverProps = {
  7. goToNextPage: () => void;
  8. };
  9. const UberDriver: React.FC<UberDriverProps> = ({ goToNextPage }) => {
  10. const { signUpFormData, setSignUpFormData } = useSignUpStore();
  11. const [error, setError] = useState('');
  12. const options = [{ label: '是(可享有獨家優惠)' }, { label: '否' }];
  13. const handleNext = () => {
  14. if (signUpFormData.isUberDriver == undefined) {
  15. setError('請確保所有資料都已填寫。');
  16. } else {
  17. setError('');
  18. goToNextPage();
  19. }
  20. };
  21. const selectLabelShown = () => {
  22. if (signUpFormData.isUberDriver == undefined) {
  23. return null;
  24. } else if (signUpFormData.isUberDriver == true) {
  25. return '是(可享有獨家優惠)';
  26. } else {
  27. return '否';
  28. }
  29. };
  30. return (
  31. <View className="flex-1 items-center justify-center">
  32. <Text>***********PLACEHOLDER***********</Text>
  33. <Text>***********PLACEHOLDER***********</Text>
  34. <Text>***********PLACEHOLDER***********</Text>
  35. <Text>***********PLACEHOLDER***********</Text>
  36. <Text>***********PLACEHOLDER***********</Text>
  37. <Text>***********PLACEHOLDER***********</Text>
  38. <Text>***********PLACEHOLDER***********</Text>
  39. <Text>***********PLACEHOLDER***********</Text>
  40. <Text>***********PLACEHOLDER***********</Text>
  41. <Text>***********PLACEHOLDER***********</Text>
  42. <Text>***********PLACEHOLDER***********</Text>
  43. <Text>***********PLACEHOLDER***********</Text>
  44. <Text>***********PLACEHOLDER***********</Text>
  45. <NormalButton
  46. title={<Text style={{ color: '#fff' }}>下一步</Text>}
  47. onPress={goToNextPage}
  48. extendedStyle={{}}
  49. />
  50. </View>
  51. // <>
  52. // <View style={styles.container}>
  53. // <Text style={styles.text}>請問您是Uber Driver嗎?</Text>
  54. // <SingleSelectButtonGroup
  55. // options={options}
  56. // onSelectionChange={(label) => {
  57. // const convertLabelToBoolean =
  58. // label === "是(可享有獨家優惠)" ? true : label === "否" ? false : undefined;
  59. // setSignUpFormData({ ...signUpFormData, isUberDriver: convertLabelToBoolean });
  60. // }}
  61. // shouldShowRedOutline={error ? true : false}
  62. // selectedOption={selectLabelShown()}
  63. // />
  64. // <NormalButton
  65. // title={<Text style={{ color: "#fff" }}>下一步</Text>}
  66. // onPress={handleNext}
  67. // extendedStyle={{}}
  68. // />
  69. // {error && <Text style={styles.errorMessage}>{error}</Text>}
  70. // </View>
  71. // </>
  72. );
  73. };
  74. const styles = StyleSheet.create({
  75. container: {
  76. flex: 1,
  77. marginHorizontal: 20
  78. },
  79. text: {
  80. fontSize: 20,
  81. paddingBottom: 10
  82. },
  83. errorMessage: {
  84. fontSize: 14,
  85. color: '#ff0033',
  86. fontWeight: '400',
  87. marginLeft: 10,
  88. marginTop: 10
  89. }
  90. });
  91. export default UberDriver;