From 8ebb47f40c2b9c0c7ec74a6d799bc321519417ea Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 17 Sep 2016 22:00:18 +0100 Subject: [PATCH] Add input --- src/components/Input.tsx | 58 ++++++++++++++++++++++++++++++++++++++++ src/index.tsx | 25 ++++++++++------- src/settings/styles.ts | 5 ++++ src/views/main.tsx | 10 ++++--- 4 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 src/components/Input.tsx diff --git a/src/components/Input.tsx b/src/components/Input.tsx new file mode 100644 index 0000000..136a57a --- /dev/null +++ b/src/components/Input.tsx @@ -0,0 +1,58 @@ +import React, { Component }from 'react'; + +import { TextInput, View, StyleSheet } from 'react-native'; +import { BRAND_PRIMARY } from '../settings/styles'; + + +const styles = StyleSheet.create({ + inputBorder: { + borderWidth: 1, + borderColor: BRAND_PRIMARY, + borderStyle: 'solid', + borderRadius: 7, + margin: 20 + } as React.ViewStyle, + + input: { + height: 40, + fontSize: 14, + color: '#000', + textAlign: 'center', + } as React.TextStyle +}); + +interface State { + value: string +} + +export default class Input extends Component { + constructor() { + super(); + this.state = { + value: '' + }; + this.handleChange = this.handleChange.bind(this); + } + + handleChange(value : string) { + this.setState({ value }); + } + + render() { + return ( + + + + + ) + } +} diff --git a/src/index.tsx b/src/index.tsx index b62f4fc..e96d64d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -5,19 +5,24 @@ import { Navigator, StyleSheet } from 'react-native'; +import './types'; + import Routes from './navigation/Routes'; import RouteMapper from './navigation/RouteMapper'; -import './types'; +import { NAVBAR_HEIGHT } from './settings/styles'; const styles = StyleSheet.create({ - wrapper: { - flex: 1 + container: { + flex: 1, } as React.ViewStyle, navbar: { flexDirection: 'row', justifyContent: 'center', - backgroundColor: '#888' + backgroundColor: '#FFF' + } as React.ViewStyle, + wrapper: { + marginTop: NAVBAR_HEIGHT } as React.ViewStyle }); @@ -26,16 +31,18 @@ export default class App extends Component { const Component = route.component; const props = route.props || {}; return ( - + + + ); } render() { return ( - + { render() { return ( + Welcome to React Native!