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

Commit 46bf544

Browse files
committed
🚧 (example) add Instagram loop
1 parent 4f6d578 commit 46bf544

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

example/src/canals/Instagram/Instagram.tsx

Lines changed: 16 additions & 4 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, SlideLeft } from 'react-gondola/transitions';
6+
import { CardSkewUp, SlideLeft, SlideUp } from 'react-gondola/transitions';
77
import { getRandomUser } from './getRandomUser';
88

99
interface State {
@@ -35,7 +35,6 @@ export class Instagram extends Component<Props, State> {
3535
<Screen
3636
name="profile"
3737
Component={ProfilePage}
38-
Transitioner={CardSkewUp}
3938
visible
4039
props={{
4140
selectPost: (selectedPost: any) => this.setState({ selectedPost }),
@@ -50,7 +49,6 @@ export class Instagram extends Component<Props, State> {
5049
Transitioner={CardSkewUp}
5150
visible={this.state.isSneakPeeking && !!this.state.selectedPost}
5251
onBack={() => {
53-
debugger;
5452
this.setState({ selectedPost: null, isSneakPeeking: false });
5553
}}
5654
props={{
@@ -64,12 +62,26 @@ export class Instagram extends Component<Props, State> {
6462
Transitioner={SlideLeft}
6563
visible={!this.state.isSneakPeeking && !!this.state.selectedPost}
6664
onBack={() => {
67-
debugger;
6865
this.setState({ selectedPost: null, isSneakPeeking: false });
6966
}}
7067
props={{
7168
user: this.user,
7269
post: this.state.selectedPost,
70+
selectUser: (user: any) => {
71+
this.setState({ selectedUser: user });
72+
},
73+
}}
74+
/>
75+
<Screen
76+
name="nextProfile"
77+
Component={Instagram}
78+
Transitioner={SlideUp}
79+
visible={!!this.state.selectedUser}
80+
onBack={() => {
81+
this.setState({ selectedUser: null });
82+
}}
83+
props={{
84+
user: this.state.selectedUser,
7385
}}
7486
/>
7587
</Canal>

example/src/canals/Instagram/PostPage.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import { StyleSheet, SafeAreaView, Text, View, Dimensions } from 'react-native';
2+
import { StyleSheet, SafeAreaView, Text, View, Dimensions, TouchableOpacity } from 'react-native';
33
import { getRandomComments } from './getRandomComment';
44

55
const { width: POST_SIZE } = Dimensions.get('window');
@@ -56,6 +56,7 @@ const styles = StyleSheet.create({
5656
interface Props {
5757
user: any;
5858
post: any;
59+
selectUser: (user: any) => any;
5960
}
6061

6162
export class PostPage extends Component<Props> {
@@ -79,9 +80,15 @@ export class PostPage extends Component<Props> {
7980
</View>
8081
{comments.map(comment => (
8182
<View style={styles.comment} key={comment.id}>
82-
<View style={[styles.avatar, { backgroundColor: comment.author.color }]}>
83-
<Text style={styles.emoji}>{comment.author.emoji}</Text>
84-
</View>
83+
<TouchableOpacity
84+
onPress={() => {
85+
this.props.selectUser(comment.author);
86+
}}
87+
>
88+
<View style={[styles.avatar, { backgroundColor: comment.author.color }]}>
89+
<Text style={styles.emoji}>{comment.author.emoji}</Text>
90+
</View>
91+
</TouchableOpacity>
8592
<View style={styles.commentComment}>
8693
<Text style={styles.commentAuthor}>{comment.author.name}</Text>
8794
<Text style={styles.commentCommentComment}>{comment.comment}</Text>

0 commit comments

Comments
 (0)