search - React Native : Searching, Filter, and Base View all in one route -


i ask, there solution come out messenger(mobile app) searching function? route having basic view elements. when user typing in words, search start function, within same screen, view overlap show filter list. had tried use react-native-overlap module not work well.

var react = require ('react-native'); var {   text, view, stylesheet, textinput, dimensions, image, platform, scrollview, reactnative, deviceeventemitter,touchableopacity } = react; var navigationbar = require ('../components/navigationbar'); var searchbarfromnodemodule = require ('react-native-search-bar'); var overlay=require('react-native-overlay');  var recent = react.createclass({  getinitialstate(){   return {     isvisible:'aa',   }; },  onnamechanged(e){   //todo here //  alert('asd'); },  render (){ return (   <view>   <view style={styles.navbarcontainer}>   <searchbarfromnodemodule ref='searchbar' placeholder='search' showscancelbutton={true} onchange={this.onnamechanged} />   </view>   <view style={{flex:1, flexdirection:'column'}}>   <view style={{backgroundcolor:'#f4fa58',flex:1,height:40}}/>   <view style={{backgroundcolor:'#58faf4',flex:1,height:40}}/>   <view style={{backgroundcolor:'#f4fa58',flex:1,height:40}}/>   <view style={{backgroundcolor:'#58faf4',flex:1,height:40}}/>   <view style={{backgroundcolor:'#f4fa58',flex:1,height:40}}/>   <view style={{backgroundcolor:'#58faf4',flex:1,height:40}}/>   </view>   </view>     ); }, });  var styles=stylesheet.create({   navbarcontainer: {     height: 65,     paddingtop: 20,   },   button:{     height:40,     textalign:'center',     fontsize:18,     marginbottom:10,     margintop:10,     color:'blue',   }`enter code here` });  module.exports = recent; 

now there color boxes after search bar, when user typing something, onchange function take place. have no idea how overlap color boxes.

this gets job done. issue search results box renders under text view below search input. corrected in few ways zindex feature introduced in 0.30 coming out soon.

https://rnplay.org/apps/cjnpwg

import react 'react'; import {   appregistry,   stylesheet,   text,   view,   textinput } 'react-native';  class searchresults extends react.component {   render() {     if (this.props.search.touppercase() !== 'bam') {       return null;     }      return (       <view style={styles.searchresults}>         <text>           whatever heart desires here...    might recomend list view??         </text>       </view>     );   } }  class searchbox extends react.component {   render() {     return (       <view>         <textinput            style={{height: 40, bordercolor: 'gray', borderwidth: 1}}            value={this.props.search}            onchangetext={this.props.onchange}            placeholder="try 'bam'!"          />         <searchresults search={props.search} />        </view>     );   } }  class sampleapp extends react.component {   state = {     currentsearch: ''   };    oncurrentsearchchange(text) {     this.setstate({       currentsearch: text     });   }    render() {     return (      <view style={styles.container}>        <text>enter search</text>        <searchbox search={this.state.currentsearch} onchange={this.oncurrentsearchchange.bind(this)} />        <text>some text below search box...</text>      </view>     );   } }  var styles = stylesheet.create({   container: {     flex: 1,     paddingtop: 30   },   searchresults: {     position: 'absolute',     backgroundcolor: 'white',     bordercolor: 'black',     borderwidth: 1   } });  appregistry.registercomponent('sampleapp', () => sampleapp); 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -