[FIX] Showing blank screen on share extension if the user is not logged in (#4207)

* [FIX] Redirect not logged users to WithoutServersView

* minor tweak

* [FIX] Redirect not logged users to WithoutServersView

* minor tweak

* fix the init

* update yarn.lock

Co-authored-by: Alex Junior <alexalexandrejr@gmail.com>
This commit is contained in:
Reinaldo Neto 2022-05-27 14:11:26 -03:00 committed by GitHub
parent 992e43815d
commit 53aaae5d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -91,6 +91,8 @@ export const App = ({ root }: any) => (
); );
class Root extends React.Component<{}, IState> { class Root extends React.Component<{}, IState> {
private mounted = false;
constructor(props: any) { constructor(props: any) {
super(props); super(props);
const { width, height, scale, fontScale } = Dimensions.get('screen'); const { width, height, scale, fontScale } = Dimensions.get('screen');
@ -107,6 +109,10 @@ class Root extends React.Component<{}, IState> {
this.init(); this.init();
} }
componentDidMount() {
this.mounted = true;
}
componentWillUnmount(): void { componentWillUnmount(): void {
closeShareExtension(); closeShareExtension();
unsubscribeTheme(); unsubscribeTheme();
@ -119,8 +125,11 @@ class Root extends React.Component<{}, IState> {
await localAuthenticate(currentServer); await localAuthenticate(currentServer);
this.setState({ root: 'inside' }); this.setState({ root: 'inside' });
await shareExtensionInit(currentServer); await shareExtensionInit(currentServer);
} else { } else if (this.mounted) {
this.setState({ root: 'outside' }); this.setState({ root: 'outside' });
} else {
// @ts-ignore
this.state.root = 'outside';
} }
const state = Navigation.navigationRef.current?.getRootState(); const state = Navigation.navigationRef.current?.getRootState();

View File

@ -8014,7 +8014,7 @@ detect-port@^1.3.0:
address "^1.0.1" address "^1.0.1"
debug "^2.6.0" debug "^2.6.0"
detox@^19.7.0: detox@19.7.0:
version "19.7.0" version "19.7.0"
resolved "https://registry.yarnpkg.com/detox/-/detox-19.7.0.tgz#278994beb98b959d21f1d4f393c628005c893122" resolved "https://registry.yarnpkg.com/detox/-/detox-19.7.0.tgz#278994beb98b959d21f1d4f393c628005c893122"
integrity sha512-70a6IQCBQCJI21ITdK+qGUQ7fQL/CeOW+i0Vdr0ZFN5B5RylSE9d5shoJBtg2nb8XYG+S9BLqhn+uE02Nqymng== integrity sha512-70a6IQCBQCJI21ITdK+qGUQ7fQL/CeOW+i0Vdr0ZFN5B5RylSE9d5shoJBtg2nb8XYG+S9BLqhn+uE02Nqymng==