From 6ba78c1445e4e787b906f69270ff938cb9cb8623 Mon Sep 17 00:00:00 2001 From: "satyajit.happy" Date: Sun, 19 May 2019 22:13:01 +0200 Subject: [PATCH] Remove incorrect use of react-native-screens --- src/App.tsx | 4 ---- src/components/Card.tsx | 15 ++------------- src/components/Stack.tsx | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f05a31f..c4a11ca 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { View, Text, Button, StyleSheet } from 'react-native'; -import { useScreens } from 'react-native-screens'; import Stack, { SceneProps, Route } from './components/Stack'; import Card from './components/Card'; import { SlideFromRightIOS } from './TransitionConfigs/TransitionPresets'; @@ -27,7 +26,6 @@ export default class App extends React.Component<{}, State> { return ( this.setState(state => ({ @@ -73,8 +71,6 @@ export default class App extends React.Component<{}, State> { } } -useScreens(true); - const styles = StyleSheet.create({ item: { margin: 8, diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 7eb4dff..a7993c5 100755 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -5,7 +5,6 @@ import { PanGestureHandler, State as GestureState, } from 'react-native-gesture-handler'; -import { Screen } from 'react-native-screens'; import { InterpolationProps, InterpolatedStyle, @@ -15,7 +14,6 @@ import memoize from '../utils/memoize'; type Props = { focused: boolean; - stale: boolean; closing?: boolean; next?: Animated.Node; current: Animated.Value; @@ -346,7 +344,6 @@ export default class Card extends React.Component { render() { const { focused, - stale, layout, current, next, @@ -386,13 +383,7 @@ export default class Card extends React.Component { importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'} style={[styles.card, cardStyle]} > - - {children} - + {children} @@ -407,12 +398,10 @@ const styles = StyleSheet.create({ shadowRadius: 5, shadowColor: '#000', backgroundColor: 'white', + overflow: 'hidden', }, overlay: { ...StyleSheet.absoluteFillObject, backgroundColor: '#000', }, - screen: { - flex: 1, - }, }); diff --git a/src/components/Stack.tsx b/src/components/Stack.tsx index 3b1fe33..011a5bc 100755 --- a/src/components/Stack.tsx +++ b/src/components/Stack.tsx @@ -8,7 +8,6 @@ export type Layout = { width: number; height: number }; export type SceneProps = { focused: boolean; - stale: boolean; route: T; layout: Layout; current: Animated.Value; @@ -77,16 +76,21 @@ export default class Stack extends React.Component< {routes.map((route, index, self) => { const focused = index === self.length - 1; - return renderScene( - { - focused, - stale: index !== self.length - 2 && focused, - route, - layout, - current: progress[route.key], - next: self[index + 1] ? progress[self[index + 1].key] : undefined, - }, - index + return ( + + {renderScene( + { + focused, + route, + layout, + current: progress[route.key], + next: self[index + 1] + ? progress[self[index + 1].key] + : undefined, + }, + index + )} + ); })} @@ -97,5 +101,6 @@ export default class Stack extends React.Component< const styles = StyleSheet.create({ container: { flex: 1, + overflow: 'hidden', }, });