搜索框和导航栏(React Native)

搜索框和导航栏(React Native)

by 伍雪颖

'use strict';
var React = require('react-native');
var {
  AppRegistry,StyleSheet,View,TextInput,} = React;


class SearchBar extends React.Component {
  render() {
    return (
      <View style={styles.searchRow}>
          <TextInput
            autoCapitalize="none"
            autoCorrect={false}
            clearButtonMode="always"
            placeholder="Please input your name..."
            style={styles.searchTextInput}
          />
        </View>
      );
  }
}


class SampleApp extends React.Component {
  render() {
    return (
      <React.NavigatorIOS
        style={styles.container}
        initialRoute={{
          title: 'My App',component: SearchBar,}}/>
    );
  }
}


var styles = React.StyleSheet.create({
  container: {
    flex: 1
  },searchRow: {
    backgroundColor: '#eeeeee',paddingTop: 75,paddingLeft: 10,paddingRight: 10,paddingBottom: 10,},searchTextInput: {
    backgroundColor: 'white',borderColor: '#cccccc',borderRadius: 3,borderWidth: 1,height: 30,paddingLeft: 8,});


React.AppRegistry.registerComponent('SampleApp',function() { return SampleApp });

相关文章

react 中的高阶组件主要是对于 hooks 之前的类组件来说的,如...
我们上一节了解了组件的更新机制,但是只是停留在表层上,例...
我们上一节了解了 react 的虚拟 dom 的格式,如何把虚拟 dom...
react 本身提供了克隆组件的方法,但是平时开发中可能很少使...
mobx 是一个简单可扩展的状态管理库,中文官网链接。小编在接...
我们在平常的开发中不可避免的会有很多列表渲染逻辑,在 pc ...