Skip to content

Commit b8d072e

Browse files
committed
separate android temporary background colors from foreground colors
1 parent bc5be21 commit b8d072e

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

modules/colors/platform.ts

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import {PlatformColor, Platform} from 'react-native'
1+
import {PlatformColor, Platform, OpaqueColorValue} from 'react-native'
22

33
// MARK: Label colors
44

55
/**
66
* Temporary constant to get Android building
77
*
8+
* Note: Android has issues with borderBottomColor of a view managed by RCTView
9+
* com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.Integer
10+
*
811
* @todo: Replace this constant and make the necessary changes to align with
912
* Material You color palette. This issue is being tracked over at
1013
* https://github.com/StoDevX/AAO-React-Native/issues/6919
1114
*/
12-
const TEMP_ANDROID_PLACEHOLDER = PlatformColor('?attr/colorAccent')
15+
const TEMP_ANDROID_BACKGROUND = 'white' as unknown as OpaqueColorValue
16+
const TEMP_ANDROID_FOREGROUND = 'black' as unknown as OpaqueColorValue
1317

1418
/**
1519
* The color for text labels that contain primary content.
@@ -20,8 +24,8 @@ const TEMP_ANDROID_PLACEHOLDER = PlatformColor('?attr/colorAccent')
2024
*/
2125
export const label = Platform.select({
2226
ios: PlatformColor('label'),
23-
android: TEMP_ANDROID_PLACEHOLDER,
24-
default: TEMP_ANDROID_PLACEHOLDER,
27+
android: PlatformColor('@android:color/primary_text_light'),
28+
default: TEMP_ANDROID_FOREGROUND,
2529
})
2630

2731
/**
@@ -57,7 +61,7 @@ export const tertiaryLabel = Platform.select({
5761
*/
5862
export const quaternaryLabel = Platform.select({
5963
ios: PlatformColor('quaternaryLabel'),
60-
android: TEMP_ANDROID_PLACEHOLDER,
64+
android: TEMP_ANDROID_FOREGROUND,
6165
})
6266

6367
// MARK: MARK: Fill colors
@@ -76,7 +80,7 @@ export const quaternaryLabel = Platform.select({
7680
*/
7781
export const systemFill = Platform.select({
7882
ios: PlatformColor('systemFill'),
79-
android: TEMP_ANDROID_PLACEHOLDER,
83+
android: TEMP_ANDROID_BACKGROUND,
8084
})
8185

8286
/**
@@ -93,7 +97,7 @@ export const systemFill = Platform.select({
9397
*/
9498
export const secondarySystemFill = Platform.select({
9599
ios: PlatformColor('secondarySystemFill'),
96-
android: TEMP_ANDROID_PLACEHOLDER,
100+
android: TEMP_ANDROID_BACKGROUND,
97101
})
98102

99103
/**
@@ -110,7 +114,7 @@ export const secondarySystemFill = Platform.select({
110114
*/
111115
export const tertiarySystemFill = Platform.select({
112116
ios: PlatformColor('tertiarySystemFill'),
113-
android: TEMP_ANDROID_PLACEHOLDER,
117+
android: TEMP_ANDROID_BACKGROUND,
114118
})
115119

116120
/**
@@ -127,7 +131,7 @@ export const tertiarySystemFill = Platform.select({
127131
*/
128132
export const quaternarySystemFill = Platform.select({
129133
ios: PlatformColor('quaternarySystemFill'),
130-
android: TEMP_ANDROID_PLACEHOLDER,
134+
android: TEMP_ANDROID_BACKGROUND,
131135
})
132136

133137
// MARK: Text colors
@@ -137,7 +141,7 @@ export const quaternarySystemFill = Platform.select({
137141
*/
138142
export const placeholderText = Platform.select({
139143
ios: PlatformColor('placeholderText'),
140-
android: TEMP_ANDROID_PLACEHOLDER,
144+
android: TEMP_ANDROID_FOREGROUND,
141145
})
142146

143147
// MARK: Tint color
@@ -147,7 +151,7 @@ export const placeholderText = Platform.select({
147151
*/
148152
export const tintColor = Platform.select({
149153
ios: PlatformColor('tintColor'),
150-
android: TEMP_ANDROID_PLACEHOLDER,
154+
android: TEMP_ANDROID_FOREGROUND,
151155
})
152156

153157
// MARK: Standard content background colors
@@ -162,7 +166,7 @@ export const tintColor = Platform.select({
162166
*/
163167
export const systemBackground = Platform.select({
164168
ios: PlatformColor('systemBackground'),
165-
android: TEMP_ANDROID_PLACEHOLDER,
169+
android: TEMP_ANDROID_BACKGROUND,
166170
})
167171

168172
/**
@@ -175,7 +179,7 @@ export const systemBackground = Platform.select({
175179
*/
176180
export const secondarySystemBackground = Platform.select({
177181
ios: PlatformColor('secondarySystemBackground'),
178-
android: TEMP_ANDROID_PLACEHOLDER,
182+
android: TEMP_ANDROID_BACKGROUND,
179183
})
180184

181185
/**
@@ -188,7 +192,7 @@ export const secondarySystemBackground = Platform.select({
188192
*/
189193
export const tertiarySystemBackground = Platform.select({
190194
ios: PlatformColor('tertiarySystemBackground'),
191-
android: TEMP_ANDROID_PLACEHOLDER,
195+
android: TEMP_ANDROID_BACKGROUND,
192196
})
193197

194198
// MARK: Grouped content background colors
@@ -203,7 +207,7 @@ export const tertiarySystemBackground = Platform.select({
203207
*/
204208
export const systemGroupedBackground = Platform.select({
205209
ios: PlatformColor('systemGroupedBackground'),
206-
android: TEMP_ANDROID_PLACEHOLDER,
210+
android: TEMP_ANDROID_BACKGROUND,
207211
})
208212

209213
/**
@@ -216,7 +220,7 @@ export const systemGroupedBackground = Platform.select({
216220
*/
217221
export const secondarySystemGroupedBackground = Platform.select({
218222
ios: PlatformColor('secondarySystemGroupedBackground'),
219-
android: TEMP_ANDROID_PLACEHOLDER,
223+
android: TEMP_ANDROID_BACKGROUND,
220224
})
221225

222226
/**
@@ -229,7 +233,7 @@ export const secondarySystemGroupedBackground = Platform.select({
229233
*/
230234
export const tertiarySystemGroupedBackground = Platform.select({
231235
ios: PlatformColor('tertiarySystemGroupedBackground'),
232-
android: TEMP_ANDROID_PLACEHOLDER,
236+
android: TEMP_ANDROID_BACKGROUND,
233237
})
234238

235239
// MARK: Separator colors
@@ -244,7 +248,7 @@ export const tertiarySystemGroupedBackground = Platform.select({
244248
*/
245249
export const separator = Platform.select({
246250
ios: PlatformColor('separator'),
247-
android: TEMP_ANDROID_PLACEHOLDER,
251+
android: TEMP_ANDROID_FOREGROUND,
248252
})
249253

250254
/**
@@ -257,7 +261,7 @@ export const separator = Platform.select({
257261
*/
258262
export const opaqueSeparator = Platform.select({
259263
ios: PlatformColor('opaqueSeparator'),
260-
android: TEMP_ANDROID_PLACEHOLDER,
264+
android: TEMP_ANDROID_FOREGROUND,
261265
})
262266

263267
// MARK: Link color
@@ -266,7 +270,7 @@ export const opaqueSeparator = Platform.select({
266270
*/
267271
export const link = Platform.select({
268272
ios: PlatformColor('link'),
269-
android: TEMP_ANDROID_PLACEHOLDER,
273+
android: TEMP_ANDROID_FOREGROUND,
270274
})
271275

272276
// MARK: Adaptable colors
@@ -276,97 +280,97 @@ export const link = Platform.select({
276280
*/
277281
export const systemBlue = Platform.select({
278282
ios: PlatformColor('systemBlue'),
279-
android: TEMP_ANDROID_PLACEHOLDER,
283+
android: TEMP_ANDROID_FOREGROUND,
280284
})
281285

282286
/**
283287
* A brown color that automatically adapts to the current trait environment.
284288
*/
285289
export const systemBrown = Platform.select({
286290
ios: PlatformColor('systemBrown'),
287-
android: TEMP_ANDROID_PLACEHOLDER,
291+
android: TEMP_ANDROID_FOREGROUND,
288292
})
289293

290294
/**
291295
* A cyan color that automatically adapts to the current trait environment.
292296
*/
293297
export const systemCyan = Platform.select({
294298
ios: PlatformColor('systemCyan'),
295-
android: TEMP_ANDROID_PLACEHOLDER,
299+
android: TEMP_ANDROID_FOREGROUND,
296300
})
297301

298302
/**
299303
* A green color that automatically adapts to the current trait environment.
300304
*/
301305
export const systemGreen = Platform.select({
302306
ios: PlatformColor('systemGreen'),
303-
android: TEMP_ANDROID_PLACEHOLDER,
304-
default: TEMP_ANDROID_PLACEHOLDER,
307+
android: TEMP_ANDROID_FOREGROUND,
308+
default: TEMP_ANDROID_FOREGROUND,
305309
})
306310

307311
/**
308312
* An indigo color that automatically adapts to the current trait environment.
309313
*/
310314
export const systemIndigo = Platform.select({
311315
ios: PlatformColor('systemIndigo'),
312-
android: TEMP_ANDROID_PLACEHOLDER,
316+
android: TEMP_ANDROID_FOREGROUND,
313317
})
314318

315319
/**
316320
* A mint color that automatically adapts to the current trait environment.
317321
*/
318322
export const systemMint = Platform.select({
319323
ios: PlatformColor('systemMint'),
320-
android: TEMP_ANDROID_PLACEHOLDER,
324+
android: TEMP_ANDROID_FOREGROUND,
321325
})
322326

323327
/**
324328
* An orange color that automatically adapts to the current trait environment.
325329
*/
326330
export const systemOrange = Platform.select({
327331
ios: PlatformColor('systemOrange'),
328-
android: TEMP_ANDROID_PLACEHOLDER,
332+
android: TEMP_ANDROID_FOREGROUND,
329333
})
330334

331335
/**
332336
* A pink color that automatically adapts to the current trait environment.
333337
*/
334338
export const systemPink = Platform.select({
335339
ios: PlatformColor('systemPink'),
336-
android: TEMP_ANDROID_PLACEHOLDER,
340+
android: TEMP_ANDROID_FOREGROUND,
337341
})
338342

339343
/**
340344
* A purple color that automatically adapts to the current trait environment.
341345
*/
342346
export const systemPurple = Platform.select({
343347
ios: PlatformColor('systemPurple'),
344-
android: TEMP_ANDROID_PLACEHOLDER,
348+
android: TEMP_ANDROID_FOREGROUND,
345349
})
346350

347351
/**
348352
* A red color that automatically adapts to the current trait environment.
349353
*/
350354
export const systemRed = Platform.select({
351355
ios: PlatformColor('systemRed'),
352-
android: TEMP_ANDROID_PLACEHOLDER,
353-
default: TEMP_ANDROID_PLACEHOLDER,
356+
android: TEMP_ANDROID_FOREGROUND,
357+
default: TEMP_ANDROID_FOREGROUND,
354358
})
355359

356360
/**
357361
* A teal color that automatically adapts to the current trait environment.
358362
*/
359363
export const systemTeal = Platform.select({
360364
ios: PlatformColor('systemTeal'),
361-
android: TEMP_ANDROID_PLACEHOLDER,
365+
android: TEMP_ANDROID_FOREGROUND,
362366
})
363367

364368
/**
365369
* A yellow color that automatically adapts to the current trait environment.
366370
*/
367371
export const systemYellow = Platform.select({
368372
ios: PlatformColor('systemYellow'),
369-
android: TEMP_ANDROID_PLACEHOLDER,
373+
android: TEMP_ANDROID_FOREGROUND,
370374
})
371375

372376
// MARK: Adaptable gray colors
@@ -376,47 +380,47 @@ export const systemYellow = Platform.select({
376380
*/
377381
export const systemGray = Platform.select({
378382
ios: PlatformColor('systemGray'),
379-
android: TEMP_ANDROID_PLACEHOLDER,
383+
android: TEMP_ANDROID_BACKGROUND,
380384
})
381385

382386
/**
383387
* A second-level shade of gray that adapts to the environment.
384388
*/
385389
export const systemGray2 = Platform.select({
386390
ios: PlatformColor('systemGray2'),
387-
android: TEMP_ANDROID_PLACEHOLDER,
391+
android: TEMP_ANDROID_BACKGROUND,
388392
})
389393

390394
/**
391395
* A third-level shade of gray that adapts to the environment.
392396
*/
393397
export const systemGray3 = Platform.select({
394398
ios: PlatformColor('systemGray3'),
395-
android: TEMP_ANDROID_PLACEHOLDER,
399+
android: TEMP_ANDROID_BACKGROUND,
396400
})
397401

398402
/**
399403
* A fourth-level shade of gray that adapts to the environment.
400404
*/
401405
export const systemGray4 = Platform.select({
402406
ios: PlatformColor('systemGray4'),
403-
android: TEMP_ANDROID_PLACEHOLDER,
407+
android: TEMP_ANDROID_BACKGROUND,
404408
})
405409

406410
/**
407411
* A fifth-level shade of gray that adapts to the environment.
408412
*/
409413
export const systemGray5 = Platform.select({
410414
ios: PlatformColor('systemGray5'),
411-
android: TEMP_ANDROID_PLACEHOLDER,
415+
android: TEMP_ANDROID_BACKGROUND,
412416
})
413417

414418
/**
415419
* A sixth-level shade of gray that adapts to the environment.
416420
*/
417421
export const systemGray6 = Platform.select({
418422
ios: PlatformColor('systemGray6'),
419-
android: TEMP_ANDROID_PLACEHOLDER,
423+
android: TEMP_ANDROID_BACKGROUND,
420424
})
421425

422426
// MARK: Transparent color

0 commit comments

Comments
 (0)