Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/common-app/src/legacy/release_tests/nestedText/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { StyleSheet } from 'react-native';
import {
Text,
LegacyText,
GestureHandlerRootView,
TouchableOpacity,
} from 'react-native-gesture-handler';
Expand All @@ -11,29 +11,29 @@ export default function NestedText() {

return (
<GestureHandlerRootView style={styles.container}>
<Text style={{ fontSize: 30 }}>{`Counter: ${counter}`}</Text>
<LegacyText style={{ fontSize: 30 }}>{`Counter: ${counter}`}</LegacyText>

<TouchableOpacity
onPress={() => {
console.log('Touchable');
setCounter((prev) => prev + 1);
}}>
<Text
<LegacyText
style={[styles.textCommon, styles.outerText]}
onPress={() => {
console.log('Outer text');
setCounter((prev) => prev + 1);
}}>
{'Outer Text '}
<Text
<LegacyText
style={[styles.textCommon, styles.innerText]}
onPress={() => {
console.log('Nested text');
setCounter((prev) => prev + 1);
}}>
{'Nested Text'}
</Text>
</Text>
</LegacyText>
</LegacyText>
</TouchableOpacity>
</GestureHandlerRootView>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ import { PressableStateMachine } from './StateMachine';
const DEFAULT_LONG_PRESS_DURATION = 500;
const IS_TEST_ENV = isTestEnv();

const Pressable = (props: LegacyPressableProps) => {
/**
* @deprecated `LegacyPressable` is deprecated, use `Pressable` instead.
*/
const LegacyPressable = (props: LegacyPressableProps) => {
const {
testOnly_pressed,
hitSlop,
Expand Down Expand Up @@ -390,4 +393,4 @@ const Pressable = (props: LegacyPressableProps) => {
);
};

export default Pressable;
export default LegacyPressable;
11 changes: 9 additions & 2 deletions packages/react-native-gesture-handler/src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
import { GestureObjects as Gesture } from '../handlers/gestures/gestureObjects';
import { GestureDetector } from '../handlers/gestures/GestureDetector';

export const Text = forwardRef(
/**
* @deprecated `LegacyText` is deprecated. Since Gesture Handler 3 you can wrap `Text` with `GestureDetector`.
*/
export const LegacyText = forwardRef(
(
props: RNTextProps,
ref: ForwardedRef<React.ComponentRef<typeof RNText>>
Expand Down Expand Up @@ -73,5 +76,9 @@ export const Text = forwardRef(
);
}
);

/**
* @deprecated `LegacyText` is deprecated. Since Gesture Handler 3 you can wrap `Text` with `GestureDetector`.
*/
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type Text = typeof Text & RNText;
export type LegacyText = typeof LegacyText & RNText;
3 changes: 1 addition & 2 deletions packages/react-native-gesture-handler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export { RotationGestureHandler } from './handlers/RotationGestureHandler';
export { FlingGestureHandler } from './handlers/FlingGestureHandler';
export { default as legacy_createNativeWrapper } from './handlers/createNativeWrapper';
export type { NativeViewGestureHandlerProps } from './handlers/NativeViewGestureHandler';
export { GestureDetector as LegacyGestureDetector } from './handlers/gestures/GestureDetector';
export { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';
export type { TapGestureType as LegacyTapGesture } from './handlers/gestures/tapGesture';
export type { PanGestureType as LegacyPanGesture } from './handlers/gestures/panGesture';
Expand Down Expand Up @@ -107,7 +106,7 @@ export {
LegacyRefreshControl,
} from './components/GestureComponents';

export { Text } from './components/Text';
export { LegacyText } from './components/Text';
export { HoverEffect } from './handlers/gestures/hoverGesture';
export type {
// Events
Expand Down
Loading