A bug was discovered in d17cc9fa which would raise a failure to push
into the browser's history if a base href was defined. Fix the failure
by removing react-router. Anyway, the usage of react-router was
incorrect because the app must hit the server infrastructure when it
enters a room because the server will choose the very app version then.
This commit is contained in:
Lyubomir Marinov
2017-01-15 18:28:02 -06:00
parent 856732abab
commit ba3d65c01f
6 changed files with 113 additions and 203 deletions

View File

@@ -1,12 +1,9 @@
/* global __DEV__ */
import React from 'react';
import { Linking, Navigator } from 'react-native';
import { Provider } from 'react-redux';
import { Linking } from 'react-native';
import { Platform } from '../../base/react';
import { _getRouteToRender } from '../functions';
import { AbstractApp } from './AbstractApp';
/**
@@ -32,7 +29,6 @@ export class App extends AbstractApp {
super(props);
// Bind event handlers so they are only bound once for every instance.
this._navigatorRenderScene = this._navigatorRenderScene.bind(this);
this._onLinkingURL = this._onLinkingURL.bind(this);
// In the Release configuration, React Native will (intentionally) throw
@@ -70,47 +66,6 @@ export class App extends AbstractApp {
super.componentWillUnmount();
}
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const store = this.props.store;
/* eslint-disable brace-style, react/jsx-no-bind */
return (
<Provider store = { store }>
<Navigator
initialRoute = { _getRouteToRender(store.getState) }
ref = { navigator => { this.navigator = navigator; } }
renderScene = { this._navigatorRenderScene } />
</Provider>
);
/* eslint-enable brace-style, react/jsx-no-bind */
}
/**
* Navigates to a specific Route (via platform-specific means).
*
* @param {Route} route - The Route to which to navigate.
* @returns {void}
*/
_navigate(route) {
const navigator = this.navigator;
// TODO Currently, the replace method doesn't support animation. Work
// towards adding it is done in
// https://github.com/facebook/react-native/issues/1981
// XXX React Native's Navigator adds properties to the route it's
// provided with. Clone the specified route in order to prevent its
// modification.
navigator && navigator.replace({ ...route });
}
/**
* Attempts to disable the use of React Native
* {@link ExceptionsManager#handleException} on platforms and in
@@ -149,24 +104,6 @@ export class App extends AbstractApp {
}
}
/**
* Renders the scene identified by a specific route in the Navigator of this
* instance.
*
* @param {Object} route - The route which identifies the scene to be
* rendered in the associated Navigator. In the fashion of NavigatorIOS, the
* specified route is expected to define a value for its component property
* which is the type of React component to be rendered.
* @private
* @returns {ReactElement}
*/
_navigatorRenderScene(route) {
// We started with NavigatorIOS and then switched to Navigator in order
// to support Android as well. In order to reduce the number of
// modifications, accept the same format of route definition.
return this._createElement(route.component, {});
}
/**
* Notified by React's Linking API that a specific URL registered to be
* handled by this App was activated.