Я использовал собственный базовый ящик, который отлично работает в режиме отладки, но когда я создал релиз apk, приложение вылетает со следующей ошибкой.
AndroidRuntime: com.facebook.react.common.JavascriptException: null is
not an object (evaluating 's.drawer._root')
код:
closeDrawer = () => {
this.drawer._root && this.drawer._root.close();
};
openDrawer = () => {
this.drawer._root && this.drawer._root.open();
};
<Drawer
ref = {(ref) => {
this.drawer = ref;
}}
type = "overlay"
side = {'left'}
openDrawerOffset = {0.2}
panOpenMask = {0.2}
tapToClose = {true}
content = {
<SideBar
navigator = {this.navigator}
closeDrawer = {() => this.closeDrawer()}
{...this.props}
/>
}
tweenHandler = {(ratio) => ({
main: { opacity: (2 - ratio) / 2 }
})}
onClose = {() => this.closeDrawer()}
>
взгляните на документ реакции о ссылке
If the ref callback is defined as an inline function, it will get called twice during updates, first with null and then again with the DOM element
в вашем обратном вызове closeDrawer и openDrawer this.drawer может быть нулевым, возможно, вам следует добавить некоторые коды, такие как
this.drawer && this.drawer._root && this.drawer._root.close();
this.drawer && this.drawer._root && this.drawer._root.open();