11// @flow
22import * as React from 'react'
33import { View , TextInput , StyleSheet } from 'react-native'
4+ import { NoticeView } from '@frogpond/notice'
45import { TabBarIcon } from '@frogpond/navigation-tabs'
56import * as c from '@frogpond/colors'
6- import { Toolbar , ToolbarButton } from '@frogpond/toolbar'
7+ import { Toolbar } from '@frogpond/toolbar'
78import type { TopLevelViewPropsType } from '../types'
89import { BonAppHostedMenu } from './menu-bonapp'
910
@@ -26,7 +27,6 @@ type Props = TopLevelViewPropsType
2627
2728type State = {
2829 cafeId : string ,
29- menu : ?any ,
3030}
3131
3232export class BonAppPickerView extends React . PureComponent < Props , State > {
@@ -36,8 +36,7 @@ export class BonAppPickerView extends React.PureComponent<Props, State> {
3636 }
3737
3838 state = {
39- cafeId : '34' ,
40- menu : null ,
39+ cafeId : '' ,
4140 }
4241
4342 chooseCafe = ( cafeId : string ) => {
@@ -53,20 +52,23 @@ export class BonAppPickerView extends React.PureComponent<Props, State> {
5352 < Toolbar onPress = { ( ) => { } } >
5453 < TextInput
5554 keyboardType = "numeric"
56- onBlur = { this . chooseCafe }
57- onChangeText = { this . chooseCafe }
55+ onEndEditing = { e => this . chooseCafe ( e . nativeEvent . text ) }
56+ placeholder = "id"
57+ returnKeyType = "done"
5858 style = { styles . default }
59- value = { this . state . cafeId }
6059 />
61- < ToolbarButton isActive = { true } title = "Go" />
6260 </ Toolbar >
63- < BonAppHostedMenu
64- key = { this . state . cafeId }
65- cafe = { { id : this . state . cafeId } }
66- loadingMessage = { [ 'Loading…' ] }
67- name = "BonApp"
68- navigation = { this . props . navigation }
69- />
61+ { this . state . cafeId ? (
62+ < BonAppHostedMenu
63+ key = { this . state . cafeId }
64+ cafe = { { id : this . state . cafeId } }
65+ loadingMessage = { [ 'Loading…' ] }
66+ name = "BonApp"
67+ navigation = { this . props . navigation }
68+ />
69+ ) : (
70+ < NoticeView text = "Please enter a Cafe ID." />
71+ ) }
7072 </ View >
7173 )
7274 }
0 commit comments