Skip to content
This repository has been archived by the owner on Jun 21, 2020. It is now read-only.

Exporting types for dynamic styles #45

Merged
merged 1 commit into from
Jan 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/src/dynamic-style-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ type DynamicStyles<T> = { [P in keyof T]: DynamicStyle<Style> }

type NormalizeStyle<T> = T extends DynamicStyle<infer R> ? R : T
export type NormalizeStyles<T extends DynamicStyles<T>> = { [Key in keyof T]: NormalizeStyle<T[Key]> }

export type DynamicViewStyle = DynamicStyle<ViewStyle>
export type DynamicTextStyle = DynamicStyle<TextStyle>
export type DynamicImageStyle = DynamicStyle<ImageStyle>


function parseStylesFor<T extends DynamicStyles<T>>(styles: T, mode: Mode): NormalizeStyles<T> {
const newStyles: IndexedObject<IndexedObject<ValueOf<ValueOf<T>>>> = {}
Expand Down