Remove diacritics during search

parent 9a33b65f
...@@ -15,7 +15,6 @@ import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; ...@@ -15,7 +15,6 @@ import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage; import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage;
import io.sentry.RNSentryPackage; import io.sentry.RNSentryPackage;
import com.azendoo.reactnativesnackbar.SnackbarPackage; import com.azendoo.reactnativesnackbar.SnackbarPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
import com.BV.LinearGradient.LinearGradientPackage; import com.BV.LinearGradient.LinearGradientPackage;
import com.oblador.vectoricons.VectorIconsPackage; import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
...@@ -44,7 +43,6 @@ public class MainApplication extends Application implements ShareApplication, Re ...@@ -44,7 +43,6 @@ public class MainApplication extends Application implements ShareApplication, Re
new RNSharePackage(), new RNSharePackage(),
new RNSentryPackage(), new RNSentryPackage(),
new SnackbarPackage(), new SnackbarPackage(),
new ReactNativeI18n(),
new RNFirebasePackage(), new RNFirebasePackage(),
new RNFirebaseMessagingPackage(), new RNFirebaseMessagingPackage(),
new RNFirebaseNotificationsPackage(), new RNFirebaseNotificationsPackage(),
......
...@@ -6,6 +6,7 @@ import { withTranslation } from 'react-i18next'; ...@@ -6,6 +6,7 @@ import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Icon from 'react-native-vector-icons/MaterialIcons'; import Icon from 'react-native-vector-icons/MaterialIcons';
import Snackbar from 'react-native-snackbar'; import Snackbar from 'react-native-snackbar';
import unorm from 'unorm';
import styles from './style/EventAdminScreen'; import styles from './style/EventAdminScreen';
import Colors from '../../style/Colors'; import Colors from '../../style/Colors';
...@@ -89,9 +90,12 @@ class EventAdminScreen extends Component { ...@@ -89,9 +90,12 @@ class EventAdminScreen extends Component {
return result; return result;
}; };
cleanSearchTerm = term => unorm.nfd(term.toLowerCase()).replace(/[\u0300-\u036f]/g, '');
containsSearchKey = (pk) => { containsSearchKey = (pk) => {
const name = this.state.registrations[pk].name.toLowerCase(); const name = this.cleanSearchTerm(this.state.registrations[pk].name);
return name.indexOf(this.state.searchKey.toLowerCase()) >= 0; console.log('name', name);
return name.indexOf(this.cleanSearchTerm(this.state.searchKey)) >= 0;
}; };
handleRefresh = () => { handleRefresh = () => {
......
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
"react-navigation": "3.11.0", "react-navigation": "3.11.0",
"react-redux": "7.0.3", "react-redux": "7.0.3",
"redux": "4.0.1", "redux": "4.0.1",
"redux-saga": "0.16.2" "redux-saga": "0.16.2",
"unorm": "1.5.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-proposal-class-properties": "7.4.4", "@babel/plugin-proposal-class-properties": "7.4.4",
......
...@@ -8518,6 +8518,11 @@ universalify@^0.1.0: ...@@ -8518,6 +8518,11 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== 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: unpipe@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" 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