@@ -2,12 +2,12 @@ import React, { ComponentType, Component as ReactComponent } from 'react';
22import { ViewStyle , View , StyleSheet , StyleProp } from 'react-native' ;
33import { Observer } from 'mobx-react/native' ;
44import { fromStream } from 'mobx-utils' ;
5- import { Subject , Observable } from 'rxjs' ;
5+ import { Subject , Observable , ConnectableObservable } from 'rxjs' ;
66import {
77 map ,
88 distinctUntilChanged ,
99 withLatestFrom ,
10- share
10+ publish
1111} from 'rxjs/operators' ;
1212import { Navigation } from './Navigation' ;
1313import { last } from './utils/Array.last' ;
@@ -38,6 +38,8 @@ export const createCanal = <
3838 implements ICanal {
3939 constructor ( props : WithBackContext < CanalComponentProps < Authorizations > > ) {
4040 super ( props ) ;
41+
42+ this . back$ . connect ( ) ;
4143 const { style, backContext, ...nextAuthorizations } = props ;
4244
4345 /**
@@ -108,7 +110,14 @@ export const createCanal = <
108110 )
109111 ) ;
110112
111- back$ : Observable < IBackEvent > = this . props . backContext . back$ . pipe (
113+ /**
114+ * @TODO Pipe operator cannot infer return type as ConnectableObservable.
115+ * See https://github.com/ReactiveX/rxjs/issues/2972.
116+ */
117+ // @ts -ignore
118+ back$ : ConnectableObservable <
119+ IBackEvent
120+ > = this . props . backContext . back$ . pipe (
112121 withLatestFrom ( this . progress$ ) ,
113122 map ( ( [ _ , progress ] ) => {
114123 const currentStop = last ( progress ) ;
@@ -117,7 +126,7 @@ export const createCanal = <
117126 }
118127 return { target : null } ;
119128 } ) ,
120- share ( )
129+ publish ( )
121130 ) ;
122131
123132 shouldComponentUpdate ( {
0 commit comments