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

Commit

Permalink
Remove incorrect use of react-native-screens
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed May 19, 2019
1 parent ff73720 commit 6ba78c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 28 deletions.
4 changes: 0 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -27,7 +26,6 @@ export default class App extends React.Component<{}, State> {
return (
<Card
{...rest}
key={route.key}
closing={this.state.closing.includes(route.key)}
onClose={() =>
this.setState(state => ({
Expand Down Expand Up @@ -73,8 +71,6 @@ export default class App extends React.Component<{}, State> {
}
}

useScreens(true);

const styles = StyleSheet.create({
item: {
margin: 8,
Expand Down
15 changes: 2 additions & 13 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
PanGestureHandler,
State as GestureState,
} from 'react-native-gesture-handler';
import { Screen } from 'react-native-screens';
import {
InterpolationProps,
InterpolatedStyle,
Expand All @@ -15,7 +14,6 @@ import memoize from '../utils/memoize';

type Props = {
focused: boolean;
stale: boolean;
closing?: boolean;
next?: Animated.Node<number>;
current: Animated.Value<number>;
Expand Down Expand Up @@ -346,7 +344,6 @@ export default class Card extends React.Component<Props> {
render() {
const {
focused,
stale,
layout,
current,
next,
Expand Down Expand Up @@ -386,13 +383,7 @@ export default class Card extends React.Component<Props> {
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
style={[styles.card, cardStyle]}
>
<Screen
// @ts-ignore
active={stale ? 0 : 1}
style={styles.screen}
>
{children}
</Screen>
{children}
</Animated.View>
</PanGestureHandler>
</React.Fragment>
Expand All @@ -407,12 +398,10 @@ const styles = StyleSheet.create({
shadowRadius: 5,
shadowColor: '#000',
backgroundColor: 'white',
overflow: 'hidden',
},
overlay: {
...StyleSheet.absoluteFillObject,
backgroundColor: '#000',
},
screen: {
flex: 1,
},
});
27 changes: 16 additions & 11 deletions src/components/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export type Layout = { width: number; height: number };

export type SceneProps<T> = {
focused: boolean;
stale: boolean;
route: T;
layout: Layout;
current: Animated.Value<number>;
Expand Down Expand Up @@ -77,16 +76,21 @@ export default class Stack<T extends Route> 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 (
<View key={route.key} active={1} style={StyleSheet.absoluteFill}>
{renderScene(
{
focused,
route,
layout,
current: progress[route.key],
next: self[index + 1]
? progress[self[index + 1].key]
: undefined,
},
index
)}
</View>
);
})}
</View>
Expand All @@ -97,5 +101,6 @@ export default class Stack<T extends Route> extends React.Component<
const styles = StyleSheet.create({
container: {
flex: 1,
overflow: 'hidden',
},
});

0 comments on commit 6ba78c1

Please sign in to comment.