@nuskin/routine-feature 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RoutineStack = RoutineStack;
7
+ exports.useRoutine = useRoutine;
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _reactNative = require("react-native");
12
+
13
+ var _mobileNavigation = require("@nuskin/mobile-navigation");
14
+
15
+ var _mobileUi = require("@ns/mobile-ui");
16
+
17
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
+
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+
21
+ const Stack = (0, _mobileNavigation.createNativeStackNavigator)();
22
+ const SECTIONS = [{
23
+ title: 'My Routines',
24
+ horizontal: true,
25
+ data: [{
26
+ key: '1',
27
+ text: 'Card Title Onessssss',
28
+ uri: 'https://picsum.photos/id/1/200'
29
+ }, {
30
+ key: '2',
31
+ text: 'Card Title 2',
32
+ uri: 'https://picsum.photos/id/10/200'
33
+ }, {
34
+ key: '3',
35
+ text: 'Card Title 3',
36
+ uri: 'https://picsum.photos/id/1002/200'
37
+ }]
38
+ }, {
39
+ title: 'Featured Routines',
40
+ horizontal: true,
41
+ data: [{
42
+ key: '1',
43
+ text: 'Card Title 1',
44
+ uri: 'https://picsum.photos/id/1011/200'
45
+ }, {
46
+ key: '2',
47
+ text: 'Card Title 2',
48
+ uri: 'https://picsum.photos/id/1012/200'
49
+ }, {
50
+ key: '3',
51
+ text: 'Card Title 3',
52
+ uri: 'https://picsum.photos/id/1013/200'
53
+ }]
54
+ }, {
55
+ title: 'Suggested Routines',
56
+ horizontal: true,
57
+ data: [{
58
+ key: '1',
59
+ text: 'Card Title 1',
60
+ uri: 'https://picsum.photos/id/1020/200'
61
+ }, {
62
+ key: '2',
63
+ text: 'Card Title 2',
64
+ uri: 'https://picsum.photos/id/1024/200'
65
+ }, {
66
+ key: '3',
67
+ text: 'Card Title 3',
68
+ uri: 'https://picsum.photos/id/1027/200'
69
+ }]
70
+ }];
71
+
72
+ const ListItem = _ref => {
73
+ let {
74
+ item,
75
+ index
76
+ } = _ref;
77
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
78
+ style: [styles.item, index === 0 ? {
79
+ marginLeft: 0
80
+ } : {}]
81
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
82
+ source: {
83
+ uri: item.uri
84
+ },
85
+ style: styles.itemPhoto,
86
+ resizeMode: "cover"
87
+ }), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
88
+ style: styles.itemText
89
+ }, item.text));
90
+ };
91
+
92
+ const Routines = () => {
93
+ const handleOnPress = () => {// console.log('onPress', section)
94
+ };
95
+
96
+ return /*#__PURE__*/_react.default.createElement(_reactNative.SafeAreaView, {
97
+ style: styles.container,
98
+ testID: "routineStack"
99
+ }, /*#__PURE__*/_react.default.createElement(_mobileUi.VeraHeader, {
100
+ left: /*#__PURE__*/_react.default.createElement(_mobileUi.Logo, {
101
+ accessibilityLabel: "logo"
102
+ }),
103
+ right: /*#__PURE__*/_react.default.createElement(_mobileUi.HeaderCart, {
104
+ accessibilityLabel: "crt-btn"
105
+ }),
106
+ title: "Routines",
107
+ accessibilityLabel: "header"
108
+ }), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
109
+ style: {
110
+ flex: 1,
111
+ backgroundColor: 'white'
112
+ }
113
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.SectionList, {
114
+ stickySectionHeadersEnabled: false,
115
+ sections: SECTIONS,
116
+ renderSectionHeader: _ref2 => {
117
+ let {
118
+ section
119
+ } = _ref2;
120
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
121
+ style: styles.sectionHeader
122
+ }, section.title), /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
123
+ horizontal: true,
124
+ data: section.data,
125
+ renderItem: _ref3 => {
126
+ let {
127
+ item,
128
+ index
129
+ } = _ref3;
130
+ return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
131
+ onPress: handleOnPress
132
+ }, /*#__PURE__*/_react.default.createElement(ListItem, {
133
+ item: item,
134
+ index: index
135
+ }));
136
+ },
137
+ showsHorizontalScrollIndicator: false,
138
+ contentContainerStyle: {
139
+ paddingHorizontal: 15
140
+ }
141
+ }));
142
+ },
143
+ renderItem: _ref4 => {
144
+ let {
145
+ item,
146
+ section,
147
+ index
148
+ } = _ref4;
149
+
150
+ if (section.horizontal) {
151
+ return null;
152
+ }
153
+
154
+ return /*#__PURE__*/_react.default.createElement(ListItem, {
155
+ item: item,
156
+ index: index
157
+ });
158
+ }
159
+ })));
160
+ };
161
+
162
+ function RoutineDetails() {
163
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
164
+ style: {
165
+ flex: 1,
166
+ alignItems: 'center',
167
+ justifyContent: 'center'
168
+ }
169
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, null, "Routine"));
170
+ }
171
+
172
+ function RoutineStack(LOG, _ref5) {
173
+ let {
174
+ navigation
175
+ } = _ref5;
176
+ (0, _react.useEffect)(() => {
177
+ const unsubscribe = navigation.addListener('focus', () => {
178
+ LOG.info('User navigated to the RoutineStack page.');
179
+ });
180
+ return unsubscribe;
181
+ }, [navigation]);
182
+ return /*#__PURE__*/_react.default.createElement(Stack.Navigator, null, /*#__PURE__*/_react.default.createElement(Stack.Screen, {
183
+ name: "Routines",
184
+ component: Routines,
185
+ options: {
186
+ headerShown: false
187
+ }
188
+ }), /*#__PURE__*/_react.default.createElement(Stack.Screen, {
189
+ name: "RoutineDetails",
190
+ component: RoutineDetails,
191
+ options: {
192
+ headerShown: false
193
+ }
194
+ }));
195
+ }
196
+
197
+ function useRoutine() {//
198
+ }
199
+
200
+ const styles = _reactNative.StyleSheet.create({
201
+ container: {
202
+ flex: 1,
203
+ backgroundColor: '#F9F9F9'
204
+ },
205
+ sectionHeader: {
206
+ textTransform: 'uppercase',
207
+ fontWeight: '600',
208
+ fontSize: 14,
209
+ // color: '#f4f4f4',
210
+ marginTop: 20,
211
+ paddingHorizontal: 15,
212
+ marginBottom: 5
213
+ },
214
+ item: {
215
+ margin: 10,
216
+ borderRadius: 14
217
+ },
218
+ itemPhoto: {
219
+ width: 230,
220
+ height: 160,
221
+ borderRadius: 14
222
+ },
223
+ itemText: {
224
+ color: 'rgba(255, 255, 255, 1)',
225
+ fontWeight: 'bold',
226
+ marginTop: 5,
227
+ position: 'absolute',
228
+ left: 16,
229
+ bottom: 16
230
+ }
231
+ });
232
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["Stack","SECTIONS","title","horizontal","data","key","text","uri","ListItem","item","index","styles","marginLeft","itemPhoto","itemText","Routines","handleOnPress","container","flex","backgroundColor","section","sectionHeader","paddingHorizontal","RoutineDetails","alignItems","justifyContent","RoutineStack","LOG","navigation","unsubscribe","addListener","info","headerShown","useRoutine","StyleSheet","create","textTransform","fontWeight","fontSize","marginTop","marginBottom","margin","borderRadius","width","height","color","position","left","bottom"],"mappings":";;;;;;;;AAAA;;AACA;;AAUA;;AACA;;;;;;AAEA,MAAMA,KAAK,GAAG,mDAAd;AAEA,MAAMC,QAAQ,GAAG,CACf;AACEC,EAAAA,KAAK,EAAE,aADT;AAEEC,EAAAA,UAAU,EAAE,IAFd;AAGEC,EAAAA,IAAI,EAAE,CACJ;AACEC,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,sBAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GADI,EAMJ;AACEF,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GANI,EAYJ;AACEF,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GAZI;AAHR,CADe,EAuBf;AACEL,EAAAA,KAAK,EAAE,mBADT;AAEEC,EAAAA,UAAU,EAAE,IAFd;AAGEC,EAAAA,IAAI,EAAE,CACJ;AACEC,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GADI,EAMJ;AACEF,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GANI,EAYJ;AACEF,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GAZI;AAHR,CAvBe,EA6Cf;AACEL,EAAAA,KAAK,EAAE,oBADT;AAEEC,EAAAA,UAAU,EAAE,IAFd;AAGEC,EAAAA,IAAI,EAAE,CACJ;AACEC,IAAAA,GAAG,EAAE,GADP;AAEEC,IAAAA,IAAI,EAAE,cAFR;AAGEC,IAAAA,GAAG,EAAE;AAHP,GADI,EAMJ;AACE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A,MAAM,EAAE,EADJ;AAEJC,IAAAA,YAAY,EAAE;AAFV,GAdyB;AAkB/B7B,EAAAA,SAAS,EAAE;AACT8B,IAAAA,KAAK,EAAE,GADE;AAETC,IAAAA,MAAM,EAAE,GAFC;AAGTF,IAAAA,YAAY,EAAE;AAHL,GAlBoB;AAuB/B5B,EAAAA,QAAQ,EAAE;AACR+B,IAAAA,KAAK,EAAE,wBADC;AAERR,IAAAA,UAAU,EAAE,MAFJ;AAGRE,IAAAA,SAAS,EAAE,CAHH;AAIRO,IAAAA,QAAQ,EAAE,UAJF;AAKRC,IAAAA,IAAI,EAAE,EALE;AAMRC,IAAAA,MAAM,EAAE;AANA;AAvBqB,CAAlB,CAAf","sourcesContent":["import React, { useEffect } from 'react';\nimport {\n FlatList,\n Image,\n SafeAreaView,\n SectionList,\n StyleSheet,\n Text,\n TouchableOpacity,\n View,\n} from 'react-native';\nimport { createNativeStackNavigator } from '@nuskin/mobile-navigation';\nimport { VeraHeader, Logo, HeaderCart } from '@ns/mobile-ui';\n\nconst Stack = createNativeStackNavigator();\n\nconst SECTIONS = [\n {\n title: 'My Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title Onessssss',\n uri: 'https://picsum.photos/id/1/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/10/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1002/200',\n },\n ],\n },\n {\n title: 'Featured Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title 1',\n uri: 'https://picsum.photos/id/1011/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/1012/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1013/200',\n },\n ],\n },\n {\n title: 'Suggested Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title 1',\n uri: 'https://picsum.photos/id/1020/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/1024/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1027/200',\n },\n ],\n },\n];\n\nconst ListItem = ({ item, index }) => {\n return (\n <View style={[styles.item, index === 0 ? { marginLeft: 0 } : {}]}>\n <Image\n source={{\n uri: item.uri,\n }}\n style={styles.itemPhoto}\n resizeMode=\"cover\"\n />\n <Text style={styles.itemText}>{item.text}</Text>\n </View>\n );\n};\n\nconst Routines = () => {\n const handleOnPress = () => {\n // console.log('onPress', section)\n };\n\n return (\n <SafeAreaView style={styles.container} testID=\"routineStack\">\n <VeraHeader\n left={<Logo accessibilityLabel=\"logo\" />}\n right={<HeaderCart accessibilityLabel=\"crt-btn\" />}\n title=\"Routines\"\n accessibilityLabel=\"header\"\n />\n <View style={{ flex: 1, backgroundColor: 'white' }}>\n <SectionList\n stickySectionHeadersEnabled={false}\n sections={SECTIONS}\n renderSectionHeader={({ section }) => (\n <>\n <Text style={styles.sectionHeader}>{section.title}</Text>\n <FlatList\n horizontal\n data={section.data}\n renderItem={({ item, index }) => (\n <TouchableOpacity onPress={handleOnPress}>\n <ListItem item={item} index={index} />\n </TouchableOpacity>\n )}\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={{ paddingHorizontal: 15 }}\n />\n </>\n )}\n renderItem={({ item, section, index }) => {\n if (section.horizontal) {\n return null;\n }\n return <ListItem item={item} index={index} />;\n }}\n />\n </View>\n </SafeAreaView>\n );\n};\n\nfunction RoutineDetails() {\n return (\n <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>\n <Text>Routine</Text>\n </View>\n );\n}\n\nfunction RoutineStack(LOG, { navigation }) {\n useEffect(() => {\n const unsubscribe = navigation.addListener('focus', () => {\n LOG.info('User navigated to the RoutineStack page.');\n });\n return unsubscribe;\n }, [navigation]);\n\n return (\n <Stack.Navigator>\n <Stack.Screen\n name=\"Routines\"\n component={Routines}\n options={{ headerShown: false }}\n />\n <Stack.Screen\n name=\"RoutineDetails\"\n component={RoutineDetails}\n options={{ headerShown: false }}\n />\n </Stack.Navigator>\n );\n}\n\nfunction useRoutine() {\n //\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#F9F9F9',\n },\n sectionHeader: {\n textTransform: 'uppercase',\n fontWeight: '600',\n fontSize: 14,\n // color: '#f4f4f4',\n marginTop: 20,\n paddingHorizontal: 15,\n marginBottom: 5,\n },\n item: {\n margin: 10,\n borderRadius: 14,\n },\n itemPhoto: {\n width: 230,\n height: 160,\n borderRadius: 14,\n },\n itemText: {\n color: 'rgba(255, 255, 255, 1)',\n fontWeight: 'bold',\n marginTop: 5,\n position: 'absolute',\n left: 16,\n bottom: 16,\n },\n});\n\nexport { RoutineStack, useRoutine };\n"]}
@@ -0,0 +1,217 @@
1
+ import React, { useEffect } from 'react';
2
+ import { FlatList, Image, SafeAreaView, SectionList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
+ import { createNativeStackNavigator } from '@nuskin/mobile-navigation';
4
+ import { VeraHeader, Logo, HeaderCart } from '@ns/mobile-ui';
5
+ const Stack = createNativeStackNavigator();
6
+ const SECTIONS = [{
7
+ title: 'My Routines',
8
+ horizontal: true,
9
+ data: [{
10
+ key: '1',
11
+ text: 'Card Title Onessssss',
12
+ uri: 'https://picsum.photos/id/1/200'
13
+ }, {
14
+ key: '2',
15
+ text: 'Card Title 2',
16
+ uri: 'https://picsum.photos/id/10/200'
17
+ }, {
18
+ key: '3',
19
+ text: 'Card Title 3',
20
+ uri: 'https://picsum.photos/id/1002/200'
21
+ }]
22
+ }, {
23
+ title: 'Featured Routines',
24
+ horizontal: true,
25
+ data: [{
26
+ key: '1',
27
+ text: 'Card Title 1',
28
+ uri: 'https://picsum.photos/id/1011/200'
29
+ }, {
30
+ key: '2',
31
+ text: 'Card Title 2',
32
+ uri: 'https://picsum.photos/id/1012/200'
33
+ }, {
34
+ key: '3',
35
+ text: 'Card Title 3',
36
+ uri: 'https://picsum.photos/id/1013/200'
37
+ }]
38
+ }, {
39
+ title: 'Suggested Routines',
40
+ horizontal: true,
41
+ data: [{
42
+ key: '1',
43
+ text: 'Card Title 1',
44
+ uri: 'https://picsum.photos/id/1020/200'
45
+ }, {
46
+ key: '2',
47
+ text: 'Card Title 2',
48
+ uri: 'https://picsum.photos/id/1024/200'
49
+ }, {
50
+ key: '3',
51
+ text: 'Card Title 3',
52
+ uri: 'https://picsum.photos/id/1027/200'
53
+ }]
54
+ }];
55
+
56
+ const ListItem = _ref => {
57
+ let {
58
+ item,
59
+ index
60
+ } = _ref;
61
+ return /*#__PURE__*/React.createElement(View, {
62
+ style: [styles.item, index === 0 ? {
63
+ marginLeft: 0
64
+ } : {}]
65
+ }, /*#__PURE__*/React.createElement(Image, {
66
+ source: {
67
+ uri: item.uri
68
+ },
69
+ style: styles.itemPhoto,
70
+ resizeMode: "cover"
71
+ }), /*#__PURE__*/React.createElement(Text, {
72
+ style: styles.itemText
73
+ }, item.text));
74
+ };
75
+
76
+ const Routines = () => {
77
+ const handleOnPress = () => {// console.log('onPress', section)
78
+ };
79
+
80
+ return /*#__PURE__*/React.createElement(SafeAreaView, {
81
+ style: styles.container,
82
+ testID: "routineStack"
83
+ }, /*#__PURE__*/React.createElement(VeraHeader, {
84
+ left: /*#__PURE__*/React.createElement(Logo, {
85
+ accessibilityLabel: "logo"
86
+ }),
87
+ right: /*#__PURE__*/React.createElement(HeaderCart, {
88
+ accessibilityLabel: "crt-btn"
89
+ }),
90
+ title: "Routines",
91
+ accessibilityLabel: "header"
92
+ }), /*#__PURE__*/React.createElement(View, {
93
+ style: {
94
+ flex: 1,
95
+ backgroundColor: 'white'
96
+ }
97
+ }, /*#__PURE__*/React.createElement(SectionList, {
98
+ stickySectionHeadersEnabled: false,
99
+ sections: SECTIONS,
100
+ renderSectionHeader: _ref2 => {
101
+ let {
102
+ section
103
+ } = _ref2;
104
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
105
+ style: styles.sectionHeader
106
+ }, section.title), /*#__PURE__*/React.createElement(FlatList, {
107
+ horizontal: true,
108
+ data: section.data,
109
+ renderItem: _ref3 => {
110
+ let {
111
+ item,
112
+ index
113
+ } = _ref3;
114
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
115
+ onPress: handleOnPress
116
+ }, /*#__PURE__*/React.createElement(ListItem, {
117
+ item: item,
118
+ index: index
119
+ }));
120
+ },
121
+ showsHorizontalScrollIndicator: false,
122
+ contentContainerStyle: {
123
+ paddingHorizontal: 15
124
+ }
125
+ }));
126
+ },
127
+ renderItem: _ref4 => {
128
+ let {
129
+ item,
130
+ section,
131
+ index
132
+ } = _ref4;
133
+
134
+ if (section.horizontal) {
135
+ return null;
136
+ }
137
+
138
+ return /*#__PURE__*/React.createElement(ListItem, {
139
+ item: item,
140
+ index: index
141
+ });
142
+ }
143
+ })));
144
+ };
145
+
146
+ function RoutineDetails() {
147
+ return /*#__PURE__*/React.createElement(View, {
148
+ style: {
149
+ flex: 1,
150
+ alignItems: 'center',
151
+ justifyContent: 'center'
152
+ }
153
+ }, /*#__PURE__*/React.createElement(Text, null, "Routine"));
154
+ }
155
+
156
+ function RoutineStack(LOG, _ref5) {
157
+ let {
158
+ navigation
159
+ } = _ref5;
160
+ useEffect(() => {
161
+ const unsubscribe = navigation.addListener('focus', () => {
162
+ LOG.info('User navigated to the RoutineStack page.');
163
+ });
164
+ return unsubscribe;
165
+ }, [navigation]);
166
+ return /*#__PURE__*/React.createElement(Stack.Navigator, null, /*#__PURE__*/React.createElement(Stack.Screen, {
167
+ name: "Routines",
168
+ component: Routines,
169
+ options: {
170
+ headerShown: false
171
+ }
172
+ }), /*#__PURE__*/React.createElement(Stack.Screen, {
173
+ name: "RoutineDetails",
174
+ component: RoutineDetails,
175
+ options: {
176
+ headerShown: false
177
+ }
178
+ }));
179
+ }
180
+
181
+ function useRoutine() {//
182
+ }
183
+
184
+ const styles = StyleSheet.create({
185
+ container: {
186
+ flex: 1,
187
+ backgroundColor: '#F9F9F9'
188
+ },
189
+ sectionHeader: {
190
+ textTransform: 'uppercase',
191
+ fontWeight: '600',
192
+ fontSize: 14,
193
+ // color: '#f4f4f4',
194
+ marginTop: 20,
195
+ paddingHorizontal: 15,
196
+ marginBottom: 5
197
+ },
198
+ item: {
199
+ margin: 10,
200
+ borderRadius: 14
201
+ },
202
+ itemPhoto: {
203
+ width: 230,
204
+ height: 160,
205
+ borderRadius: 14
206
+ },
207
+ itemText: {
208
+ color: 'rgba(255, 255, 255, 1)',
209
+ fontWeight: 'bold',
210
+ marginTop: 5,
211
+ position: 'absolute',
212
+ left: 16,
213
+ bottom: 16
214
+ }
215
+ });
216
+ export { RoutineStack, useRoutine };
217
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["React","useEffect","FlatList","Image","SafeAreaView","SectionList","StyleSheet","Text","TouchableOpacity","View","createNativeStackNavigator","VeraHeader","Logo","HeaderCart","Stack","SECTIONS","title","horizontal","data","key","text","uri","ListItem","item","index","styles","marginLeft","itemPhoto","itemText","Routines","handleOnPress","container","flex","backgroundColor","section","sectionHeader","paddingHorizontal","RoutineDetails","alignItems","justifyContent","RoutineStack","LOG","navigation","unsubscribe","addListener","info","headerShown","useRoutine","create","textTransform","fontWeight","fontSize","marginTop","marginBottom","margin","borderRadius","width","height","color","position","left","bottom"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SACEC,QADF,EAEEC,KAFF,EAGEC,YAHF,EAIEC,WAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,gBAPF,EAQEC,IARF,QASO,cATP;AAUA,SAASC,0BAAT,QAA2C,2BAA3C;AACA,SAASC,UAAT,EAAqBC,IAArB,EAA2BC,UAA3B,QAA6C,eAA7C;AAEA,MAAMC,KAAK,GAAGJ,0BAA0B,EAAxC;AAEA,MAAMK,QAAQ,GAAG,CACf;AACEC,EAAAA,KAA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AA,YAAY,EAAE;AAHL,GAlBoB;AAuB/B3B,EAAAA,QAAQ,EAAE;AACR8B,IAAAA,KAAK,EAAE,wBADC;AAERR,IAAAA,UAAU,EAAE,MAFJ;AAGRE,IAAAA,SAAS,EAAE,CAHH;AAIRO,IAAAA,QAAQ,EAAE,UAJF;AAKRC,IAAAA,IAAI,EAAE,EALE;AAMRC,IAAAA,MAAM,EAAE;AANA;AAvBqB,CAAlB,CAAf;AAiCA,SAASrB,YAAT,EAAuBO,UAAvB","sourcesContent":["import React, { useEffect } from 'react';\nimport {\n FlatList,\n Image,\n SafeAreaView,\n SectionList,\n StyleSheet,\n Text,\n TouchableOpacity,\n View,\n} from 'react-native';\nimport { createNativeStackNavigator } from '@nuskin/mobile-navigation';\nimport { VeraHeader, Logo, HeaderCart } from '@ns/mobile-ui';\n\nconst Stack = createNativeStackNavigator();\n\nconst SECTIONS = [\n {\n title: 'My Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title Onessssss',\n uri: 'https://picsum.photos/id/1/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/10/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1002/200',\n },\n ],\n },\n {\n title: 'Featured Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title 1',\n uri: 'https://picsum.photos/id/1011/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/1012/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1013/200',\n },\n ],\n },\n {\n title: 'Suggested Routines',\n horizontal: true,\n data: [\n {\n key: '1',\n text: 'Card Title 1',\n uri: 'https://picsum.photos/id/1020/200',\n },\n {\n key: '2',\n text: 'Card Title 2',\n uri: 'https://picsum.photos/id/1024/200',\n },\n\n {\n key: '3',\n text: 'Card Title 3',\n uri: 'https://picsum.photos/id/1027/200',\n },\n ],\n },\n];\n\nconst ListItem = ({ item, index }) => {\n return (\n <View style={[styles.item, index === 0 ? { marginLeft: 0 } : {}]}>\n <Image\n source={{\n uri: item.uri,\n }}\n style={styles.itemPhoto}\n resizeMode=\"cover\"\n />\n <Text style={styles.itemText}>{item.text}</Text>\n </View>\n );\n};\n\nconst Routines = () => {\n const handleOnPress = () => {\n // console.log('onPress', section)\n };\n\n return (\n <SafeAreaView style={styles.container} testID=\"routineStack\">\n <VeraHeader\n left={<Logo accessibilityLabel=\"logo\" />}\n right={<HeaderCart accessibilityLabel=\"crt-btn\" />}\n title=\"Routines\"\n accessibilityLabel=\"header\"\n />\n <View style={{ flex: 1, backgroundColor: 'white' }}>\n <SectionList\n stickySectionHeadersEnabled={false}\n sections={SECTIONS}\n renderSectionHeader={({ section }) => (\n <>\n <Text style={styles.sectionHeader}>{section.title}</Text>\n <FlatList\n horizontal\n data={section.data}\n renderItem={({ item, index }) => (\n <TouchableOpacity onPress={handleOnPress}>\n <ListItem item={item} index={index} />\n </TouchableOpacity>\n )}\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={{ paddingHorizontal: 15 }}\n />\n </>\n )}\n renderItem={({ item, section, index }) => {\n if (section.horizontal) {\n return null;\n }\n return <ListItem item={item} index={index} />;\n }}\n />\n </View>\n </SafeAreaView>\n );\n};\n\nfunction RoutineDetails() {\n return (\n <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>\n <Text>Routine</Text>\n </View>\n );\n}\n\nfunction RoutineStack(LOG, { navigation }) {\n useEffect(() => {\n const unsubscribe = navigation.addListener('focus', () => {\n LOG.info('User navigated to the RoutineStack page.');\n });\n return unsubscribe;\n }, [navigation]);\n\n return (\n <Stack.Navigator>\n <Stack.Screen\n name=\"Routines\"\n component={Routines}\n options={{ headerShown: false }}\n />\n <Stack.Screen\n name=\"RoutineDetails\"\n component={RoutineDetails}\n options={{ headerShown: false }}\n />\n </Stack.Navigator>\n );\n}\n\nfunction useRoutine() {\n //\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#F9F9F9',\n },\n sectionHeader: {\n textTransform: 'uppercase',\n fontWeight: '600',\n fontSize: 14,\n // color: '#f4f4f4',\n marginTop: 20,\n paddingHorizontal: 15,\n marginBottom: 5,\n },\n item: {\n margin: 10,\n borderRadius: 14,\n },\n itemPhoto: {\n width: 230,\n height: 160,\n borderRadius: 14,\n },\n itemText: {\n color: 'rgba(255, 255, 255, 1)',\n fontWeight: 'bold',\n marginTop: 5,\n position: 'absolute',\n left: 16,\n bottom: 16,\n },\n});\n\nexport { RoutineStack, useRoutine };\n"]}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare function RoutineStack(LOG: any, { navigation }: {
3
+ navigation: any;
4
+ }): JSX.Element;
5
+ declare function useRoutine(): void;
6
+ export { RoutineStack, useRoutine };
package/package.json ADDED
@@ -0,0 +1,141 @@
1
+ {
2
+ "name": "@nuskin/routine-feature",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://code.tls.nuskin.io/ns-am/mobile/applications/luna-and-sol/shared2.git",
8
+ "directory": "packages/routine-feature"
9
+ },
10
+ "main": "lib/commonjs/index.js",
11
+ "react-native": "src/index.tsx",
12
+ "source": "src/index.tsx",
13
+ "module": "lib/module/index.js",
14
+ "types": "lib/typescript/src/index.d.ts",
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "!**/__tests__"
19
+ ],
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "prepare": "bob build",
26
+ "clean": "rm -rf lib",
27
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
+ "test": "jest"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^17.0.2",
32
+ "react-native": ">=0.64.2"
33
+ },
34
+ "dependencies": {
35
+ "@nuskin/mobile-navigation": "0.0.1",
36
+ "@ns/mobile-ui": "0.0.1",
37
+ "tslib": "^2.3.0"
38
+ },
39
+ "devDependencies": {
40
+ "react-native-builder-bob": "^0.18.1",
41
+ "typescript": "4.4.2"
42
+ },
43
+ "jest": {
44
+ "preset": "react-native",
45
+ "modulePathIgnorePatterns": [
46
+ "<rootDir>/example/node_modules",
47
+ "<rootDir>/lib/"
48
+ ],
49
+ "transform": {
50
+ "^.+\\.(js|jsx|ts|tsx)?$": "babel-jest"
51
+ },
52
+ "collectCoverage": true,
53
+ "collectCoverageFrom": [
54
+ "**/*.tsx",
55
+ "**/*.ts",
56
+ "!**/coverage/**",
57
+ "!**/node_modules/**",
58
+ "!**/__mocks__/**",
59
+ "!**/(styles|assets|helpers|e2e)/*"
60
+ ],
61
+ "coveragePathIgnorePatterns": [
62
+ "/node_modules/",
63
+ "package.json",
64
+ "package-lock.json"
65
+ ],
66
+ "testResultsProcessor": "jest-sonar-reporter",
67
+ "coverageThreshold": {
68
+ "global": {
69
+ "branches": 0,
70
+ "functions": 0,
71
+ "lines": 0,
72
+ "statements": 0
73
+ }
74
+ },
75
+ "reporters": [
76
+ "default",
77
+ "jest-junit"
78
+ ],
79
+ "coverageReporters": [
80
+ "html",
81
+ "lcov",
82
+ "text-summary"
83
+ ],
84
+ "setupFiles": [
85
+ "./setupJest.js"
86
+ ]
87
+ },
88
+ "eslintConfig": {
89
+ "root": true,
90
+ "extends": [
91
+ "@react-native-community",
92
+ "prettier",
93
+ "@nuskin/eslint-config-mobile"
94
+ ],
95
+ "rules": {
96
+ "prettier/prettier": [
97
+ "error",
98
+ {
99
+ "quoteProps": "consistent",
100
+ "singleQuote": true,
101
+ "tabWidth": 2,
102
+ "trailingComma": "es5",
103
+ "useTabs": false
104
+ }
105
+ ],
106
+ "react-hooks/exhaustive-deps": "off"
107
+ }
108
+ },
109
+ "eslintIgnore": [
110
+ "node_modules/",
111
+ "lib/",
112
+ "example/"
113
+ ],
114
+ "prettier": {
115
+ "quoteProps": "consistent",
116
+ "singleQuote": true,
117
+ "tabWidth": 2,
118
+ "trailingComma": "es5",
119
+ "useTabs": false
120
+ },
121
+ "react-native-builder-bob": {
122
+ "source": "src",
123
+ "output": "lib",
124
+ "targets": [
125
+ "commonjs",
126
+ "module",
127
+ [
128
+ "typescript",
129
+ {
130
+ "project": "tsconfig.build.json"
131
+ }
132
+ ]
133
+ ]
134
+ },
135
+ "commithash": "ed329849d5652bd8c910df04813ebabeaae2a3a2",
136
+ "author": {
137
+ "name": "Norman Jarvis",
138
+ "email": "ncjarvis@nuskin.com",
139
+ "url": "https://code.tls.nuskin.io/ncjarvis"
140
+ }
141
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,215 @@
1
+ import React, { useEffect } from 'react';
2
+ import {
3
+ FlatList,
4
+ Image,
5
+ SafeAreaView,
6
+ SectionList,
7
+ StyleSheet,
8
+ Text,
9
+ TouchableOpacity,
10
+ View,
11
+ } from 'react-native';
12
+ import { createNativeStackNavigator } from '@nuskin/mobile-navigation';
13
+ import { VeraHeader, Logo, HeaderCart } from '@ns/mobile-ui';
14
+
15
+ const Stack = createNativeStackNavigator();
16
+
17
+ const SECTIONS = [
18
+ {
19
+ title: 'My Routines',
20
+ horizontal: true,
21
+ data: [
22
+ {
23
+ key: '1',
24
+ text: 'Card Title Onessssss',
25
+ uri: 'https://picsum.photos/id/1/200',
26
+ },
27
+ {
28
+ key: '2',
29
+ text: 'Card Title 2',
30
+ uri: 'https://picsum.photos/id/10/200',
31
+ },
32
+
33
+ {
34
+ key: '3',
35
+ text: 'Card Title 3',
36
+ uri: 'https://picsum.photos/id/1002/200',
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ title: 'Featured Routines',
42
+ horizontal: true,
43
+ data: [
44
+ {
45
+ key: '1',
46
+ text: 'Card Title 1',
47
+ uri: 'https://picsum.photos/id/1011/200',
48
+ },
49
+ {
50
+ key: '2',
51
+ text: 'Card Title 2',
52
+ uri: 'https://picsum.photos/id/1012/200',
53
+ },
54
+
55
+ {
56
+ key: '3',
57
+ text: 'Card Title 3',
58
+ uri: 'https://picsum.photos/id/1013/200',
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ title: 'Suggested Routines',
64
+ horizontal: true,
65
+ data: [
66
+ {
67
+ key: '1',
68
+ text: 'Card Title 1',
69
+ uri: 'https://picsum.photos/id/1020/200',
70
+ },
71
+ {
72
+ key: '2',
73
+ text: 'Card Title 2',
74
+ uri: 'https://picsum.photos/id/1024/200',
75
+ },
76
+
77
+ {
78
+ key: '3',
79
+ text: 'Card Title 3',
80
+ uri: 'https://picsum.photos/id/1027/200',
81
+ },
82
+ ],
83
+ },
84
+ ];
85
+
86
+ const ListItem = ({ item, index }) => {
87
+ return (
88
+ <View style={[styles.item, index === 0 ? { marginLeft: 0 } : {}]}>
89
+ <Image
90
+ source={{
91
+ uri: item.uri,
92
+ }}
93
+ style={styles.itemPhoto}
94
+ resizeMode="cover"
95
+ />
96
+ <Text style={styles.itemText}>{item.text}</Text>
97
+ </View>
98
+ );
99
+ };
100
+
101
+ const Routines = () => {
102
+ const handleOnPress = () => {
103
+ // console.log('onPress', section)
104
+ };
105
+
106
+ return (
107
+ <SafeAreaView style={styles.container} testID="routineStack">
108
+ <VeraHeader
109
+ left={<Logo accessibilityLabel="logo" />}
110
+ right={<HeaderCart accessibilityLabel="crt-btn" />}
111
+ title="Routines"
112
+ accessibilityLabel="header"
113
+ />
114
+ <View style={{ flex: 1, backgroundColor: 'white' }}>
115
+ <SectionList
116
+ stickySectionHeadersEnabled={false}
117
+ sections={SECTIONS}
118
+ renderSectionHeader={({ section }) => (
119
+ <>
120
+ <Text style={styles.sectionHeader}>{section.title}</Text>
121
+ <FlatList
122
+ horizontal
123
+ data={section.data}
124
+ renderItem={({ item, index }) => (
125
+ <TouchableOpacity onPress={handleOnPress}>
126
+ <ListItem item={item} index={index} />
127
+ </TouchableOpacity>
128
+ )}
129
+ showsHorizontalScrollIndicator={false}
130
+ contentContainerStyle={{ paddingHorizontal: 15 }}
131
+ />
132
+ </>
133
+ )}
134
+ renderItem={({ item, section, index }) => {
135
+ if (section.horizontal) {
136
+ return null;
137
+ }
138
+ return <ListItem item={item} index={index} />;
139
+ }}
140
+ />
141
+ </View>
142
+ </SafeAreaView>
143
+ );
144
+ };
145
+
146
+ function RoutineDetails() {
147
+ return (
148
+ <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
149
+ <Text>Routine</Text>
150
+ </View>
151
+ );
152
+ }
153
+
154
+ function RoutineStack(LOG, { navigation }) {
155
+ useEffect(() => {
156
+ const unsubscribe = navigation.addListener('focus', () => {
157
+ LOG.info('User navigated to the RoutineStack page.');
158
+ });
159
+ return unsubscribe;
160
+ }, [navigation]);
161
+
162
+ return (
163
+ <Stack.Navigator>
164
+ <Stack.Screen
165
+ name="Routines"
166
+ component={Routines}
167
+ options={{ headerShown: false }}
168
+ />
169
+ <Stack.Screen
170
+ name="RoutineDetails"
171
+ component={RoutineDetails}
172
+ options={{ headerShown: false }}
173
+ />
174
+ </Stack.Navigator>
175
+ );
176
+ }
177
+
178
+ function useRoutine() {
179
+ //
180
+ }
181
+
182
+ const styles = StyleSheet.create({
183
+ container: {
184
+ flex: 1,
185
+ backgroundColor: '#F9F9F9',
186
+ },
187
+ sectionHeader: {
188
+ textTransform: 'uppercase',
189
+ fontWeight: '600',
190
+ fontSize: 14,
191
+ // color: '#f4f4f4',
192
+ marginTop: 20,
193
+ paddingHorizontal: 15,
194
+ marginBottom: 5,
195
+ },
196
+ item: {
197
+ margin: 10,
198
+ borderRadius: 14,
199
+ },
200
+ itemPhoto: {
201
+ width: 230,
202
+ height: 160,
203
+ borderRadius: 14,
204
+ },
205
+ itemText: {
206
+ color: 'rgba(255, 255, 255, 1)',
207
+ fontWeight: 'bold',
208
+ marginTop: 5,
209
+ position: 'absolute',
210
+ left: 16,
211
+ bottom: 16,
212
+ },
213
+ });
214
+
215
+ export { RoutineStack, useRoutine };