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

Commit 4f6d578

Browse files
committed
🚧 (example) improve instagram example
1 parent f3d69aa commit 4f6d578

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

example/src/App.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Instagram } from './canals/Instagram';
33
import { SignIn } from './canals/SignIn';
44
import { FullScreenPortal } from 'react-gondola';
55
import { View, TouchableOpacity, Text } from 'react-native';
6+
import { Navigation } from 'react-gondola/Navigation';
67

78
interface State {
89
example: null | 'SignIn' | 'Instagram';
@@ -44,9 +45,19 @@ export default class App extends Component<{}, State> {
4445
const Example = EXAMPLES[this.state.example];
4546

4647
return (
47-
<FullScreenPortal>
48-
<Example />
49-
</FullScreenPortal>
48+
<>
49+
<FullScreenPortal>
50+
<Example />
51+
</FullScreenPortal>
52+
<TouchableOpacity
53+
style={{ position: 'absolute', bottom: 8, right: 8 }}
54+
onPress={Navigation.instance.back}
55+
>
56+
<View style={{ backgroundColor: 'black', borderRadius: 4 }}>
57+
<Text style={{ color: 'white', margin: 4 }}>Go Back</Text>
58+
</View>
59+
</TouchableOpacity>
60+
</>
5061
);
5162
}
5263
}

example/src/canals/Instagram/Instagram.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ProfilePage } from './ProfilePage';
33
import { PostPage } from './PostPage';
44
import { PostSneakPeek } from './PostSneakPeek';
55
import { Screen, Canal } from 'react-gondola';
6-
import { CardSkewUp } from 'react-gondola/transitions';
6+
import { CardSkewUp, SlideLeft } from 'react-gondola/transitions';
77
import { getRandomUser } from './getRandomUser';
88

99
interface State {
@@ -49,6 +49,10 @@ export class Instagram extends Component<Props, State> {
4949
Component={PostSneakPeek}
5050
Transitioner={CardSkewUp}
5151
visible={this.state.isSneakPeeking && !!this.state.selectedPost}
52+
onBack={() => {
53+
debugger;
54+
this.setState({ selectedPost: null, isSneakPeeking: false });
55+
}}
5256
props={{
5357
user: this.user,
5458
post: this.state.selectedPost,
@@ -57,8 +61,12 @@ export class Instagram extends Component<Props, State> {
5761
<Screen
5862
name="post"
5963
Component={PostPage}
60-
Transitioner={CardSkewUp}
64+
Transitioner={SlideLeft}
6165
visible={!this.state.isSneakPeeking && !!this.state.selectedPost}
66+
onBack={() => {
67+
debugger;
68+
this.setState({ selectedPost: null, isSneakPeeking: false });
69+
}}
6270
props={{
6371
user: this.user,
6472
post: this.state.selectedPost,

example/src/canals/Instagram/PostSneakPeek.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ const styles = StyleSheet.create({
3939
},
4040
container: {
4141
marginHorizontal: SCREEN_MARGIN,
42+
shadowColor: '#000',
43+
shadowOffset: {
44+
width: 0,
45+
height: 2,
46+
},
47+
shadowOpacity: 0.25,
48+
shadowRadius: 3.84,
49+
elevation: 5,
4250
},
4351
});
4452

example/src/canals/Instagram/ProfilePage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const POST_SIZE = SCREEN_WIDTH / 3;
1616

1717
const styles = StyleSheet.create({
1818
container: {
19+
backgroundColor: 'white',
1920
flex: 1,
2021
},
2122
header: {

src/transitions/CardSkewUp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class CardSkewUp extends TransitionComponent {
9898
pointerEvents={this.state.hidden ? 'none' : 'auto'}
9999
style={[
100100
StyleSheet.absoluteFill,
101-
{ backgroundColor: '#00000050', alignItems: 'center', justifyContent: 'center' },
101+
{ backgroundColor: '#000000aa', alignItems: 'center', justifyContent: 'center' },
102102
{ opacity: sub(new Value(1), this.trans) },
103103
]}
104104
>

0 commit comments

Comments
 (0)