Start adding API selection modal and supporting code
This commit is contained in:
@@ -8,8 +8,9 @@ import {
|
||||
TextInput,
|
||||
View,
|
||||
Button,
|
||||
TouchableWithoutFeedback,
|
||||
} from "react-native"
|
||||
import { MessageModal } from "../Modal"
|
||||
import { MessageModal, ApiModal } from "../Modal"
|
||||
import logoImage from "./images/deighton.png"
|
||||
import { FormBinder } from "react-form-binder"
|
||||
import { api } from "../API"
|
||||
@@ -48,9 +49,6 @@ export class Login extends React.Component {
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
logo: {
|
||||
width: "50%",
|
||||
},
|
||||
inputRow: {
|
||||
paddingTop: 10,
|
||||
width: "60%",
|
||||
@@ -79,6 +77,7 @@ export class Login extends React.Component {
|
||||
this.state = {
|
||||
binder: new FormBinder({ email: "john@lyon-smith.org" }, Login.bindings),
|
||||
messageModal: null,
|
||||
apiModal: null,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,16 +109,28 @@ export class Login extends React.Component {
|
||||
this.setState({ messageModal: null })
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleApiDismiss() {
|
||||
this.setState({ apiModal: null })
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleApiPress() {
|
||||
this.setState({ apiModal: {} })
|
||||
}
|
||||
|
||||
render() {
|
||||
const { messageModal } = this.state
|
||||
const { messageModal, apiModal } = this.state
|
||||
|
||||
return (
|
||||
<View style={Login.styles.page} behavior="padding">
|
||||
<Image
|
||||
style={Login.styles.logo}
|
||||
source={logoImage}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
<TouchableWithoutFeedback onPress={this.handleApiPress}>
|
||||
<Image
|
||||
style={{ width: "50%" }}
|
||||
source={logoImage}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
</TouchableWithoutFeedback>
|
||||
<View style={Login.styles.inputRow}>
|
||||
<BoundInput
|
||||
name="email"
|
||||
@@ -172,6 +183,10 @@ export class Login extends React.Component {
|
||||
detail={messageModal ? messageModal.detail : ""}
|
||||
onDismiss={messageModal && this.handleMessageDismiss}
|
||||
/>
|
||||
<ApiModal
|
||||
open={!!apiModal}
|
||||
onDismiss={apiModal && this.handleApiDismiss}
|
||||
/>
|
||||
{Platform.OS === "ios" && <KeyboardSpacer />}
|
||||
</View>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user