From bedfd24bfa9e1e7cbb69cd60e250162b2fb8fd7e Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Sun, 3 Jun 2018 16:17:04 +0200 Subject: [PATCH] refactor: remove extra view wrapper from portal --- src/components/Portal/PortalHost.js | 39 +- .../__snapshots__/Portal.test.js.snap | 18 +- .../__snapshots__/Snackbar.test.js.snap | 816 +++++++++--------- 3 files changed, 400 insertions(+), 473 deletions(-) diff --git a/src/components/Portal/PortalHost.js b/src/components/Portal/PortalHost.js index 479859a..8b4f4f0 100644 --- a/src/components/Portal/PortalHost.js +++ b/src/components/Portal/PortalHost.js @@ -1,13 +1,11 @@ /* @flow */ import * as React from 'react'; -import { View, StyleSheet } from 'react-native'; import PortalManager from './PortalManager'; import createReactContext, { type Context } from 'create-react-context'; type Props = { children: React.Node, - style?: any, }; type Operation = @@ -95,33 +93,20 @@ export default class PortalHost extends React.Component { render() { return ( - - { + this._manager = c; }} - > - {this.props.children} - - { - this._manager = c; - }} - /> - - + /> + ); } } - -const styles = StyleSheet.create({ - container: { - flex: 1, - }, -}); diff --git a/src/components/__tests__/__snapshots__/Portal.test.js.snap b/src/components/__tests__/__snapshots__/Portal.test.js.snap index 6970257..90ffcd0 100644 --- a/src/components/__tests__/__snapshots__/Portal.test.js.snap +++ b/src/components/__tests__/__snapshots__/Portal.test.js.snap @@ -1,24 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders portal with siblings 1`] = ` - +Array [ Outside content - + , Portal content - - + , +] `; diff --git a/src/components/__tests__/__snapshots__/Snackbar.test.js.snap b/src/components/__tests__/__snapshots__/Snackbar.test.js.snap index 60f8836..d4e4857 100644 --- a/src/components/__tests__/__snapshots__/Snackbar.test.js.snap +++ b/src/components/__tests__/__snapshots__/Snackbar.test.js.snap @@ -4,119 +4,107 @@ exports[`renders not visible snackbar with content 1`] = ` - - - - - Snackbar content - - + } + > + Snackbar content + - - + + `; @@ -124,125 +112,113 @@ exports[`renders snackbar with Text as a child 1`] = ` - - - - - Snackbar content - + Snackbar content - + - - + + `; @@ -250,226 +226,214 @@ exports[`renders snackbar with action button 1`] = ` - - + + Snackbar content + - - Snackbar content - - - - UNDO - - + UNDO + - - + + `; @@ -477,118 +441,106 @@ exports[`renders snackbar with content 1`] = ` - - - - - Snackbar content - - + } + > + Snackbar content + - - + + `;