Search breaks in react-native release build but not in debug build
See original GitHub issueI’ve been going through the issues like crazy to find something similar to what is happening to me. The closest one I’ve found is #279 and the possible solutions haven’t worked. My app breaks when searching in the release build for some terms, but not when it’s on debug mode. I’ve also gone through the react-native issues and have tried to fix the minify/uglify bugs but haven’t been able to solve the problem I’m having. I get TypeError: undefined is not an object (evaluating 'p._index')
when I call search with ‘maine* maine v* v’ for example. The weird thing is that in debug mode it works as expected, but in the release build it crashes.
Here’s my code for building the index, and my code for searching:
export default {
createSearchIndex: function (items) {
return lunr(function() {
this.ref('id');
this.field('title');
this.field('description');
items
.forEach(item => {
// Adds description index field to the outer object so videos are also
// searchable by description as per requirements.
const data = item && item.data || {};
const description = data.description && data.description.toLowerCase() || '';
const searchableItem = {
...item,
description,
}
this.add(searchableItem);
});
});
},
search: (searchText, searchIndex, videoDocs) => {
const query = searchText
.toLowerCase()
.split(/\s+/)
// Add asterisk to partially match terms: ALA* -> ALASKA, ALAMO, etc...
// this query will give a high positive boost to exact matches, and
// a lower one to partially matched terms.
.map(term => term && `${term}^100 ${term}*^10` || '')
.join(' ')
.trim();
const searchResults = query ?
searchIndex.search(query).map(result => videoDocs[result.ref]) :
[];
return searchResults;
}
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
react-native-video works in debug but not release builds #7855
I expect a screen to render and some audio to play when the app runs. Instead, I see a white screen, hear no...
Read more >React Native app (release build) crashes on start, works fine ...
Looks like it might be a problem with proguard. Its looking for a specific classname, and if it can't find it it can't...
Read more >Create and edit run/debug configurations - Android Developers
Run/debug configurations and template changes apply to the current project only. You can share a run/debug configuration (but not a template) through your ......
Read more >App doesn't work in release apk but works fine in debug mode
First clean the android project, then keep running yarn react-native run-android —variant=release until the app launches without crashing.
Read more >Debugging - React Native
Errors and warnings in development builds are displayed in LogBox inside your app. LogBox is automatically disabled in release (production) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates on using lunr + React Native?
I am quite confident that this issue with React Native was fixed by this PR:
https://github.com/olivernn/lunr.js/pull/361
The PR originally targeted a bug in Safari, and React Native on iOS uses the same JS engine as Safari.