-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathEmotionNative.js
44 lines (39 loc) · 1.14 KB
/
EmotionNative.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from "react";
import { View, TouchableOpacity } from "react-native";
import styled from "@emotion/native";
import { COUNT } from "../utils";
const EmotionNative = () => {
return (
<View style={{ display: "flex", flexDirection: "row", flexWrap: 'wrap', justifyContent: 'space-around' }}>
{new Array(COUNT).fill(0).map((_, i) => (
<TouchableOpacity
key={i}
onPress={() => alert(`Item ${i} clicked!`)}
style={{ margin: 5 }}
>
<StyledView backgroundColor={i % 2 === 0 ? 'blue' : 'gray'}>
<StyledTextTitle>Item {i}</StyledTextTitle>
<StyledTextBody>This is static content</StyledTextBody>
</StyledView>
</TouchableOpacity>
))}
</View>
);
};
export default EmotionNative;
const StyledView = styled.View`
border-color: red;
border-width: 2px;
padding: 10px;
justify-content: center;
align-items: center;
background-color: ${(props) => props.backgroundColor};
`;
const StyledTextTitle = styled.Text`
font-size: 24px;
font-weight: bold;
`;
const StyledTextBody = styled.Text`
font-size: 16px;
line-height: 24px;
`;