Search code examples
react-nativesearchbarreact-native-navigation-v2

SearchBar react-native-navigation V2 Android


I am using Wix's navigation V2, I want to add a search field in the top bar, this is how I am pushing the screen that shows a list of item

 Navigation.push(this.props.componentId, {
      component: {
        name: 'app.SearchEvent',
        passProps: {
          eventName: this.state.eventName,
        },
        options: {
          topBar: {
            drawBehind: false,
            searchBar: true,
            searchBarHiddenWhenScrolling: true,
            searchBarPlaceholder: 'Recherche...',
          },
        },
      },
    });

I've seen an example inplayground of the docs but it's also not working in Android, playground example So how could I add it?


Solution

  • Considering current version, 2.7.1, and according to the official documentation (https://wix.github.io/react-native-navigation/#/docs/styling?id=ios-specific-options), those properties are iOS +11 specific. They're not meant to work on Android.

        searchBar: true, // iOS 11+ native UISearchBar inside topBar
        searchBarHiddenWhenScrolling: true,
        searchBarPlaceholder: 'Search', // iOS 11+ SearchBar placeholder