Skip to content

Commit c6ed2df

Browse files
authored
chore: Fix TypeScript issues for [email protected] (#6527)
🚀
1 parent 1328202 commit c6ed2df

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/UpdatesContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function createUpdatesContainer() {
112112
if (!(tag in updatesForTag)) {
113113
updatesForTag[tag] = [];
114114
}
115-
let update: OperationUpdate = [];
115+
let update: OperationUpdate = {};
116116
if (propsNames.length === 0) {
117117
update = 'update' in updateRequest ? updateRequest.update : updateRequest.snapshot;
118118
} else {

apps/common-app/src/examples/StrictDOMExample.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@ export default function StrictDOMExample() {
3636
const x = useSharedValue(0);
3737
const y = useSharedValue(0);
3838

39+
// @ts-expect-error There's a TypeScript bug in `react-native-dom` that
40+
// doesn't allow React-Native-like `transform`, but it works in runtime.
41+
// https://github.com/facebook/react-strict-dom/issues/204
3942
const animatedStyle = useAnimatedStyle(() => {
4043
return {
4144
opacity: opacity.value,
4245
width: width.value,
4346
transform: [{ translateX: x.value }, { translateY: y.value }],
4447
};
45-
});
48+
}) as css.StyleXStyles;
4649

4750
const panGesture = Gesture.Pan()
4851
.onUpdate((e) => {
@@ -63,6 +66,10 @@ export default function StrictDOMExample() {
6366
<html.div style={styles.container}>
6467
<html.div>React Strict DOM demo</html.div>
6568
<GestureDetector gesture={panGesture}>
69+
{/* Our property types conversion for Animated Components is conflicting
70+
with Strict DOM's property type conversions in such a way they generate an endless loop.
71+
Let's circle back on it in a few years.
72+
@ts-ignore TODO: */}
6673
<animated.html.div style={[styles.box, animatedStyle]} />
6774
</GestureDetector>
6875
</html.div>

packages/react-native-reanimated/src/animationBuilder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const mockTargetValues: LayoutAnimationsValues = {
2929

3030
function getCommonProperties(
3131
layoutStyle: StyleProps,
32-
componentStyle: StyleProps | Array<StyleProps>
32+
componentStyle: NestedArray<StyleProps>
3333
) {
3434
let componentStyleFlat = Array.isArray(componentStyle)
3535
? componentStyle.flat()

packages/react-native-reanimated/src/createAnimatedComponent/PropsFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class PropsFilter implements IPropsFilter {
3535
if (key === 'style') {
3636
const styleProp = inputProps.style;
3737
const styles = flattenArray<StyleProps>(styleProp ?? []);
38-
const processedStyle: StyleProps = styles.map((style) => {
38+
const processedStyle: StyleProps[] = styles.map((style) => {
3939
if (style && style.viewDescriptors) {
4040
// this is how we recognize styles returned by useAnimatedStyle
4141
if (component._isFirstRender) {

0 commit comments

Comments
 (0)