diff --git a/apps/common/mobile/lib/view/Search.jsx b/apps/common/mobile/lib/view/Search.jsx index 5b54457da..1a9932d06 100644 --- a/apps/common/mobile/lib/view/Search.jsx +++ b/apps/common/mobile/lib/view/Search.jsx @@ -85,43 +85,41 @@ class SearchView extends Component { constructor(props) { super(props); - const $$ = Dom7; - this.state = { searchQuery: '', replaceQuery: '' }; - $$(document).on('page:init', (e, page) => { - if(!this.searchbar) { - this.searchbar = f7.searchbar.create({ - el: '.searchbar', - customSearch: true, - expandable: true, - backdrop: false, - on: { - search: (bar, curval, prevval) => { - }, - enable: this.onSearchbarShow.bind(this, true), - disable: this.onSearchbarShow.bind(this, false) - } - }); - - const $editor = $$('#editor_sdk'); - - $editor.on('pointerdown', this.onEditorTouchStart.bind(this)); - $editor.on('pointerup', this.onEditorTouchEnd.bind(this)); - } - }); - this.onSettingsClick = this.onSettingsClick.bind(this); this.onSearchClick = this.onSearchClick.bind(this); this.onReplaceClick = this.onReplaceClick.bind(this); } componentDidMount(){ - const $$ = Dom7; this.$replace = $$('#idx-replace-val'); + + const $editor = $$('#editor_sdk'); + $editor.on('pointerdown', this.onEditorTouchStart.bind(this)); + $editor.on('pointerup', this.onEditorTouchEnd.bind(this)); + + if( !this.searchbar ) { + this.searchbar = f7.searchbar.get('.searchbar'); + } + + if( !this.searchbar ) { + this.searchbar = f7.searchbar.create({ + el: '.searchbar', + customSearch: true, + expandable: true, + backdrop: false, + on: { + search: (bar, curval, prevval) => { + }, + enable: this.onSearchbarShow.bind(this, true), + disable: this.onSearchbarShow.bind(this, false) + } + }); + } } componentWillUnmount() {