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';
|
|
|
|
|
2015-03-23 17:06:16 +00:00
|
|
|
var React = require('react-native');
|
2015-01-30 01:10:49 +00:00
|
|
|
var {
|
2015-08-28 10:57:51 +00:00
|
|
|
ActivityIndicatorIOS,
|
|
|
|
TextInput,
|
2015-01-30 01:10:49 +00:00
|
|
|
StyleSheet,
|
2015-08-28 10:57:51 +00:00
|
|
|
View,
|
2015-01-30 01:10:49 +00:00
|
|
|
} = React;
|
|
|
|
|
2015-08-28 10:57:51 +00:00
|
|
|
var SearchBar = React.createClass({
|
2015-01-30 01:10:49 +00:00
|
|
|
render: function() {
|
|
|
|
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}
|
|
|
|
/>
|
|
|
|
<ActivityIndicatorIOS
|
|
|
|
animating={this.props.isLoading}
|
|
|
|
style={styles.spinner}
|
|
|
|
/>
|
|
|
|
</View>
|
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;
|