From e9d7252b198a21b3187885198ba146caf82925ba Mon Sep 17 00:00:00 2001 From: omiceron Date: Sun, 10 Jun 2018 20:55:32 +0500 Subject: [PATCH 1/3] HT6: EventScreen, Delete dialog, SignIn button, and half working SectionList --- MobileApp/App.js | 40 +++++++++++------- MobileApp/package.json | 2 +- MobileApp/src/components/event-list.js | 56 +++++++++++++++++--------- MobileApp/src/components/sign-in.js | 18 ++++++++- admin/src/config.js | 6 +-- 5 files changed, 84 insertions(+), 38 deletions(-) diff --git a/MobileApp/App.js b/MobileApp/App.js index 245642c..772fbe4 100644 --- a/MobileApp/App.js +++ b/MobileApp/App.js @@ -1,25 +1,37 @@ import React from 'react'; -import { StyleSheet, View, Image } from 'react-native'; -//import SignIn from './src/components/sign-in' +import {StyleSheet, View, Image, NavigatorIOS} from 'react-native'; +import SignIn from './src/components/sign-in' //import HelloWorld from './src/hello-world' import EventList from './src/components/event-list' import fixtures from './fixtures.json' import img from './assets/images/logo.png' - +import EventScreen from './src/components/event-screen-1' const events = Object.entries(fixtures.events).map(([uid, event]) => ({...event, uid})) -export default class App extends React.Component { +/*export default class App extends React.Component { + render() { + return ( + + + ); + } +}*/ + +export default class App extends React.Component { render() { return ( - - + + - ); + ) } } @@ -32,9 +44,9 @@ const styles = StyleSheet.create({ paddingTop: 30, paddingBottom: 30, }, - image: { - width: '100%', - height: 100 - } + image: { + width: '100%', + height: 100 + } }); diff --git a/MobileApp/package.json b/MobileApp/package.json index bb23e24..fff8191 100644 --- a/MobileApp/package.json +++ b/MobileApp/package.json @@ -23,4 +23,4 @@ "react": "16.3.1", "react-native": "~0.55.2" } -} \ No newline at end of file +} diff --git a/MobileApp/src/components/event-list.js b/MobileApp/src/components/event-list.js index 7156d55..781ffa3 100644 --- a/MobileApp/src/components/event-list.js +++ b/MobileApp/src/components/event-list.js @@ -1,26 +1,44 @@ -import React, { Component } from 'react' -import {ScrollView, StyleSheet, Text} from 'react-native' +import React, {Component} from 'react' +import {Button, View, StyleSheet, Text, SectionList, NavigatorIOS} from 'react-native' import Card from './common/card' +import EventScreen from './event-screen-1' + + class EventList extends Component { - static propTypes = { - - }; - - render() { - return ( - - {this.props.events.map(event => - - {event.title} - - )} - - ) - } + static propTypes = {}; + + render() { + return ( + + alert(123)}>{item} + } + renderSectionHeader={({section: {title}}) => ( + {title} + )} + sections={this.props.events.map(({title, where, when}) => ({title, data: [where, when]}))} + keyExtractor={(item, index) => item + index} + /> + /* + + {this.props.events.map(event => + + {event.title} + + )} + */ + + + ) + } + + openEvent() { + console.log(123) + } } -const styles = StyleSheet.create({ -}) +const styles = StyleSheet.create({}) + export default EventList \ No newline at end of file diff --git a/MobileApp/src/components/sign-in.js b/MobileApp/src/components/sign-in.js index 7a0a54d..e090fb3 100644 --- a/MobileApp/src/components/sign-in.js +++ b/MobileApp/src/components/sign-in.js @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import {View, Text, TextInput, Platform} from 'react-native' +import {View, Text, TextInput, Platform, Button, Alert} from 'react-native' class SignIn extends Component { static propTypes = { @@ -27,12 +27,28 @@ class SignIn extends Component { onChangeText = {this.handlePasswordChange} secureTextEntry /> +