waleed-clock-works 0.0.4
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.
- package/.bundle/config +2 -0
- package/.eslintrc.js +4 -0
- package/.prettierrc.js +5 -0
- package/.watchmanconfig +1 -0
- package/App.tsx +279 -0
- package/Gemfile +17 -0
- package/README.md +51 -0
- package/__tests__/App.test.tsx +13 -0
- package/android/app/build.gradle +119 -0
- package/android/app/debug.keystore +0 -0
- package/android/app/proguard-rules.pro +10 -0
- package/android/app/src/main/AndroidManifest.xml +27 -0
- package/android/app/src/main/java/com/waleedclockworks/MainActivity.kt +22 -0
- package/android/app/src/main/java/com/waleedclockworks/MainApplication.kt +27 -0
- package/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/values/strings.xml +3 -0
- package/android/app/src/main/res/values/styles.xml +9 -0
- package/android/build.gradle +21 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +44 -0
- package/android/gradlew +248 -0
- package/android/gradlew.bat +98 -0
- package/android/settings.gradle +6 -0
- package/app.json +4 -0
- package/babel.config.js +3 -0
- package/index.js +5 -0
- package/ios/.xcode.env +11 -0
- package/ios/Podfile +34 -0
- package/ios/WaleedClockWorks/AppDelegate.swift +48 -0
- package/ios/WaleedClockWorks/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/ios/WaleedClockWorks/Images.xcassets/Contents.json +6 -0
- package/ios/WaleedClockWorks/Info.plist +59 -0
- package/ios/WaleedClockWorks/LaunchScreen.storyboard +47 -0
- package/ios/WaleedClockWorks/PrivacyInfo.xcprivacy +37 -0
- package/ios/WaleedClockWorks.xcodeproj/project.pbxproj +475 -0
- package/ios/WaleedClockWorks.xcodeproj/xcshareddata/xcschemes/WaleedClockWorks.xcscheme +88 -0
- package/jest.config.js +3 -0
- package/metro.config.js +11 -0
- package/package.json +43 -0
- package/tsconfig.json +8 -0
package/.bundle/config
ADDED
package/.eslintrc.js
ADDED
package/.prettierrc.js
ADDED
package/.watchmanconfig
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/App.tsx
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import Svg, {
|
|
4
|
+
Circle,
|
|
5
|
+
Line,
|
|
6
|
+
Text as SvgText,
|
|
7
|
+
Path,
|
|
8
|
+
Polygon,
|
|
9
|
+
G,
|
|
10
|
+
Rect,
|
|
11
|
+
} from 'react-native-svg';
|
|
12
|
+
|
|
13
|
+
interface ClockProps {
|
|
14
|
+
size?: number;
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function AnalogClock({
|
|
19
|
+
size = 300,
|
|
20
|
+
backgroundColor = '#F9FAFB',
|
|
21
|
+
}: ClockProps) {
|
|
22
|
+
const center = size / 2;
|
|
23
|
+
const radius = center - 10;
|
|
24
|
+
|
|
25
|
+
const [dateStr, setDateStr] = useState('');
|
|
26
|
+
|
|
27
|
+
const [angles, setAngles] = useState({
|
|
28
|
+
hour: 0,
|
|
29
|
+
minute: 0,
|
|
30
|
+
second: 0,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const startTime = new Date();
|
|
35
|
+
|
|
36
|
+
const startSecs = startTime.getSeconds();
|
|
37
|
+
const startMins = startTime.getMinutes();
|
|
38
|
+
const startHrs = startTime.getHours() % 12;
|
|
39
|
+
|
|
40
|
+
const initialSecondAngle = startSecs * 6;
|
|
41
|
+
const initialMinuteAngle = startMins * 6 + startSecs * 0.1;
|
|
42
|
+
const initialHourAngle = startHrs * 30 + startMins * 0.5;
|
|
43
|
+
|
|
44
|
+
const formatDate = (date: Date) => {
|
|
45
|
+
const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
|
|
46
|
+
return `${days[date.getDay()]} | ${date.getDate()}`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
setDateStr(formatDate(startTime));
|
|
50
|
+
|
|
51
|
+
const updateClock = () => {
|
|
52
|
+
const now = new Date();
|
|
53
|
+
const elapsedSeconds =
|
|
54
|
+
(now.getTime() - startTime.getTime()) / 1000;
|
|
55
|
+
|
|
56
|
+
setAngles({
|
|
57
|
+
second: initialSecondAngle + elapsedSeconds * 6,
|
|
58
|
+
minute: initialMinuteAngle + elapsedSeconds * 0.1,
|
|
59
|
+
hour: initialHourAngle + elapsedSeconds * 0.0083333,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
setDateStr(formatDate(now));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
updateClock();
|
|
66
|
+
const interval = setInterval(updateClock, 1000);
|
|
67
|
+
|
|
68
|
+
return () => clearInterval(interval);
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
const renderClockFace = () => {
|
|
72
|
+
const elements = [];
|
|
73
|
+
|
|
74
|
+
for (let i = 1; i <= 60; i++) {
|
|
75
|
+
const angle = (i * 6 * Math.PI) / 180 - Math.PI / 2;
|
|
76
|
+
const isHourTick = i % 5 === 0;
|
|
77
|
+
const isMajorHourTick = i % 15 === 0;
|
|
78
|
+
|
|
79
|
+
let tickLength = 5;
|
|
80
|
+
if (isHourTick) tickLength = 10;
|
|
81
|
+
if (isMajorHourTick) tickLength = 14;
|
|
82
|
+
|
|
83
|
+
const tickStartX = center + (radius - tickLength) * Math.cos(angle);
|
|
84
|
+
const tickStartY = center + (radius - tickLength) * Math.sin(angle);
|
|
85
|
+
const tickEndX = center + radius * Math.cos(angle);
|
|
86
|
+
const tickEndY = center + radius * Math.sin(angle);
|
|
87
|
+
|
|
88
|
+
elements.push(
|
|
89
|
+
<Line
|
|
90
|
+
key={`tick-${i}`}
|
|
91
|
+
x1={tickStartX}
|
|
92
|
+
y1={tickStartY}
|
|
93
|
+
x2={tickEndX}
|
|
94
|
+
y2={tickEndY}
|
|
95
|
+
stroke={isHourTick ? '#111827' : '#9CA3AF'}
|
|
96
|
+
strokeWidth={isHourTick ? 2.5 : 1}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (isHourTick) {
|
|
101
|
+
const hourNumber = i / 5;
|
|
102
|
+
const numberX =
|
|
103
|
+
center + (radius - 32) * Math.cos(angle);
|
|
104
|
+
const numberY =
|
|
105
|
+
center + (radius - 32) * Math.sin(angle);
|
|
106
|
+
|
|
107
|
+
elements.push(
|
|
108
|
+
<SvgText
|
|
109
|
+
key={`num-${hourNumber}`}
|
|
110
|
+
x={numberX}
|
|
111
|
+
y={numberY + size * 0.022}
|
|
112
|
+
fill="#111827"
|
|
113
|
+
fontSize={size * 0.065}
|
|
114
|
+
fontWeight="bold"
|
|
115
|
+
textAnchor="middle"
|
|
116
|
+
>
|
|
117
|
+
{hourNumber}
|
|
118
|
+
</SvgText>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return elements;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<View style={styles.screen}>
|
|
128
|
+
<View
|
|
129
|
+
style={[
|
|
130
|
+
styles.container,
|
|
131
|
+
{ width: size, height: size },
|
|
132
|
+
]}
|
|
133
|
+
>
|
|
134
|
+
<Svg width={size} height={size}>
|
|
135
|
+
{/* Outer circle */}
|
|
136
|
+
<Circle
|
|
137
|
+
cx={center}
|
|
138
|
+
cy={center}
|
|
139
|
+
r={radius}
|
|
140
|
+
stroke="#111827"
|
|
141
|
+
strokeWidth="4"
|
|
142
|
+
fill={backgroundColor}
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
{/* Clock face */}
|
|
146
|
+
{renderClockFace()}
|
|
147
|
+
|
|
148
|
+
{/* Logo */}
|
|
149
|
+
<G
|
|
150
|
+
transform={`translate(${center}, ${
|
|
151
|
+
center - size * 0.16
|
|
152
|
+
}) scale(${size / 300})`}
|
|
153
|
+
>
|
|
154
|
+
<Polygon
|
|
155
|
+
points="0,-16 12,-4 0,8 -12,-4"
|
|
156
|
+
fill="none"
|
|
157
|
+
stroke="#111827"
|
|
158
|
+
strokeWidth="1.5"
|
|
159
|
+
/>
|
|
160
|
+
<Circle cx="0" cy="-4" r="3" fill="#EF4444" />
|
|
161
|
+
<Path
|
|
162
|
+
d="M -6,-4 A 6,6 0 0,1 6,-4"
|
|
163
|
+
fill="none"
|
|
164
|
+
stroke="#111827"
|
|
165
|
+
strokeWidth="1.5"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<SvgText
|
|
169
|
+
x="0"
|
|
170
|
+
y="26"
|
|
171
|
+
fill="#111827"
|
|
172
|
+
fontSize="13"
|
|
173
|
+
fontWeight="900"
|
|
174
|
+
letterSpacing="2.5"
|
|
175
|
+
textAnchor="middle"
|
|
176
|
+
>
|
|
177
|
+
WALEED
|
|
178
|
+
</SvgText>
|
|
179
|
+
|
|
180
|
+
<SvgText
|
|
181
|
+
x="0"
|
|
182
|
+
y="38"
|
|
183
|
+
fill="#6B7280"
|
|
184
|
+
fontSize="7.5"
|
|
185
|
+
fontWeight="600"
|
|
186
|
+
letterSpacing="3.5"
|
|
187
|
+
textAnchor="middle"
|
|
188
|
+
>
|
|
189
|
+
CLOCKWORKS
|
|
190
|
+
</SvgText>
|
|
191
|
+
</G>
|
|
192
|
+
|
|
193
|
+
{/* Date */}
|
|
194
|
+
<G
|
|
195
|
+
transform={`translate(${
|
|
196
|
+
center + radius * 0.36
|
|
197
|
+
}, ${center + 14}) scale(${
|
|
198
|
+
size / 300
|
|
199
|
+
})`}
|
|
200
|
+
>
|
|
201
|
+
<Rect
|
|
202
|
+
x="-30"
|
|
203
|
+
y="-10"
|
|
204
|
+
width="60"
|
|
205
|
+
height="20"
|
|
206
|
+
rx="3"
|
|
207
|
+
fill="#FFFFFF"
|
|
208
|
+
stroke="#D1D5DB"
|
|
209
|
+
strokeWidth="1.5"
|
|
210
|
+
/>
|
|
211
|
+
<SvgText
|
|
212
|
+
x="0"
|
|
213
|
+
y="3.5"
|
|
214
|
+
fill="#111827"
|
|
215
|
+
fontSize="9"
|
|
216
|
+
fontWeight="bold"
|
|
217
|
+
textAnchor="middle"
|
|
218
|
+
>
|
|
219
|
+
{dateStr}
|
|
220
|
+
</SvgText>
|
|
221
|
+
</G>
|
|
222
|
+
|
|
223
|
+
{/* Hour hand */}
|
|
224
|
+
<Line
|
|
225
|
+
x1={center}
|
|
226
|
+
y1={center}
|
|
227
|
+
x2={center}
|
|
228
|
+
y2={center - radius * 0.45}
|
|
229
|
+
stroke="#111827"
|
|
230
|
+
strokeWidth="6"
|
|
231
|
+
strokeLinecap="round"
|
|
232
|
+
transform={`rotate(${angles.hour}, ${center}, ${center})`}
|
|
233
|
+
/>
|
|
234
|
+
|
|
235
|
+
{/* Minute hand */}
|
|
236
|
+
<Line
|
|
237
|
+
x1={center}
|
|
238
|
+
y1={center}
|
|
239
|
+
x2={center}
|
|
240
|
+
y2={center - radius * 0.7}
|
|
241
|
+
stroke="#4B5563"
|
|
242
|
+
strokeWidth="4"
|
|
243
|
+
strokeLinecap="round"
|
|
244
|
+
transform={`rotate(${angles.minute}, ${center}, ${center})`}
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
{/* Second hand */}
|
|
248
|
+
<Line
|
|
249
|
+
x1={center}
|
|
250
|
+
y1={center + 15}
|
|
251
|
+
x2={center}
|
|
252
|
+
y2={center - radius * 0.82}
|
|
253
|
+
stroke="#EF4444"
|
|
254
|
+
strokeWidth="2"
|
|
255
|
+
strokeLinecap="round"
|
|
256
|
+
transform={`rotate(${angles.second}, ${center}, ${center})`}
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
{/* Center dot */}
|
|
260
|
+
<Circle cx={center} cy={center} r={6} fill="#111827" />
|
|
261
|
+
<Circle cx={center} cy={center} r={2} fill="#FFFFFF" />
|
|
262
|
+
</Svg>
|
|
263
|
+
</View>
|
|
264
|
+
</View>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const styles = StyleSheet.create({
|
|
269
|
+
screen: {
|
|
270
|
+
flex: 1,
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
justifyContent: 'center',
|
|
273
|
+
backgroundColor: '#FFFFFF',
|
|
274
|
+
},
|
|
275
|
+
container: {
|
|
276
|
+
alignItems: 'center',
|
|
277
|
+
justifyContent: 'center',
|
|
278
|
+
},
|
|
279
|
+
});
|
package/Gemfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
|
+
|
|
6
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
9
|
+
gem 'xcodeproj', '< 1.26.0'
|
|
10
|
+
gem 'concurrent-ruby', '< 1.3.4'
|
|
11
|
+
|
|
12
|
+
# Ruby 3.4.0 has removed some libraries from the standard library.
|
|
13
|
+
gem 'bigdecimal'
|
|
14
|
+
gem 'logger'
|
|
15
|
+
gem 'benchmark'
|
|
16
|
+
gem 'mutex_m'
|
|
17
|
+
gem 'nkf'
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# 🕒 Waleed Clock Works
|
|
2
|
+
|
|
3
|
+
A smooth, animated, and customizable **Analog Clock component** for React Native built with `react-native-svg`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install waleed-clock-works
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
|
|
16
|
+
| Property | Type | Default | Description |
|
|
17
|
+
|------------------|--------|----------|-------------|
|
|
18
|
+
| size | number | 300 | The total height and width (diameter) of the clock layout in pixels. All internal markings scale automatically based on this value. |
|
|
19
|
+
| backgroundColor | string | #F9FAFB | The hex or RGB background fill color of the clock face. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Keywords
|
|
24
|
+
|
|
25
|
+
react-native, analog-clock, clock, svg-clock, realtime clock, digital analog hybrid, animated clock, react-native-svg clock, time widget, UI component, mobile clock, clock UI, reusable component, custom clock, live clock, clock face
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT License
|
|
32
|
+
|
|
33
|
+
Copyright (c) 2026 Waleed Ayub
|
|
34
|
+
|
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
37
|
+
in the Software without restriction, including without limitation the rights
|
|
38
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
40
|
+
furnished to do so, subject to the following conditions:
|
|
41
|
+
|
|
42
|
+
The above copyright notice and this permission notice shall be included in
|
|
43
|
+
all copies or substantial portions of the Software.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
51
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactTestRenderer from 'react-test-renderer';
|
|
7
|
+
import App from '../App';
|
|
8
|
+
|
|
9
|
+
test('renders correctly', async () => {
|
|
10
|
+
await ReactTestRenderer.act(() => {
|
|
11
|
+
ReactTestRenderer.create(<App />);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
3
|
+
apply plugin: "com.facebook.react"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This is the configuration block to customize your React Native Android app.
|
|
7
|
+
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
8
|
+
*/
|
|
9
|
+
react {
|
|
10
|
+
/* Folders */
|
|
11
|
+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
|
|
12
|
+
// root = file("../../")
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
|
|
14
|
+
// reactNativeDir = file("../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
|
|
18
|
+
// cliFile = file("../../node_modules/react-native/cli.js")
|
|
19
|
+
|
|
20
|
+
/* Variants */
|
|
21
|
+
// The list of variants to that are debuggable. For those we're going to
|
|
22
|
+
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
|
|
23
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
+
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
|
|
25
|
+
|
|
26
|
+
/* Bundling */
|
|
27
|
+
// A list containing the node command and its flags. Default is just 'node'.
|
|
28
|
+
// nodeExecutableAndArgs = ["node"]
|
|
29
|
+
//
|
|
30
|
+
// The command to run when bundling. By default is 'bundle'
|
|
31
|
+
// bundleCommand = "ram-bundle"
|
|
32
|
+
//
|
|
33
|
+
// The path to the CLI configuration file. Default is empty.
|
|
34
|
+
// bundleConfig = file(../rn-cli.config.js)
|
|
35
|
+
//
|
|
36
|
+
// The name of the generated asset file containing your JS bundle
|
|
37
|
+
// bundleAssetName = "MyApplication.android.bundle"
|
|
38
|
+
//
|
|
39
|
+
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
40
|
+
// entryFile = file("../js/MyApplication.android.js")
|
|
41
|
+
//
|
|
42
|
+
// A list of extra flags to pass to the 'bundle' commands.
|
|
43
|
+
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
44
|
+
// extraPackagerArgs = []
|
|
45
|
+
|
|
46
|
+
/* Hermes Commands */
|
|
47
|
+
// The hermes compiler command to run. By default it is 'hermesc'
|
|
48
|
+
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
49
|
+
//
|
|
50
|
+
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
51
|
+
// hermesFlags = ["-O", "-output-source-map"]
|
|
52
|
+
|
|
53
|
+
/* Autolinking */
|
|
54
|
+
autolinkLibrariesWithApp()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
59
|
+
*/
|
|
60
|
+
def enableProguardInReleaseBuilds = false
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
64
|
+
*
|
|
65
|
+
* For example, to use the international variant, you can use:
|
|
66
|
+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
|
|
67
|
+
*
|
|
68
|
+
* The international variant includes ICU i18n library and necessary data
|
|
69
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
70
|
+
* give correct results when using with locales other than en-US. Note that
|
|
71
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
72
|
+
*/
|
|
73
|
+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
|
74
|
+
|
|
75
|
+
android {
|
|
76
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
77
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
78
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
79
|
+
|
|
80
|
+
namespace "com.waleedclockworks"
|
|
81
|
+
defaultConfig {
|
|
82
|
+
applicationId "com.waleedclockworks"
|
|
83
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
84
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
85
|
+
versionCode 1
|
|
86
|
+
versionName "1.0"
|
|
87
|
+
}
|
|
88
|
+
signingConfigs {
|
|
89
|
+
debug {
|
|
90
|
+
storeFile file('debug.keystore')
|
|
91
|
+
storePassword 'android'
|
|
92
|
+
keyAlias 'androiddebugkey'
|
|
93
|
+
keyPassword 'android'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
buildTypes {
|
|
97
|
+
debug {
|
|
98
|
+
signingConfig signingConfigs.debug
|
|
99
|
+
}
|
|
100
|
+
release {
|
|
101
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
102
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
103
|
+
signingConfig signingConfigs.debug
|
|
104
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
105
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
dependencies {
|
|
111
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
112
|
+
implementation("com.facebook.react:react-android")
|
|
113
|
+
|
|
114
|
+
if (hermesEnabled.toBoolean()) {
|
|
115
|
+
implementation("com.facebook.react:hermes-android")
|
|
116
|
+
} else {
|
|
117
|
+
implementation jscFlavor
|
|
118
|
+
}
|
|
119
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
4
|
+
|
|
5
|
+
<application
|
|
6
|
+
android:name=".MainApplication"
|
|
7
|
+
android:label="@string/app_name"
|
|
8
|
+
android:icon="@mipmap/ic_launcher"
|
|
9
|
+
android:roundIcon="@mipmap/ic_launcher_round"
|
|
10
|
+
android:allowBackup="false"
|
|
11
|
+
android:theme="@style/AppTheme"
|
|
12
|
+
android:usesCleartextTraffic="${usesCleartextTraffic}"
|
|
13
|
+
android:supportsRtl="true">
|
|
14
|
+
<activity
|
|
15
|
+
android:name=".MainActivity"
|
|
16
|
+
android:label="@string/app_name"
|
|
17
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
18
|
+
android:launchMode="singleTask"
|
|
19
|
+
android:windowSoftInputMode="adjustResize"
|
|
20
|
+
android:exported="true">
|
|
21
|
+
<intent-filter>
|
|
22
|
+
<action android:name="android.intent.action.MAIN" />
|
|
23
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
24
|
+
</intent-filter>
|
|
25
|
+
</activity>
|
|
26
|
+
</application>
|
|
27
|
+
</manifest>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.waleedclockworks
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate
|
|
5
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
+
|
|
8
|
+
class MainActivity : ReactActivity() {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
+
* rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
override fun getMainComponentName(): String = "WaleedClockWorks"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
+
*/
|
|
20
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package com.waleedclockworks
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
8
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
9
|
+
|
|
10
|
+
class MainApplication : Application(), ReactApplication {
|
|
11
|
+
|
|
12
|
+
override val reactHost: ReactHost by lazy {
|
|
13
|
+
getDefaultReactHost(
|
|
14
|
+
context = applicationContext,
|
|
15
|
+
packageList =
|
|
16
|
+
PackageList(this).packages.apply {
|
|
17
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
18
|
+
// add(MyReactNativePackage())
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun onCreate() {
|
|
24
|
+
super.onCreate()
|
|
25
|
+
loadReactNative(this)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Copyright (C) 2014 The Android Open Source Project
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
-->
|
|
16
|
+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
|
17
|
+
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
|
18
|
+
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
|
19
|
+
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
|
20
|
+
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
<selector>
|
|
24
|
+
<!--
|
|
25
|
+
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
|
26
|
+
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
|
27
|
+
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
|
28
|
+
|
|
29
|
+
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
30
|
+
|
|
31
|
+
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
|
32
|
+
-->
|
|
33
|
+
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
|
34
|
+
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
|
35
|
+
</selector>
|
|
36
|
+
|
|
37
|
+
</inset>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<resources>
|
|
2
|
+
|
|
3
|
+
<!-- Base application theme. -->
|
|
4
|
+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
5
|
+
<!-- Customize your theme here. -->
|
|
6
|
+
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
|
|
7
|
+
</style>
|
|
8
|
+
|
|
9
|
+
</resources>
|