Skip to content
This repository was archived by the owner on Nov 26, 2019. It is now read-only.

Commit b20af49

Browse files
committed
Remove incorrect use of react-native-screens
1 parent ff73720 commit b20af49

3 files changed

Lines changed: 18 additions & 28 deletions

File tree

src/App.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import { View, Text, Button, StyleSheet } from 'react-native';
3-
import { useScreens } from 'react-native-screens';
43
import Stack, { SceneProps, Route } from './components/Stack';
54
import Card from './components/Card';
65
import { SlideFromRightIOS } from './TransitionConfigs/TransitionPresets';
@@ -27,7 +26,6 @@ export default class App extends React.Component<{}, State> {
2726
return (
2827
<Card
2928
{...rest}
30-
key={route.key}
3129
closing={this.state.closing.includes(route.key)}
3230
onClose={() =>
3331
this.setState(state => ({
@@ -73,8 +71,6 @@ export default class App extends React.Component<{}, State> {
7371
}
7472
}
7573

76-
useScreens(true);
77-
7874
const styles = StyleSheet.create({
7975
item: {
8076
margin: 8,

src/components/Card.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
PanGestureHandler,
66
State as GestureState,
77
} from 'react-native-gesture-handler';
8-
import { Screen } from 'react-native-screens';
98
import {
109
InterpolationProps,
1110
InterpolatedStyle,
@@ -15,7 +14,6 @@ import memoize from '../utils/memoize';
1514

1615
type Props = {
1716
focused: boolean;
18-
stale: boolean;
1917
closing?: boolean;
2018
next?: Animated.Node<number>;
2119
current: Animated.Value<number>;
@@ -346,7 +344,6 @@ export default class Card extends React.Component<Props> {
346344
render() {
347345
const {
348346
focused,
349-
stale,
350347
layout,
351348
current,
352349
next,
@@ -386,13 +383,7 @@ export default class Card extends React.Component<Props> {
386383
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
387384
style={[styles.card, cardStyle]}
388385
>
389-
<Screen
390-
// @ts-ignore
391-
active={stale ? 0 : 1}
392-
style={styles.screen}
393-
>
394-
{children}
395-
</Screen>
386+
{children}
396387
</Animated.View>
397388
</PanGestureHandler>
398389
</React.Fragment>
@@ -407,12 +398,10 @@ const styles = StyleSheet.create({
407398
shadowRadius: 5,
408399
shadowColor: '#000',
409400
backgroundColor: 'white',
401+
overflow: 'hidden',
410402
},
411403
overlay: {
412404
...StyleSheet.absoluteFillObject,
413405
backgroundColor: '#000',
414406
},
415-
screen: {
416-
flex: 1,
417-
},
418407
});

src/components/Stack.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export type Layout = { width: number; height: number };
88

99
export type SceneProps<T> = {
1010
focused: boolean;
11-
stale: boolean;
1211
route: T;
1312
layout: Layout;
1413
current: Animated.Value<number>;
@@ -77,16 +76,21 @@ export default class Stack<T extends Route> extends React.Component<
7776
{routes.map((route, index, self) => {
7877
const focused = index === self.length - 1;
7978

80-
return renderScene(
81-
{
82-
focused,
83-
stale: index !== self.length - 2 && focused,
84-
route,
85-
layout,
86-
current: progress[route.key],
87-
next: self[index + 1] ? progress[self[index + 1].key] : undefined,
88-
},
89-
index
79+
return (
80+
<View key={route.key} style={StyleSheet.absoluteFill}>
81+
{renderScene(
82+
{
83+
focused,
84+
route,
85+
layout,
86+
current: progress[route.key],
87+
next: self[index + 1]
88+
? progress[self[index + 1].key]
89+
: undefined,
90+
},
91+
index
92+
)}
93+
</View>
9094
);
9195
})}
9296
</View>
@@ -97,5 +101,6 @@ export default class Stack<T extends Route> extends React.Component<
97101
const styles = StyleSheet.create({
98102
container: {
99103
flex: 1,
104+
overflow: 'hidden',
100105
},
101106
});

0 commit comments

Comments
 (0)