Skip to content

Commit 48b59e6

Browse files
committed
button fix
1 parent 7b0bac2 commit 48b59e6

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

app/components/welcome/index.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { updateLocation, updateTime, submitForm, togglePicker } from '../../redu
77
import { fetchGeocode, fetchDistance, updateCurrentLocation, setGeocode } from '../../redux/location/action-creators';
88
import {colors} from '../../lib/colors';
99
import {travelTimePlusFive, toTimeString} from '../../lib/time';
10+
import Button from 'apsl-react-native-button';
1011
import {Text,
1112
View,
1213
ScrollView,
@@ -18,6 +19,7 @@ import {Text,
1819
Platform,
1920
TextInput,
2021
Image,
22+
Dimensions,
2123
DatePickerIOS} from 'react-native';
2224
var PushNotification = require('react-native-push-notification');
2325

@@ -135,7 +137,7 @@ class Welcome extends Component {
135137
if (!this.props.queries){return}
136138
for (let query of this.props.queries){
137139
queries.push(
138-
<TouchableOpacity key={query.place_name} style={styles.queryContainer} onPress={() => this.props.setGeocode(query.geometry.coordinates)}>
140+
<TouchableOpacity key={query.place_name} onPress={() => this.props.setGeocode(query.geometry.coordinates)}>
139141
<Text ellipsizeMode="tail" numberOfLines={1} style={[styles.listText, (this.props.geocode.latitude == query.geometry.coordinates[0]) ? styles.selectedQuery : styles.listText]}>
140142
{query.place_name}
141143
</Text>
@@ -148,12 +150,12 @@ class Welcome extends Component {
148150
render() {
149151
return (
150152
<Image source={require('../../../images/followme.jpg')} style={styles.outerContainer}>
151-
<ScrollView style={styles.innerContainer}>
153+
<ScrollView automaticallyAdjustContentInsets={false} style={styles.innerContainer}>
152154
<Text style={[styles.text, styles.title]}>i want to arrive at</Text>
153155
<View style={styles.separator}/>
154156
<View style={styles.textInput}>
155157
<TextInput
156-
style={[styles.text, styles.height]}
158+
style={[styles.text, styles.textInputText]}
157159
autoCorrect={true}
158160
selectTextOnFocus={true}
159161
numberOfLines={1}
@@ -163,7 +165,9 @@ class Welcome extends Component {
163165
defaultValue={"Current Location"}
164166
/>
165167
</View>
168+
<View style={styles.queryContainer}>
166169
{this.renderQueries()}
170+
</View>
167171
<View style={styles.separator}/>
168172
{(Platform.OS === 'ios') &&
169173
<View>
@@ -189,11 +193,11 @@ class Welcome extends Component {
189193
</View>
190194
}
191195
</ScrollView>
192-
<TouchableOpacity style={styles.buttonContainer} onPress={this.handleSubmit.bind(this)}>
193-
<View style={styles.button}>
196+
<View style={styles.buttonContainer} >
197+
<Button style={styles.button} onPress={this.handleSubmit.bind(this)}>
194198
<Text style={styles.buttonText}>Wander!</Text>
195-
</View>
196-
</TouchableOpacity>
199+
</Button>
200+
</View>
197201
</Image>
198202
);
199203
}
@@ -206,17 +210,19 @@ const styles = StyleSheet.create({
206210
textAlign: 'center'
207211
},
208212
outerContainer: {
209-
paddingTop: 80,
213+
marginTop: 20,
210214
flex: 1,
215+
flexDirection: 'column',
211216
justifyContent: 'center',
212217
alignItems: 'center',
213218
width: null,
214219
height: null,
215220
backgroundColor: colors.transparent,
216221
},
217222
innerContainer: {
223+
flexDirection: 'row',
224+
flex: 1,
218225
marginTop: 20,
219-
marginBottom: 100,
220226
backgroundColor: colors.transparent,
221227
},
222228
text: {
@@ -227,8 +233,9 @@ const styles = StyleSheet.create({
227233
backgroundColor: colors.transparent,
228234
textAlign: 'center'
229235
},
230-
height: {
236+
textInputText: {
231237
height: 45,
238+
width: Dimensions.get('window').width - 20,
232239
},
233240
listText: {
234241
fontFamily: 'HelveticaNeue-Medium',
@@ -239,8 +246,11 @@ const styles = StyleSheet.create({
239246
color: colors.CTA
240247
},
241248
queryContainer: {
249+
width: Dimensions.get('window').width - 10,
242250
},
243251
queryList: {
252+
alignSelf: 'center',
253+
justifyContent: 'center',
244254
marginHorizontal: 10,
245255
paddingHorizontal: 10,
246256
paddingBottom: 10,
@@ -249,26 +259,18 @@ const styles = StyleSheet.create({
249259
borderRightWidth: 1,
250260
borderColor: colors.primary,
251261
},
252-
textInput: {
253-
paddingHorizontal: 20,
254-
},
255262
separator: {
256263
marginTop: 30
257264
},
258265
buttonContainer: {
259-
position: 'absolute',
260266
alignItems: 'center',
261267
justifyContent: 'center',
262268
flexDirection: 'row',
263-
flex: 1,
269+
flex: 0.1,
264270
bottom: 50,
265271
},
266272
button: {
267-
flex: 1,
268-
marginHorizontal: 100,
269-
paddingTop: 10,
270-
height:45,
271-
borderRadius:4,
273+
paddingHorizontal: 14,
272274
borderWidth: 2,
273275
borderColor: colors.CTA,
274276
backgroundColor: colors.transparent

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"test": "jest"
88
},
99
"dependencies": {
10+
"apsl-react-native-button": "^3.0.2",
1011
"query-string": "^4.2.3",
1112
"react": "15.3.2",
1213
"react-native": "0.35.0",

0 commit comments

Comments
 (0)