Skip to content

Commit 40689dc

Browse files
author
Pierre Poupin
authored
Merge pull request #125 from bamlab/chore/improve-example-memo
chore(example): add missing memos
2 parents ed57785 + 3847330 commit 40689dc

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

packages/example/src/modules/program/view/Program.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ type ProgramProps = {
1111
label?: string;
1212
};
1313

14-
const Label = ({ label }: { label: string }) => {
14+
const Label = React.memo(({ label }: { label: string }) => {
1515
return <Typography>{label}</Typography>;
16-
};
16+
});
17+
Label.displayName = 'Label';
1718

1819
export const Program = React.forwardRef<View, ProgramProps>(
1920
({ isFocused = false, programInfo, label }, ref) => {
@@ -50,13 +51,17 @@ const ProgramContainer = styled(Animated.View)<{ isFocused: boolean }>(({ isFocu
5051
cursor: 'pointer',
5152
}));
5253

53-
const ProgramImage = styled(Image)({
54-
height: '100%',
55-
width: '100%',
56-
});
54+
const ProgramImage = React.memo(
55+
styled(Image)({
56+
height: '100%',
57+
width: '100%',
58+
}),
59+
);
5760

58-
const Overlay = styled.View({
59-
position: 'absolute',
60-
bottom: 12,
61-
left: 12,
62-
});
61+
const Overlay = React.memo(
62+
styled.View({
63+
position: 'absolute',
64+
bottom: 12,
65+
left: 12,
66+
}),
67+
);

0 commit comments

Comments
 (0)