Remove diacritics during search

parent 9a33b65f
......@@ -15,7 +15,6 @@ import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage;
import io.sentry.RNSentryPackage;
import com.azendoo.reactnativesnackbar.SnackbarPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
import com.BV.LinearGradient.LinearGradientPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
......@@ -44,7 +43,6 @@ public class MainApplication extends Application implements ShareApplication, Re
new RNSharePackage(),
new RNSentryPackage(),
new SnackbarPackage(),
new ReactNativeI18n(),
new RNFirebasePackage(),
new RNFirebaseMessagingPackage(),
new RNFirebaseNotificationsPackage(),
......
......@@ -6,6 +6,7 @@ import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
import Icon from 'react-native-vector-icons/MaterialIcons';
import Snackbar from 'react-native-snackbar';
import unorm from 'unorm';
import styles from './style/EventAdminScreen';
import Colors from '../../style/Colors';
......@@ -89,9 +90,12 @@ class EventAdminScreen extends Component {
return result;
};
cleanSearchTerm = term => unorm.nfd(term.toLowerCase()).replace(/[\u0300-\u036f]/g, '');
containsSearchKey = (pk) => {
const name = this.state.registrations[pk].name.toLowerCase();
return name.indexOf(this.state.searchKey.toLowerCase()) >= 0;
const name = this.cleanSearchTerm(this.state.registrations[pk].name);
console.log('name', name);
return name.indexOf(this.cleanSearchTerm(this.state.searchKey)) >= 0;
};
handleRefresh = () => {
......
......@@ -8518,6 +8518,11 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
unorm@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.5.0.tgz#01fa9b76f1c60f7916834605c032aa8962c3f00a"
integrity sha512-sMfSWoiRaXXeDZSXC+YRZ23H4xchQpwxjpw1tmfR+kgbBCaOgln4NI0LXejJIhnBuKINrB3WRn+ZI8IWssirVw==
unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment