Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit 03feed7

Browse files
committed
🐛 (Observers) fix typing errors after mobx-reaxt update
1 parent fb4c20b commit 03feed7

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

src/FullScreenPortal.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component as ReactComponent, Fragment } from 'react';
22
import { View, StyleSheet } from 'react-native';
3-
import { Observer } from 'mobx-react/native';
3+
import { Observer } from 'mobx-react';
44
import { fromStream } from 'mobx-utils';
55
import { Navigation } from './Navigation';
66

@@ -15,13 +15,19 @@ export class FullScreenPortal extends ReactComponent {
1515
{() => {
1616
if (this.fullScreenStack.current) {
1717
return (
18-
this.fullScreenStack.current &&
19-
this.fullScreenStack.current.map(({ Component, name, isAuthorized }) => (
20-
<Component isAuthorized={isAuthorized} key={name} />
21-
))
18+
<Fragment>
19+
{this.fullScreenStack.current &&
20+
this.fullScreenStack.current.map(({ Component, name, isAuthorized }) => (
21+
<Component isAuthorized={isAuthorized} key={name} />
22+
))}
23+
</Fragment>
2224
);
2325
}
24-
return null;
26+
/**
27+
* @todo Improve typing of <Observer /> to accept null JSXElement.
28+
* Expected: `return null;`
29+
*/
30+
return <Fragment />;
2531
}}
2632
</Observer>
2733
</View>

src/createCanal.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { ComponentType, Component as ReactComponent } from 'react';
1+
import React, { ComponentType, Component as ReactComponent, Fragment } from 'react';
22
import { ViewStyle, View, StyleSheet, StyleProp } from 'react-native';
3-
import { Observer } from 'mobx-react/native';
3+
import { Observer } from 'mobx-react';
44
import { fromStream } from 'mobx-utils';
55
import { Subject, Observable, ConnectableObservable } from 'rxjs';
66
import { map, distinctUntilChanged, withLatestFrom, publish } from 'rxjs/operators';
@@ -140,11 +140,13 @@ export const createCanal = <
140140
return (
141141
<View style={this.props.style}>
142142
<Observer>
143-
{() =>
144-
this.stack.current.map(({ name, Component, isAuthorized }) => (
145-
<Component key={name} isAuthorized={isAuthorized} />
146-
))
147-
}
143+
{() => (
144+
<Fragment>
145+
{this.stack.current.map(({ name, Component, isAuthorized }) => (
146+
<Component key={name} isAuthorized={isAuthorized} />
147+
))}
148+
</Fragment>
149+
)}
148150
</Observer>
149151
</View>
150152
);

0 commit comments

Comments
 (0)