Skip to content

Commit 5429e5e

Browse files
authored
Import legacy pressables in examples (#4009)
## Description Legacy examples imported the new v3 pressable instead of legacy pressable. This PR fixes the imports ## Test plan Look what pressable is imported in the legacy examples
1 parent 41fbd37 commit 5429e5e

3 files changed

Lines changed: 23 additions & 26 deletions

File tree

apps/common-app/src/legacy/release_tests/gesturizedPressable/testingBase.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ import {
33
StyleSheet,
44
Text,
55
View,
6-
Pressable,
6+
Pressable as RNPressable,
77
PressableProps as RNPressableProps,
88
} from 'react-native';
99
import {
10-
LegacyPressable as GesturizedPressable,
10+
LegacyPressable as GHPressable,
1111
LegacyPressableProps as GHPressableProps,
1212
} from 'react-native-gesture-handler';
1313

1414
const TestingBase = (props: GHPressableProps & RNPressableProps) => (
1515
<>
16-
<GesturizedPressable {...props}>
16+
<GHPressable {...props}>
1717
<View style={styles.textWrapper}>
18-
<Text style={styles.text}>Gesturized pressable!</Text>
18+
<Text style={styles.text}>RNGH pressable!</Text>
1919
</View>
20-
</GesturizedPressable>
21-
<Pressable {...props}>
20+
</GHPressable>
21+
<RNPressable {...props}>
2222
<View style={styles.textWrapper}>
23-
<Text style={styles.text}>Legacy pressable!</Text>
23+
<Text style={styles.text}>RN pressable!</Text>
2424
</View>
25-
</Pressable>
25+
</RNPressable>
2626
</>
2727
);
2828

apps/common-app/src/legacy/release_tests/nestedPressables/index.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import React from 'react';
22
import {
3-
Pressable as LegacyPressable,
3+
Pressable as RNPressable,
44
PressableStateCallbackType,
55
StyleSheet,
66
Text,
77
View,
88
} from 'react-native';
9-
import {
10-
ScrollView,
11-
Pressable as GesturizedPressable,
12-
} from 'react-native-gesture-handler';
9+
import { ScrollView, LegacyPressable } from 'react-native-gesture-handler';
1310

1411
export default function Example() {
1512
return (
@@ -50,56 +47,56 @@ const outerStyle = ({ pressed }: PressableStateCallbackType) => [
5047

5148
function GesturizedBoxes() {
5249
return (
53-
<GesturizedPressable
50+
<LegacyPressable
5451
style={outerStyle}
5552
testID="outer"
5653
onPressIn={() => console.log('[outer] onPressIn')}
5754
onPressOut={() => console.log('[outer] onPressOut')}
5855
onPress={() => console.log('[outer] onPress')}
5956
onLongPress={() => console.log('[outer] onLongPress')}>
60-
<GesturizedPressable
57+
<LegacyPressable
6158
style={middleStyle}
6259
testID="middle"
6360
onPressIn={() => console.log('[middle] onPressIn')}
6461
onPressOut={() => console.log('[middle] onPressOut')}
6562
onPress={() => console.log('[middle] onPress')}
6663
onLongPress={() => console.log('[middle] onLongPress')}>
67-
<GesturizedPressable
64+
<LegacyPressable
6865
style={innerStyle}
6966
testID="inner"
7067
onPressIn={() => console.log('[inner] onPressIn')}
7168
onPressOut={() => console.log('[inner] onPressOut')}
7269
onPress={() => console.log('[inner] onPress')}
7370
onLongPress={() => console.log('[inner] onLongPress')}
7471
/>
75-
</GesturizedPressable>
76-
</GesturizedPressable>
72+
</LegacyPressable>
73+
</LegacyPressable>
7774
);
7875
}
7976

8077
function LegacyBoxes() {
8178
return (
82-
<LegacyPressable
79+
<RNPressable
8380
style={outerStyle}
8481
onPressIn={() => console.log('[outer] onPressIn')}
8582
onPressOut={() => console.log('[outer] onPressOut')}
8683
onPress={() => console.log('[outer] onPress')}
8784
onLongPress={() => console.log('[outer] onLongPress')}>
88-
<LegacyPressable
85+
<RNPressable
8986
style={middleStyle}
9087
onPressIn={() => console.log('[middle] onPressIn')}
9188
onPressOut={() => console.log('[middle] onPressOut')}
9289
onPress={() => console.log('[middle] onPress')}
9390
onLongPress={() => console.log('[middle] onLongPress')}>
94-
<LegacyPressable
91+
<RNPressable
9592
style={innerStyle}
9693
onPressIn={() => console.log('[inner] onPressIn')}
9794
onPressOut={() => console.log('[inner] onPressOut')}
9895
onPress={() => console.log('[inner] onPress')}
9996
onLongPress={() => console.log('[inner] onLongPress')}
10097
/>
101-
</LegacyPressable>
102-
</LegacyPressable>
98+
</RNPressable>
99+
</RNPressable>
103100
);
104101
}
105102

apps/common-app/src/legacy/v2_api/pressable/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { StyleSheet, Text, View } from 'react-native';
3-
import { Pressable } from 'react-native-gesture-handler';
3+
import { LegacyPressable } from 'react-native-gesture-handler';
44

55
const SECTION_RADIUS = 40;
66
const BASE_SIZE = 120;
@@ -33,7 +33,7 @@ export default function PressableExample() {
3333
<View style={{ flex: 1, backgroundColor: 'white' }}>
3434
<View style={styles.pressRectContainer}>
3535
<View style={styles.hitRectContainer}>
36-
<Pressable
36+
<LegacyPressable
3737
style={({ pressed }) =>
3838
pressed ? styles.highlight : styles.pressable
3939
}
@@ -48,7 +48,7 @@ export default function PressableExample() {
4848
<View style={styles.textWrapper}>
4949
<Text style={styles.text}>Pressable!</Text>
5050
</View>
51-
</Pressable>
51+
</LegacyPressable>
5252
<Text style={styles.rectText}>Hit Rect</Text>
5353
</View>
5454
<Text style={styles.rectText}>Press Rect</Text>

0 commit comments

Comments
 (0)