Added search bar to navigation plugin

Summary:
Here I've started work on a search bar for the top of my plugin. Currently it supports navigation in a device by typing in an app uri and pressing the enter key or by pressing the send icon.

More features will be added as other components for this plugin are added. I have added a function stub for the bookmark button for now and the drop down icon is purely cosmetic at the moment.

Reviewed By: jknoxville

Differential Revision: D16183223

fbshipit-source-id: 0313d8c6e3a967c9400b9e9d3f24960e6a021a8c
This commit is contained in:
Benjamin Elo
2019-07-11 07:40:47 -07:00
committed by Facebook Github Bot
parent df6c485b6b
commit 9f1f34bd99
3 changed files with 118 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
*/
import {FlipperPlugin, FlexColumn} from 'flipper';
import SearchBar from './components/SearchBar';
type State = {||};
@@ -43,12 +44,19 @@ export default class extends FlipperPlugin<State, {}, PersistedState> {
}
};
navigateTo = (query: string) => {
this.getDevice().then(device => {
device.navigateToLocation(query);
});
};
render() {
return (
<FlexColumn>
{this.props.persistedState.data.map((d, i) => (
<div key={i}>{JSON.stringify(d)}</div>
))}
<SearchBar
onNavigate={this.navigateTo}
onFavorite={(query: string) => {}}
/>
</FlexColumn>
);
}