Skip to content

Commit d735767

Browse files
committed
Fix transform handling
1 parent 9217877 commit d735767

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

apps/basic-example/src/ContentsButton.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default function ComplexUI() {
2222
<SpacingTests />
2323
<VisualEffects />
2424
<ComplexCombinations />
25+
<Transforms />
2526
</View>
2627
</ScrollView>
2728
</SafeAreaView>
@@ -189,6 +190,19 @@ function ComplexCombinations() {
189190
);
190191
}
191192

193+
function Transforms() {
194+
return (
195+
<View style={styles.section}>
196+
<Text style={styles.sectionTitle}>Transform</Text>
197+
<View style={styles.complexGrid}>
198+
<MyButton style={styles.transformButton}>
199+
<Text style={styles.buttonText}>Transform</Text>
200+
</MyButton>
201+
</View>
202+
</View>
203+
);
204+
}
205+
192206
const styles = StyleSheet.create({
193207
container: {
194208
flex: 1,
@@ -484,6 +498,17 @@ const styles = StyleSheet.create({
484498
marginTop: 10,
485499
},
486500

501+
// Transform styles
502+
transformButton: {
503+
width: '48%',
504+
height: 100,
505+
backgroundColor: '#38ACDD',
506+
borderRadius: 15,
507+
justifyContent: 'center',
508+
alignItems: 'center',
509+
transform: [{ translateX: 100 }, { rotate: '15deg' }, { scale: 1.1 }],
510+
},
511+
487512
// Text styles
488513
buttonText: {
489514
color: 'white',

packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export default function GestureHandlerButton({
6262
start,
6363
end,
6464
overflow,
65+
transform,
66+
transformOrigin,
6567
zIndex,
6668

6769
// Visual properties
@@ -123,9 +125,18 @@ export default function GestureHandlerButton({
123125
[flattenedStyle]
124126
);
125127

128+
const wrapperStyle = useMemo(
129+
() => ({
130+
zIndex,
131+
transform,
132+
transformOrigin,
133+
}),
134+
[zIndex, transform, transformOrigin]
135+
);
136+
126137
return (
127138
<RNGestureHandlerButtonWrapperNativeComponent
128-
style={[styles.contents, { zIndex }]}>
139+
style={[styles.contents, wrapperStyle]}>
129140
<View
130141
collapsable={false}
131142
style={[

0 commit comments

Comments
 (0)