ref(base/react/Container): return null for not visible

Now that we no longer hide the filmstrip it is fine to return null
instead of trying to hide with some tricks.
This commit is contained in:
paweldomas 2017-10-19 13:19:32 -05:00 committed by Lyubo Marinov
parent c0a7d6144a
commit 320cfe4745
2 changed files with 11 additions and 23 deletions

View File

@ -7,7 +7,6 @@ import {
View
} from 'react-native';
import { Platform } from '../../';
import AbstractContainer from '../AbstractContainer';
/**
@ -39,28 +38,20 @@ export default class Container extends AbstractContainer {
// visible
if (!visible) {
// FIXME: It turns out that display: none will fail on some Android
// devices, but work on the others (currently fails on Google Pixel)
if (Platform.OS === 'android') {
return null;
}
// Intentionally hide this Container without destroying it.
props.style = {
...props.style,
display: 'none'
};
}
let element = super._render(View, props);
// onClick & touchFeedback
if (visible && (onClick || touchFeedback)) {
element = React.createElement(
touchFeedback ? TouchableHighlight : TouchableWithoutFeedback,
{ onPress: onClick },
if (element && (onClick || touchFeedback)) {
element
);
= React.createElement(
touchFeedback
? TouchableHighlight
: TouchableWithoutFeedback,
{ onPress: onClick },
element);
}
return element;

View File

@ -120,16 +120,13 @@ class Toolbox extends Component {
* @returns {ReactElement}
*/
render() {
if (!this.props._visible) {
return null;
}
return (
<Container
style = {
isNarrowAspectRatio(this)
? styles.toolbarContainerNarrow
: styles.toolbarContainerWide } >
: styles.toolbarContainerWide }
visible = { this.props._visible } >
{
isNarrowAspectRatio(this)
? this._renderSecondaryToolbar()