11import * as React from 'react' ;
22
3- import { StyleSheet , View , Text } from 'react-native' ;
4- import { multiply } from 'react-native-masonry-flatlist' ;
3+ import { StyleSheet , View } from 'react-native' ;
4+ import MasonryFlatlist from 'react-native-masonry-grid' ;
5+ import Card from './component/Card' ;
56
6- export default function App ( ) {
7- const [ result , setResult ] = React . useState < number | undefined > ( ) ;
8-
9- React . useEffect ( ( ) => {
10- multiply ( 3 , 7 ) . then ( setResult ) ;
11- } , [ ] ) ;
7+ const DATA = [
8+ {
9+ name : 'Coffee Now!' ,
10+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/eac92236-0e4f-466a-9bc2-e68a04bb96ad_NowCoffeeNew.png' ,
11+ height : 136 ,
12+ id : '211' ,
13+ } ,
14+ {
15+ name : 'Fruits & vegetables' ,
16+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/4fa903f6-8de2-42fe-b0a0-d69a6c6aed05_Fruitsvegetables.png' ,
17+ height : 136 ,
18+ id : '11' ,
19+ } ,
20+ {
21+ name : 'Snacks & Candy' ,
22+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/31f8537a-dd16-460d-a13a-7753cbcef288_snakscancy.png' ,
23+ height : 280 ,
24+ id : '1' ,
25+ } ,
26+ {
27+ name : 'Beverages & Drinks' ,
28+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/c5a9e597-d511-4581-a97e-377a1af7d1ae_BeveragesDrinks.png' ,
29+ height : 136 ,
30+ id : '6' ,
31+ } ,
32+ {
33+ name : 'Dairy & Eggs' ,
34+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/e2f02d7d-ca52-4482-a85f-ec1ddbeb1f92_DairyEggs.png' ,
35+ height : 280 ,
36+ id : '8' ,
37+ } ,
38+ {
39+ name : 'Milk & Laban' ,
40+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/8e8bac9b-38e4-437b-8b81-77449a2403ce_MilkLaban.png' ,
41+ height : 136 ,
42+ id : '5' ,
43+ } ,
44+ {
45+ name : 'Ice Cream' ,
46+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/cf85db2f-dd1a-4feb-b380-2b5583985523_ice-cream.png' ,
47+ height : 280 ,
48+ id : '2' ,
49+ } ,
50+ {
51+ name : 'Bakery' ,
52+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/983ba625-85bb-49ec-afde-88d276e2b5ed_Bakery.png' ,
53+ height : 136 ,
54+ id : '7' ,
55+ } ,
56+ {
57+ name : 'Fresh Poultry & Meat' ,
58+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/e3e39b42-7c25-4e16-89c3-fc4322cffaff_FreshPoultryMeat.png' ,
59+ height : 136 ,
60+ id : '15' ,
61+ } ,
62+ {
63+ name : 'For your guests' ,
64+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/236586b5-183b-4cdc-a0fc-7e9bf6fe9700_eidcategory_Eidcategory.png' ,
65+ height : 136 ,
66+ id : '221' ,
67+ } ,
68+ {
69+ name : 'Canned food' ,
70+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/6a47741a-d3a8-42fe-b4dc-88373c97a16e_cannedfood.png' ,
71+ height : 136 ,
72+ id : '13' ,
73+ } ,
74+ {
75+ name : 'Water & Ice' ,
76+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/980e8f60-4cf9-4bea-a941-b7a6859250d1_WaterIce.png' ,
77+ height : 136 ,
78+ id : '3' ,
79+ } ,
80+ {
81+ name : 'Coffee & Tea' ,
82+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/06b262ca-bef4-43c8-8ca3-ef52bb6f0135_CoffeeTea.png' ,
83+ height : 280 ,
84+ id : '17' ,
85+ } ,
86+ {
87+ name : 'Condiments' ,
88+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/6287f181-9819-4efb-9dcb-a19f75873d07_Condiments.png' ,
89+ height : 280 ,
90+ id : '16' ,
91+ } ,
92+ {
93+ name : 'Ready to Eat' ,
94+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/64f45280-b836-44ac-bf0c-0d740907e11e_Readytoeat.png' ,
95+ height : 136 ,
96+ id : '26' ,
97+ } ,
98+ {
99+ name : 'Pet Supplies' ,
100+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/228d9fc3-a562-4466-ad40-918e6780d021_PetSupplies.png' ,
101+ height : 136 ,
102+ id : '25' ,
103+ } ,
104+ {
105+ name : 'Disposables' ,
106+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/bb3860c5-9232-40e0-882d-4ad32d67044e_Disposables.png' ,
107+ height : 280 ,
108+ id : '24' ,
109+ } ,
110+ {
111+ name : 'Baby Products' ,
112+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/c74e261e-066c-4b55-bc17-5ec5dc2ea621_Baby.png' ,
113+ height : 136 ,
114+ id : '23' ,
115+ } ,
116+ {
117+ name : 'Household essentials' ,
118+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/df65739a-ccbf-4acf-8aa1-cc99a8a7b4f4_Householdessentials.png' ,
119+ height : 136 ,
120+ id : '22' ,
121+ } ,
122+ {
123+ name : 'Pharmacy' ,
124+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/76fda727-634c-4f0d-be16-84069177e8f2_Pharmacy.png' ,
125+ height : 136 ,
126+ id : '21' ,
127+ } ,
128+ {
129+ name : 'Beauty and Personal Care' ,
130+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/1ff6d157-98f2-421f-b00b-00b59cde02b5_BeautyandPersonalCare.png' ,
131+ height : 136 ,
132+ id : '20' ,
133+ } ,
134+ {
135+ name : 'Cleaning and Laundry' ,
136+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/ecb6ba83-ef06-4e58-8a05-03cc45f737e6_CleaningandLaundry.png' ,
137+ height : 136 ,
138+ id : '19' ,
139+ } ,
140+ {
141+ name : 'Frozen Food' ,
142+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/43849a44-f9e2-4010-a3d5-5bc813d7708a_Frozenfood.png' ,
143+ height : 136 ,
144+ id : '14' ,
145+ } ,
146+ {
147+ name : 'Healthy Destination' ,
148+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/392127a1-5150-47ec-bac9-98b59e4f22bf_Organic.png' ,
149+ height : 136 ,
150+ id : '12' ,
151+ } ,
152+ {
153+ name : 'Breakfast' ,
154+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/5bc0c75c-de40-4b8f-a678-20916cb6bb5b_Breakfast.png' ,
155+ height : 136 ,
156+ id : '10' ,
157+ } ,
158+ {
159+ name : 'Cooking & Baking' ,
160+ url : 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/b58b1a50-2dad-4db1-b744-921dd4efc120_CookingBaking.png' ,
161+ height : 136 ,
162+ id : '9' ,
163+ } ,
164+ ] ;
12165
166+ export default function App ( ) {
13167 return (
14168 < View style = { styles . container } >
15- < Text > Result: { result } </ Text >
169+ < MasonryFlatlist
170+ data = { DATA }
171+ numColumns = { 4 }
172+ showsVerticalScrollIndicator = { false }
173+ columnWrapperStyle = { styles . columnWrapperStyle }
174+ style = { styles . masonryFlatlist }
175+ renderItem = { ( { item, index } ) => {
176+ return < Card data = { item } height = { item . height } onPress = { ( ) => { } } /> ;
177+ } }
178+ />
16179 </ View >
17180 ) ;
18181}
@@ -22,10 +185,13 @@ const styles = StyleSheet.create({
22185 flex : 1 ,
23186 alignItems : 'center' ,
24187 justifyContent : 'center' ,
188+ marginHorizontal : 16 ,
189+ marginVertical : 32 ,
190+ } ,
191+ columnWrapperStyle : {
192+ marginTop : 8 ,
25193 } ,
26- box : {
27- width : 60 ,
28- height : 60 ,
29- marginVertical : 20 ,
194+ masonryFlatlist : {
195+ marginTop : 8 ,
30196 } ,
31197} ) ;
0 commit comments