app-studio 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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/dist/app-studio.cjs.development.js +944 -0
  4. package/dist/app-studio.cjs.development.js.map +1 -0
  5. package/dist/app-studio.cjs.production.min.js +2 -0
  6. package/dist/app-studio.cjs.production.min.js.map +1 -0
  7. package/dist/app-studio.esm.js +907 -0
  8. package/dist/app-studio.esm.js.map +1 -0
  9. package/dist/components/Element.d.ts +30 -0
  10. package/dist/components/Image.d.ts +23 -0
  11. package/dist/components/Layout.d.ts +11 -0
  12. package/dist/components/Text.d.ts +23 -0
  13. package/dist/components/View.d.ts +32 -0
  14. package/dist/components/Wrapper.d.ts +4 -0
  15. package/dist/hooks/useMount.d.ts +1 -0
  16. package/dist/hooks/useResponsive.d.ts +9 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +8 -0
  19. package/dist/providers/Responsive.d.ts +20 -0
  20. package/dist/providers/Theme.d.ts +19 -0
  21. package/dist/utils/colors.d.ts +14 -0
  22. package/dist/utils/env.d.ts +15 -0
  23. package/dist/utils/shadow.d.ts +103 -0
  24. package/dist/utils/typography.d.ts +46 -0
  25. package/package.json +114 -0
  26. package/src/components/Element.tsx +430 -0
  27. package/src/components/Image.tsx +56 -0
  28. package/src/components/Layout.tsx +49 -0
  29. package/src/components/Text.tsx +118 -0
  30. package/src/components/View.md +6 -0
  31. package/src/components/View.tsx +87 -0
  32. package/src/components/Wrapper.tsx +11 -0
  33. package/src/hooks/useMount.ts +6 -0
  34. package/src/hooks/useResponsive.ts +102 -0
  35. package/src/index.tsx +8 -0
  36. package/src/providers/Responsive.tsx +61 -0
  37. package/src/providers/Theme.tsx +73 -0
  38. package/src/types/module.d.ts +1 -0
  39. package/src/types/style.d.ts +696 -0
  40. package/src/utils/colors.ts +321 -0
  41. package/src/utils/env.ts +43 -0
  42. package/src/utils/shadow.ts +102 -0
  43. package/src/utils/typography.ts +45 -0
@@ -0,0 +1,696 @@
1
+ /**
2
+ * Copyright (c) Nicolas Gallagher.
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * @flow
9
+ */
10
+ import { CSSProperties } from 'styled-components';
11
+
12
+ export type ColorValue = null | string;
13
+
14
+ export type DimensionValue = null | number | string;
15
+
16
+ export type EdgeInsetsValue = {
17
+ top: number;
18
+ left: number;
19
+ right: number;
20
+ bottom: number;
21
+ };
22
+
23
+ export type GenericStyleProp<T> =
24
+ | null
25
+ | void
26
+ | T
27
+ | false
28
+ | ''
29
+ | readonly GenericStyleProp<T>[];
30
+
31
+ export type LayoutValue = {
32
+ x: number;
33
+ y: number;
34
+ width: number;
35
+ height: number;
36
+ };
37
+
38
+ export type LayoutEvent = {
39
+ nativeEvent: {
40
+ layout: LayoutValue;
41
+ target: any;
42
+ };
43
+ timeStamp: number;
44
+ };
45
+
46
+ export type PointValue = {
47
+ x: number;
48
+ y: number;
49
+ };
50
+
51
+ type NumberOrString = number | string;
52
+
53
+ /**
54
+ * Animations and transitions
55
+ */
56
+ type AnimationDirection =
57
+ | 'alternate'
58
+ | 'alternate-reverse'
59
+ | 'normal'
60
+ | 'reverse';
61
+ type AnimationFillMode = 'none' | 'forwards' | 'backwards' | 'both';
62
+ type AnimationIterationCount = number | 'infinite';
63
+ type AnimationKeyframes = string | Object;
64
+ type AnimationPlayState = 'paused' | 'running';
65
+
66
+ export type AnimationStyles = {
67
+ animationDelay?: (string | string[]) | null | undefined;
68
+ animationDirection?:
69
+ | (AnimationDirection | AnimationDirection[])
70
+ | null
71
+ | undefined;
72
+ animationDuration?: (string | string[]) | null | undefined;
73
+ animationFillMode?:
74
+ | (AnimationFillMode | AnimationFillMode[])
75
+ | null
76
+ | undefined;
77
+ animationIterationCount?:
78
+ | (AnimationIterationCount | AnimationIterationCount[])
79
+ | null
80
+ | undefined;
81
+ animationKeyframes?:
82
+ | (AnimationKeyframes | AnimationKeyframes[])
83
+ | null
84
+ | undefined;
85
+ animationPlayState?:
86
+ | (AnimationPlayState | AnimationPlayState[])
87
+ | null
88
+ | undefined;
89
+ animationTimingFunction?: (string | string[]) | null | undefined;
90
+ transitionDelay?: (string | string[]) | null | undefined;
91
+ transitionDuration?: (string | string[]) | null | undefined;
92
+ transitionProperty?: (string | string[]) | null | undefined;
93
+ transitionTimingFunction?: (string | string[]) | null | undefined;
94
+ };
95
+
96
+ /**
97
+ * Border
98
+ */
99
+ type BorderRadiusValue = number | string;
100
+ type BorderStyleValue = 'solid' | 'dotted' | 'dashed';
101
+
102
+ export type BorderStyles = {
103
+ border?: string | null | undefined;
104
+ borderColor?: ColorValue | null | undefined;
105
+ borderBottomColor?: ColorValue | null | undefined;
106
+ borderEndColor?: ColorValue | null | undefined;
107
+ borderLeftColor?: ColorValue | null | undefined;
108
+ borderRightColor?: ColorValue | null | undefined;
109
+ borderStartColor?: ColorValue | null | undefined;
110
+ borderTopColor?: ColorValue | null | undefined;
111
+ borderRadius?: BorderRadiusValue | null | undefined;
112
+ borderBottomEndRadius?: BorderRadiusValue | null | undefined;
113
+ borderBottomLeftRadius?: BorderRadiusValue | null | undefined;
114
+ borderBottomRightRadius?: BorderRadiusValue | null | undefined;
115
+ borderBottomStartRadius?: BorderRadiusValue | null | undefined;
116
+ borderTopEndRadius?: BorderRadiusValue | null | undefined;
117
+ borderTopLeftRadius?: BorderRadiusValue | null | undefined;
118
+ borderTopRightRadius?: BorderRadiusValue | null | undefined;
119
+ borderTopStartRadius?: BorderRadiusValue | null | undefined;
120
+ borderStyle?: BorderStyleValue | null | undefined;
121
+ borderBottomStyle?: BorderStyleValue | null | undefined;
122
+ borderEndStyle?: BorderStyleValue | null | undefined;
123
+ borderLeftStyle?: BorderStyleValue | null | undefined;
124
+ borderRightStyle?: BorderStyleValue | null | undefined;
125
+ borderStartStyle?: BorderStyleValue | null | undefined;
126
+ borderTopStyle?: BorderStyleValue | null | undefined;
127
+ };
128
+
129
+ /**
130
+ * Interactions
131
+ */
132
+ type CursorValue =
133
+ | 'alias'
134
+ | 'all-scroll'
135
+ | 'auto'
136
+ | 'cell'
137
+ | 'context-menu'
138
+ | 'copy'
139
+ | 'crosshair'
140
+ | 'default'
141
+ | 'grab'
142
+ | 'grabbing'
143
+ | 'help'
144
+ | 'pointer'
145
+ | 'progress'
146
+ | 'wait'
147
+ | 'text'
148
+ | 'vertical-text'
149
+ | 'move'
150
+ | 'none'
151
+ | 'no-drop'
152
+ | 'not-allowed'
153
+ | 'zoom-in'
154
+ | 'zoom-out' // resize
155
+ | 'col-resize'
156
+ | 'e-resize'
157
+ | 'ew-resize'
158
+ | 'n-resize'
159
+ | 'ne-resize'
160
+ | 'ns-resize'
161
+ | 'nw-resize'
162
+ | 'row-resize'
163
+ | 's-resize'
164
+ | 'se-resize'
165
+ | 'sw-resize'
166
+ | 'w-resize'
167
+ | 'nesw-resize'
168
+ | 'nwse-resize';
169
+
170
+ type TouchActionValue =
171
+ | 'auto'
172
+ | 'inherit'
173
+ | 'manipulation'
174
+ | 'none'
175
+ | 'pan-down'
176
+ | 'pan-left'
177
+ | 'pan-right'
178
+ | 'pan-up'
179
+ | 'pan-x'
180
+ | 'pan-y'
181
+ | 'pinch-zoom';
182
+
183
+ type UserSelect = 'all' | 'auto' | 'contain' | 'none' | 'text';
184
+
185
+ export type InteractionStyles = {
186
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Formal_syntax
187
+ cursor?: CursorValue | null | undefined;
188
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action#Formal_syntax
189
+ touchAction?: TouchActionValue | null | undefined;
190
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/user-select#Formal_syntax_2
191
+ userSelect?: UserSelect | null | undefined;
192
+ willChange?: string | null | undefined;
193
+ };
194
+
195
+ /**
196
+ * Layout
197
+ */
198
+ type OverflowValue = 'auto' | 'hidden' | 'scroll' | 'visible';
199
+ type VisiblilityValue = 'hidden' | 'visible';
200
+
201
+ export type LayoutStyles = {
202
+ alignContent?:
203
+ | 'center'
204
+ | 'flex-end'
205
+ | 'flex-start'
206
+ | 'space-around'
207
+ | 'space-between'
208
+ | 'stretch';
209
+ alignItems?:
210
+ | ('baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch')
211
+ | null
212
+ | undefined;
213
+ alignSelf?:
214
+ | ('auto' | 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch')
215
+ | null
216
+ | undefined;
217
+ backfaceVisibility?: VisiblilityValue | null | undefined;
218
+ borderWidth?: DimensionValue | null | undefined;
219
+ borderBottomWidth?: DimensionValue | null | undefined;
220
+ borderEndWidth?: DimensionValue | null | undefined;
221
+ borderLeftWidth?: DimensionValue | null | undefined;
222
+ borderRightWidth?: DimensionValue | null | undefined;
223
+ borderStartWidth?: DimensionValue | null | undefined;
224
+ borderTopWidth?: DimensionValue | null | undefined;
225
+ bottom?: DimensionValue | null | undefined;
226
+ boxSizing?: ('border-box' | 'content-box' | 'padding-box') | null | undefined;
227
+ direction?: ('inherit' | 'ltr' | 'rtl') | null | undefined;
228
+ display?: string | null | undefined;
229
+ end?: DimensionValue | null | undefined;
230
+ flex?: number | null | undefined;
231
+ flexBasis?: DimensionValue | null | undefined;
232
+ flexDirection?:
233
+ | ('column' | 'column-reverse' | 'row' | 'row-reverse')
234
+ | null
235
+ | undefined;
236
+ flexGrow?: number | null | undefined;
237
+ flexShrink?: number | null | undefined;
238
+ flexWrap?: ('nowrap' | 'wrap' | 'wrap-reverse') | null | undefined;
239
+ height?: DimensionValue | null | undefined;
240
+ justifyContent?:
241
+ | (
242
+ | 'center'
243
+ | 'flex-end'
244
+ | 'flex-start'
245
+ | 'space-around'
246
+ | 'space-between'
247
+ | 'space-evenly'
248
+ )
249
+ | null
250
+ | undefined;
251
+ left?: DimensionValue | null | undefined;
252
+ margin?: DimensionValue | null | undefined;
253
+ marginBottom?: DimensionValue | null | undefined;
254
+ marginHorizontal?: DimensionValue | null | undefined;
255
+ marginEnd?: DimensionValue | null | undefined;
256
+ marginLeft?: DimensionValue | null | undefined;
257
+ marginRight?: DimensionValue | null | undefined;
258
+ marginStart?: DimensionValue | null | undefined;
259
+ marginTop?: DimensionValue | null | undefined;
260
+ marginVertical?: DimensionValue | null | undefined;
261
+ maxHeight?: DimensionValue | null | undefined;
262
+ maxWidth?: DimensionValue | null | undefined;
263
+ minHeight?: DimensionValue | null | undefined;
264
+ minWidth?: DimensionValue | null | undefined;
265
+ order?: number | null | undefined;
266
+ overflow?: OverflowValue | null | undefined;
267
+ overflowX?: OverflowValue | null | undefined;
268
+ overflowY?: OverflowValue | null | undefined;
269
+ padding?: DimensionValue | null | undefined;
270
+ paddingBottom?: DimensionValue | null | undefined;
271
+ paddingHorizontal?: DimensionValue | null | undefined;
272
+ paddingEnd?: DimensionValue | null | undefined;
273
+ paddingLeft?: DimensionValue | null | undefined;
274
+ paddingRight?: DimensionValue | null | undefined;
275
+ paddingStart?: DimensionValue | null | undefined;
276
+ paddingTop?: DimensionValue | null | undefined;
277
+ paddingVertical?: DimensionValue | null | undefined;
278
+ position?:
279
+ | ('absolute' | 'fixed' | 'relative' | 'static' | 'sticky')
280
+ | null
281
+ | undefined;
282
+ right?: DimensionValue | null | undefined;
283
+ start?: DimensionValue | null | undefined;
284
+ top?: DimensionValue | null | undefined;
285
+ visibility?: VisiblilityValue | null | undefined;
286
+ width?: DimensionValue | null | undefined;
287
+ zIndex?: number | null | undefined;
288
+
289
+ /**
290
+ * @platform unsupported
291
+ */
292
+ aspectRatio?: number | null | undefined;
293
+
294
+ /**
295
+ * @platform web
296
+ */
297
+ gridAutoColumns?: string | null | undefined;
298
+ gridAutoFlow?: string | null | undefined;
299
+ gridAutoRows?: string | null | undefined;
300
+ gridColumnEnd?: string | null | undefined;
301
+ gridColumnGap?: string | null | undefined;
302
+ gridColumnStart?: string | null | undefined;
303
+ gridRowEnd?: string | null | undefined;
304
+ gridRowGap?: string | null | undefined;
305
+ gridRowStart?: string | null | undefined;
306
+ gridTemplateColumns?: string | null | undefined;
307
+ gridTemplateRows?: string | null | undefined;
308
+ gridTemplateAreas?: string | null | undefined;
309
+ };
310
+
311
+ /**
312
+ * Shadows
313
+ */
314
+ export type ShadowStyles = {
315
+ shadowColor?: ColorValue | null | undefined;
316
+ shadowOffset?: {
317
+ width?: DimensionValue;
318
+ height?: DimensionValue;
319
+ };
320
+ shadowOpacity?: number | null | undefined;
321
+ shadowRadius?: DimensionValue | null | undefined;
322
+ };
323
+
324
+ /**
325
+ * Transforms
326
+ */
327
+ export type TransformStyles = {
328
+ perspective?: NumberOrString | null | undefined;
329
+ perspectiveOrigin?: string | null | undefined;
330
+ transform?: (
331
+ | { readonly perspective: NumberOrString }
332
+ | { readonly rotate: string }
333
+ | { readonly rotateX: string }
334
+ | { readonly rotateY: string }
335
+ | { readonly rotateZ: string }
336
+ | { readonly scale: number }
337
+ | { readonly scaleX: number }
338
+ | { readonly scaleY: number }
339
+ | { readonly scaleZ: number }
340
+ | { readonly scale3d: string }
341
+ | { readonly skewX: string }
342
+ | { readonly skewY: string }
343
+ | { readonly translateX: NumberOrString }
344
+ | { readonly translateY: NumberOrString }
345
+ | { readonly translateZ: NumberOrString }
346
+ | { readonly translate3d: string }
347
+ )[];
348
+ transformOrigin?: string | null | undefined;
349
+ transformStyle?: ('flat' | 'preserve-3d') | null | undefined;
350
+ };
351
+
352
+ type OverscrollBehaviorValue = 'auto' | 'contain' | 'none';
353
+
354
+ export type ViewStyle = AnimationStyles &
355
+ BorderStyles &
356
+ InteractionStyles &
357
+ LayoutStyles &
358
+ ShadowStyles &
359
+ TransformStyles & {
360
+ backdropFilter?: string | null | undefined;
361
+ backgroundAttachment?: string | null | undefined;
362
+ backgroundBlendMode?: string | null | undefined;
363
+ backgroundClip?: string | null | undefined;
364
+ backgroundColor?: ColorValue | null | undefined;
365
+ backgroundImage?: string | null | undefined;
366
+ backgroundOrigin?: 'border-box' | 'content-box' | 'padding-box';
367
+ backgroundPosition?: string | null | undefined;
368
+ backgroundRepeat?: string | null | undefined;
369
+ backgroundSize?: string | null | undefined;
370
+ boxShadow?: string | null | undefined;
371
+ clip?: string | null | undefined;
372
+ filter?: string | null | undefined;
373
+ opacity?: number | null | undefined;
374
+ outlineColor?: ColorValue | null | undefined;
375
+ outlineOffset?: NumberOrString | null | undefined;
376
+ outlineStyle?: string | null | undefined;
377
+ outlineWidth?: NumberOrString | null | undefined;
378
+ overscrollBehavior?: OverscrollBehaviorValue | null | undefined;
379
+ overscrollBehaviorX?: OverscrollBehaviorValue | null | undefined;
380
+ overscrollBehaviorY?: OverscrollBehaviorValue | null | undefined;
381
+ scrollbarWidth?: 'auto' | 'none' | 'thin';
382
+ scrollSnapAlign?: string | null | undefined;
383
+ scrollSnapType?: string | null | undefined;
384
+ WebkitMaskImage?: string | null | undefined;
385
+ WebkitOverflowScrolling?: 'auto' | 'touch';
386
+ };
387
+
388
+ export type ViewProps = {
389
+ accessibilityLabel?: string | null | undefined;
390
+ accessibilityLiveRegion?: 'none' | 'polite' | 'assertive';
391
+ accessibilityRole?: string | null | undefined;
392
+ accessibilityState?: {
393
+ busy?: boolean | null | undefined;
394
+ checked?: (boolean | null | undefined) | 'mixed';
395
+ disabled?: boolean | null | undefined;
396
+ expanded?: boolean | null | undefined;
397
+ grabbed?: boolean | null | undefined;
398
+ hidden?: boolean | null | undefined;
399
+ invalid?: boolean | null | undefined;
400
+ modal?: boolean | null | undefined;
401
+ pressed?: boolean | null | undefined;
402
+ readonly?: boolean | null | undefined;
403
+ required?: boolean | null | undefined;
404
+ selected?: boolean | null | undefined;
405
+ };
406
+ accessibilityValue?: {
407
+ max?: number | null | undefined;
408
+ min?: number | null | undefined;
409
+ now?: number | null | undefined;
410
+ text?: string | null | undefined;
411
+ };
412
+ accessible?: boolean;
413
+ children?: any | null | undefined;
414
+ importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants';
415
+ nativeID?: string | null | undefined;
416
+ onBlur?: (e: any) => void;
417
+ onClick?: (e: any) => void;
418
+ onClickCapture?: (e: any) => void;
419
+ onContextMenu?: (e: any) => void;
420
+ onFocus?: (e: any) => void;
421
+ onKeyDown?: (e: any) => void;
422
+ onKeyUp?: (e: any) => void;
423
+ onLayout?: (e: LayoutEvent) => void;
424
+ onMoveShouldSetResponder?: (e: any) => boolean;
425
+ onMoveShouldSetResponderCapture?: (e: any) => boolean;
426
+ onResponderEnd?: (e: any) => void;
427
+ onResponderGrant?: (e: any) => void;
428
+ onResponderMove?: (e: any) => void;
429
+ onResponderReject?: (e: any) => void;
430
+ onResponderRelease?: (e: any) => void;
431
+ onResponderStart?: (e: any) => void;
432
+ onResponderTerminate?: (e: any) => void;
433
+ onResponderTerminationRequest?: (e: any) => boolean;
434
+ onScrollShouldSetResponder?: (e: any) => boolean;
435
+ onScrollShouldSetResponderCapture?: (e: any) => boolean;
436
+ onSelectionChangeShouldSetResponder?: (e: any) => boolean;
437
+ onSelectionChangeShouldSetResponderCapture?: (e: any) => boolean;
438
+ onStartShouldSetResponder?: (e: any) => boolean;
439
+ onStartShouldSetResponderCapture?: (e: any) => boolean;
440
+ pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto';
441
+ style?:
442
+ | false
443
+ | void
444
+ | ''
445
+ | ViewStyle
446
+ | readonly GenericStyleProp<ViewStyle>[]
447
+ | null
448
+ | undefined;
449
+ testID?: string | null | undefined;
450
+ // unstable
451
+ dataSet?: Object | null | undefined;
452
+ onMouseDown?: (e: any) => void;
453
+ onMouseEnter?: (e: any) => void;
454
+ onMouseLeave?: (e: any) => void;
455
+ onMouseMove?: (e: any) => void;
456
+ onMouseOver?: (e: any) => void;
457
+ onMouseOut?: (e: any) => void;
458
+ onMouseUp?: (e: any) => void;
459
+ onScroll?: (e: any) => void;
460
+ onTouchCancel?: (e: any) => void;
461
+ onTouchCancelCapture?: (e: any) => void;
462
+ onTouchEnd?: (e: any) => void;
463
+ onTouchEndCapture?: (e: any) => void;
464
+ onTouchMove?: (e: any) => void;
465
+ onTouchMoveCapture?: (e: any) => void;
466
+ onTouchStart?: (e: any) => void;
467
+ onTouchStartCapture?: (e: any) => void;
468
+ onWheel?: (e: any) => void;
469
+ href?: string | null | undefined;
470
+ rel?: string | null | undefined;
471
+ target?: string | null | undefined;
472
+ };
473
+
474
+ type SourceObject = {
475
+ /**
476
+ * `body` is the HTTP body to send with the request. This must be a valid
477
+ * UTF-8 string, and will be sent exactly as specified, with no
478
+ * additional encoding (e.g. URL-escaping or base64) applied.
479
+ */
480
+ body?: string;
481
+
482
+ /**
483
+ * `cache` determines how the requests handles potentially cached
484
+ * responses.
485
+ *
486
+ * - `default`: Use the native platforms default strategy. `useProtocolCachePolicy` on iOS.
487
+ *
488
+ * - `reload`: The data for the URL will be loaded from the originating source.
489
+ * No existing cache data should be used to satisfy a URL load request.
490
+ *
491
+ * - `force-cache`: The existing cached data will be used to satisfy the request,
492
+ * regardless of its age or expiration date. If there is no existing data in the cache
493
+ * corresponding the request, the data is loaded from the originating source.
494
+ *
495
+ * - `only-if-cached`: The existing cache data will be used to satisfy a request, regardless of
496
+ * its age or expiration date. If there is no existing data in the cache corresponding
497
+ * to a URL load request, no attempt is made to load the data from the originating source,
498
+ * and the load is considered to have failed.
499
+ *
500
+ * @platform ios
501
+ */
502
+ cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached';
503
+
504
+ /**
505
+ * `headers` is an object representing the HTTP headers to send along with the
506
+ * request for a remote image.
507
+ */
508
+ headers?: Record<string, string>;
509
+
510
+ /**
511
+ * `method` is the HTTP Method to use. Defaults to GET if not specified.
512
+ */
513
+ method?: string;
514
+
515
+ /**
516
+ * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
517
+ * unspecified, meaning that one image pixel equates to one display point / DIP.
518
+ */
519
+ scale?: number;
520
+
521
+ /**
522
+ * `uri` is a string representing the resource identifier for the image, which
523
+ * could be an http address, a local file path, or the name of a static image
524
+ * resource (which should be wrapped in the `require('./path/to/image.png')`
525
+ * function).
526
+ */
527
+ uri: string;
528
+
529
+ /**
530
+ * `width` and `height` can be specified if known at build time, in which case
531
+ * these will be used to set the default `<Image/>` component dimensions.
532
+ */
533
+ height?: number;
534
+ width?: number;
535
+ };
536
+
537
+ export type ResizeMode =
538
+ | 'center'
539
+ | 'contain'
540
+ | 'cover'
541
+ | 'none'
542
+ | 'repeat'
543
+ | 'stretch';
544
+
545
+ export type Source = number | string | SourceObject | SourceObject[];
546
+
547
+ export type ImageStyle = AnimationStyles &
548
+ BorderStyles &
549
+ InteractionStyles &
550
+ LayoutStyles &
551
+ ShadowStyles &
552
+ TransformStyles & {
553
+ backgroundColor?: ColorValue;
554
+ boxShadow?: string;
555
+ filter?: string;
556
+ opacity?: number;
557
+ resizeMode?: ResizeMode;
558
+ tintColor?: ColorValue;
559
+ };
560
+
561
+ export type ImageProps = ViewProps & {
562
+ blurRadius?: number;
563
+ defaultSource?: Source;
564
+ draggable?: boolean;
565
+ onError?: (e: any) => void;
566
+ onLayout?: (e: any) => void;
567
+ onLoad?: (e: any) => void;
568
+ onLoadEnd?: (e: any) => void;
569
+ onLoadStart?: (e: any) => void;
570
+ onProgress?: (e: any) => void;
571
+ resizeMode?: ResizeMode;
572
+ source: Source;
573
+ style?:
574
+ | false
575
+ | void
576
+ | ''
577
+ | ViewStyle
578
+ | readonly GenericStyleProp<ImageStyle>[]
579
+ | null
580
+ | undefined;
581
+ };
582
+
583
+ type FontWeightValue =
584
+ | 'normal'
585
+ | 'bold'
586
+ | '100'
587
+ | '200'
588
+ | '300'
589
+ | '400'
590
+ | '500'
591
+ | '600'
592
+ | '700'
593
+ | '800'
594
+ | '900';
595
+
596
+ export type TextStyle = ViewStyle & {
597
+ color?: ColorValue | null | undefined;
598
+ float?: string | null | undefined;
599
+ fontFamily?: string | null | undefined;
600
+ fontFeatureSettings?: string | null | undefined;
601
+ fontSize?: NumberOrString | null | undefined;
602
+ fontStyle?: 'italic' | 'normal';
603
+ fontWeight?: FontWeightValue | null | undefined;
604
+ fontVariant?: readonly (
605
+ | 'small-caps'
606
+ | 'oldstyle-nums'
607
+ | 'lining-nums'
608
+ | 'tabular-nums'
609
+ | 'proportional-nums'
610
+ )[];
611
+ letterSpacing?: NumberOrString | null | undefined;
612
+ lineHeight?: NumberOrString | null | undefined;
613
+ textAlign?:
614
+ | 'center'
615
+ | 'end'
616
+ | 'inherit'
617
+ | 'justify'
618
+ | 'justify-all'
619
+ | 'left'
620
+ | 'right'
621
+ | 'start';
622
+ textAlignVertical?: string | null | undefined;
623
+ textDecorationColor?: ColorValue | null | undefined;
624
+ textDecorationLine?:
625
+ | 'none'
626
+ | 'underline'
627
+ | 'line-through'
628
+ | 'underline line-through';
629
+ textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed';
630
+ textIndent?: NumberOrString | null | undefined;
631
+ textOverflow?: string | null | undefined;
632
+ textRendering?:
633
+ | 'auto'
634
+ | 'geometricPrecision'
635
+ | 'optimizeLegibility'
636
+ | 'optimizeSpeed';
637
+ textShadowColor?: ColorValue | null | undefined;
638
+ textShadowOffset?: { width?: number; height?: number };
639
+ textShadowRadius?: number | null | undefined;
640
+ textTransform?: 'capitalize' | 'lowercase' | 'none' | 'uppercase';
641
+ unicodeBidi?:
642
+ | 'normal'
643
+ | 'bidi-override'
644
+ | 'embed'
645
+ | 'isolate'
646
+ | 'isolate-override'
647
+ | 'plaintext';
648
+ whiteSpace?: string | null | undefined;
649
+ wordBreak?: 'normal' | 'break-all' | 'break-word' | 'keep-all';
650
+ wordWrap?: string | null | undefined;
651
+ writingDirection?: 'auto' | 'ltr' | 'rtl';
652
+
653
+ /* @platform web */
654
+ MozOsxFontSmoothing?: string | null | undefined;
655
+ WebkitFontSmoothing?: string | null | undefined;
656
+ };
657
+
658
+ export type TextProps = ViewProps & {
659
+ accessibilityRole?:
660
+ | 'button'
661
+ | 'header'
662
+ | 'heading'
663
+ | 'label'
664
+ | 'link'
665
+ | 'listitem'
666
+ | 'none'
667
+ | 'text';
668
+ accessibilityState?: {
669
+ busy?: boolean | null | undefined;
670
+ checked?: (boolean | null | undefined) | 'mixed';
671
+ disabled?: boolean | null | undefined;
672
+ expanded?: boolean | null | undefined;
673
+ grabbed?: boolean | null | undefined;
674
+ hidden?: boolean | null | undefined;
675
+ invalid?: boolean | null | undefined;
676
+ pressed?: boolean | null | undefined;
677
+ readonly?: boolean | null | undefined;
678
+ required?: boolean | null | undefined;
679
+ selected?: boolean | null | undefined;
680
+ };
681
+ dir?: 'auto' | 'ltr' | 'rtl';
682
+ numberOfLines?: number | null | undefined;
683
+ onPress?: (e: any) => void;
684
+ selectable?: boolean;
685
+ style?:
686
+ | false
687
+ | void
688
+ | ''
689
+ | ViewStyle
690
+ | readonly GenericStyleProp<TextStyle>[]
691
+ | null
692
+ | undefined;
693
+ testID?: string | null | undefined;
694
+ };
695
+
696
+ export type ResponsiveStyle = Record<string, CSSProperties>;