Guide3Screen.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* eslint-disable camelcase */
  2. import * as WebBrowser from "expo-web-browser";
  3. import * as React from "react";
  4. import { StyleSheet } from "react-native";
  5. import { useModel } from "flooks";
  6. import { Layout, Text, useTheme, Button, Card } from "@ui-kitten/components";
  7. import { useFocusEffect } from "@react-navigation/native";
  8. import ScrollPage from "../components/ScrollPage";
  9. import FormInput from "../components/FormInput";
  10. import ConnectButton from "../components/ConnectButton";
  11. import GuideHeaderBar from "../components/GuideHeaderBar";
  12. const styles = StyleSheet.create({
  13. container: {
  14. flex: 1,
  15. paddingBottom: 33,
  16. },
  17. tabContent: {
  18. backgroundColor: "#fff",
  19. marginTop: 20,
  20. },
  21. img: {
  22. width: 100,
  23. height: 100,
  24. alignSelf: "center",
  25. },
  26. img2: {
  27. width: 97,
  28. height: 21,
  29. alignSelf: "center",
  30. marginTop: 2,
  31. },
  32. text: {
  33. marginTop: 16,
  34. },
  35. layoutLeft: {
  36. // flexDirection: "row",
  37. paddingVertical: 10,
  38. justifyContent: "center",
  39. alignItems: "center",
  40. marginTop: 50,
  41. },
  42. form: {
  43. paddingHorizontal: 26,
  44. paddingVertical: 20,
  45. },
  46. textareaContainer: {
  47. backgroundColor: "#F0F0F0",
  48. height: 100,
  49. borderRadius: 4,
  50. },
  51. textarea: {
  52. textAlignVertical: "top", // hack android
  53. fontSize: 13,
  54. color: "#333",
  55. paddingHorizontal: 14,
  56. paddingVertical: 10,
  57. height: 100,
  58. },
  59. });
  60. export default function Guide1Screen() {
  61. const theme = useTheme();
  62. const { changeBackground } = useModel("barModel");
  63. const { saveMerchant, checkInfo } = useModel("userModel", true);
  64. const {
  65. guide3_title1,
  66. guide3_title2,
  67. guide3_form_1,
  68. guide3_pla_1,
  69. guide3_form_2,
  70. guide3_pla_2,
  71. complete,
  72. } = useModel("wordsModel");
  73. const [aliName, changeAliName] = React.useState("");
  74. const [aliAccount, changeAliAccount] = React.useState("");
  75. useFocusEffect(
  76. React.useCallback(() => {
  77. changeBackground(theme["color-primary-500"]);
  78. checkInfo({
  79. aliAccountEvent: changeAliAccount,
  80. aliNameEvent: changeAliName,
  81. });
  82. }, [])
  83. );
  84. const canNext = React.useMemo(() => {
  85. if (aliAccount && aliName) {
  86. return true;
  87. }
  88. return false;
  89. }, [aliName, aliAccount]);
  90. return (
  91. <>
  92. <GuideHeaderBar />
  93. <ScrollPage>
  94. <Layout style={styles.container}>
  95. <Card appearance="headFilled">
  96. <Text category="s1">{guide3_title1}</Text>
  97. <Text category="s1">{guide3_title2}</Text>
  98. </Card>
  99. <Card appearance="formFilled">
  100. {/* 支付宝账号 */}
  101. <FormInput
  102. label={guide3_form_1}
  103. placeholder={guide3_pla_1}
  104. value={aliName}
  105. onChange={changeAliName}
  106. style={{ paddingVertical: 3 }}
  107. />
  108. {/* 支付宝账户名 */}
  109. <FormInput
  110. label={guide3_form_2}
  111. placeholder={guide3_pla_2}
  112. value={aliAccount}
  113. onChange={changeAliAccount}
  114. style={{ paddingVertical: 3 }}
  115. />
  116. <Layout style={styles.layoutLeft} level="1">
  117. <Button
  118. status="primary"
  119. disabled={!canNext}
  120. onPress={() => saveMerchant({ aliName, aliAccount })}
  121. >
  122. {complete}
  123. </Button>
  124. </Layout>
  125. </Card>
  126. <ConnectButton />
  127. </Layout>
  128. </ScrollPage>
  129. </>
  130. );
  131. }