2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2015-03-26 18:24:15 +00:00
|
|
|
* The examples provided by Facebook are for non-commercial testing and
|
|
|
|
* evaluation purposes only.
|
2015-03-23 22:07:33 +00:00
|
|
|
*
|
2015-03-26 18:24:15 +00:00
|
|
|
* Facebook reserves all rights not expressly granted.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2015-01-30 01:10:49 +00:00
|
|
|
*
|
2015-08-28 10:57:51 +00:00
|
|
|
* @providesModule SearchBar
|
2015-01-30 01:10:49 +00:00
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-04-09 03:36:40 +00:00
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
2015-01-30 01:10:49 +00:00
|
|
|
var {
|
2016-06-14 05:15:47 +00:00
|
|
|
ActivityIndicator,
|
2015-08-28 10:57:51 +00:00
|
|
|
TextInput,
|
2015-01-30 01:10:49 +00:00
|
|
|
StyleSheet,
|
2015-08-28 10:57:51 +00:00
|
|
|
View,
|
2016-04-09 03:36:40 +00:00
|
|
|
} = ReactNative;
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2016-07-26 08:00:02 +00:00
|
|
|
class SearchBar extends React.Component {
|
|
|
|
render() {
|
2015-01-30 01:10:49 +00:00
|
|
|
return (
|
2015-08-28 10:57:51 +00:00
|
|
|
<View style={styles.searchBar}>
|
|
|
|
<TextInput
|
|
|
|
autoCapitalize="none"
|
|
|
|
autoCorrect={false}
|
|
|
|
onChange={this.props.onSearchChange}
|
|
|
|
placeholder="Search a movie..."
|
|
|
|
onFocus={this.props.onFocus}
|
|
|
|
style={styles.searchBarInput}
|
|
|
|
/>
|
2016-06-14 05:15:47 +00:00
|
|
|
<ActivityIndicator
|
2015-08-28 10:57:51 +00:00
|
|
|
animating={this.props.isLoading}
|
|
|
|
style={styles.spinner}
|
|
|
|
/>
|
|
|
|
</View>
|
2015-01-30 01:10:49 +00:00
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-01-30 01:10:49 +00:00
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
2015-08-28 10:57:51 +00:00
|
|
|
searchBar: {
|
|
|
|
marginTop: 64,
|
|
|
|
padding: 3,
|
|
|
|
paddingLeft: 8,
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
},
|
|
|
|
searchBarInput: {
|
|
|
|
fontSize: 15,
|
2015-01-30 01:10:49 +00:00
|
|
|
flex: 1,
|
2015-08-28 10:57:51 +00:00
|
|
|
height: 30,
|
|
|
|
},
|
|
|
|
spinner: {
|
|
|
|
width: 30,
|
2015-01-30 01:10:49 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2015-08-28 10:57:51 +00:00
|
|
|
module.exports = SearchBar;
|