Skip to content

Commit 55320c0

Browse files
authored
Infra/incubator to2 (#1616)
* Remove old implementation of Incubator.TouchableOpacity for Incubator.TouchableOpacity2 * Update generated types
1 parent 516589c commit 55320c0

File tree

7 files changed

+139
-390
lines changed

7 files changed

+139
-390
lines changed

demo/src/screens/incubatorScreens/TouchableOpacityScreen.js

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,6 @@ class TouchableOpacityScreen extends Component {
1616
this.setState({longPressCounter: this.state.longPressCounter + 1});
1717
};
1818

19-
renderExample(title, props) {
20-
return (
21-
<View row marginT-20 centerV>
22-
<Text text70 marginR-20>
23-
{title}
24-
</Text>
25-
<Incubator.TouchableOpacity
26-
onPress={this.onPress}
27-
onLongPress={this.onLongPress}
28-
backgroundColor={Colors.blue30}
29-
style={{alignItems: 'center', paddingHorizontal: 20, paddingVertical: 8, borderRadius: 50}}
30-
activeOpacity={1}
31-
{...props}
32-
>
33-
<Text white>Button</Text>
34-
</Incubator.TouchableOpacity>
35-
</View>
36-
);
37-
}
38-
3919
renderRNTouchableExample = () => {
4020
return (
4121
<View row centerV marginT-20>
@@ -67,11 +47,7 @@ class TouchableOpacityScreen extends Component {
6747
LONG PRESS COUNTER: {longPressCounter}
6848
</Text>
6949

70-
{this.renderExample('feedbackColor', {backgroundColor: Colors.red30, feedbackColor: Colors.red10})}
71-
{this.renderExample('activeScale', {activeScale: 0.95})}
72-
{this.renderExample('activeOpacity', {activeOpacity: 0.6})}
73-
74-
<Incubator.TouchableOpacity2
50+
<Incubator.TouchableOpacity
7551
marginT-20
7652
onPress={this.onPress}
7753
onLongPress={this.onLongPress}
@@ -81,9 +57,9 @@ class TouchableOpacityScreen extends Component {
8157
activeOpacity={1}
8258
activeScale={0.98}
8359
>
84-
<Text white>TouchableOpacity2</Text>
85-
</Incubator.TouchableOpacity2>
86-
<Incubator.TouchableOpacity2
60+
<Text white>TouchableOpacity</Text>
61+
</Incubator.TouchableOpacity>
62+
<Incubator.TouchableOpacity
8763
marginT-20
8864
paddingH-20
8965
paddingV-8
@@ -95,8 +71,8 @@ class TouchableOpacityScreen extends Component {
9571
activeOpacity={1}
9672
activeScale={0.98}
9773
>
98-
<Text white>TouchableOpacity2 (without LongPress)</Text>
99-
</Incubator.TouchableOpacity2>
74+
<Text white>TouchableOpacity (without LongPress)</Text>
75+
</Incubator.TouchableOpacity>
10076
{this.renderRNTouchableExample()}
10177
</View>
10278
);

generatedTypes/src/incubator/TextField/usePreset.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
7878
onAccessibilityTap?: (() => void) | undefined;
7979
onMagicTap?: (() => void) | undefined;
8080
accessibilityIgnoresInvertColors?: boolean | undefined;
81+
textAlign?: "left" | "right" | "center" | undefined;
82+
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
8183
onBlur?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
8284
onFocus?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
8385
onPressIn?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
@@ -87,8 +89,6 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
8789
maxFontSizeMultiplier?: number | null | undefined;
8890
selectionColor?: import("react-native").ColorValue | undefined;
8991
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
90-
textAlign?: "left" | "right" | "center" | undefined;
91-
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
9292
value?: string | undefined;
9393
autoCapitalize?: "none" | "characters" | "sentences" | "words" | undefined;
9494
autoCorrect?: boolean | undefined;
@@ -404,6 +404,8 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
404404
onAccessibilityTap?: (() => void) | undefined;
405405
onMagicTap?: (() => void) | undefined;
406406
accessibilityIgnoresInvertColors?: boolean | undefined;
407+
textAlign?: "left" | "right" | "center" | undefined;
408+
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
407409
onBlur?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
408410
onFocus?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
409411
onPressIn?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
@@ -413,8 +415,6 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
413415
maxFontSizeMultiplier?: number | null | undefined;
414416
selectionColor?: import("react-native").ColorValue | undefined;
415417
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
416-
textAlign?: "left" | "right" | "center" | undefined;
417-
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
418418
value?: string | undefined;
419419
autoCapitalize?: "none" | "characters" | "sentences" | "words" | undefined;
420420
autoCorrect?: boolean | undefined;
@@ -842,6 +842,8 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
842842
onAccessibilityTap?: (() => void) | undefined;
843843
onMagicTap?: (() => void) | undefined;
844844
accessibilityIgnoresInvertColors?: boolean | undefined;
845+
textAlign?: "left" | "right" | "center" | undefined;
846+
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
845847
onBlur?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
846848
onFocus?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
847849
onPressIn?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
@@ -851,8 +853,6 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
851853
maxFontSizeMultiplier?: number | null | undefined;
852854
selectionColor?: import("react-native").ColorValue | undefined;
853855
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
854-
textAlign?: "left" | "right" | "center" | undefined;
855-
textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
856856
value?: string | undefined;
857857
autoCapitalize?: "none" | "characters" | "sentences" | "words" | undefined;
858858
autoCorrect?: boolean | undefined;

generatedTypes/src/incubator/TouchableOpacity.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export declare type TouchableOpacityProps = {
3939
* Pass custom style
4040
*/
4141
style?: ViewProps['style'];
42+
/**
43+
* Custom value of any type to pass on to TouchableOpacity and receive back in onPress callback
44+
*/
45+
customValue?: any;
4246
onLayout?: (event: LayoutChangeEvent) => void;
4347
testID?: string;
4448
};
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export { default as ExpandableOverlay } from './expandableOverlay';
22
export { default as TextField, TextFieldProps, FieldContextType } from './TextField';
33
export { default as TouchableOpacity, TouchableOpacityProps } from './TouchableOpacity';
4-
export { default as TouchableOpacity2 } from './TouchableOpacity2';
54
export { default as WheelPicker, WheelPickerProps } from './WheelPicker';
65
export { default as PanView, PanViewProps, PanViewDirections, PanViewDismissThreshold } from './panView';
76
export { default as TransitionView, TransitionViewProps, Direction, TransitionViewAnimationType } from './TransitionView';

0 commit comments

Comments
 (0)