mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 08:45:00 +00:00
refactor(web): improve types
This commit is contained in:
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|||||||
import { createElement, GestureResponderEvent } from 'react-native';
|
import { createElement, GestureResponderEvent } from 'react-native';
|
||||||
import { NumberProp, TransformProps } from './lib/extract/types';
|
import { NumberProp, TransformProps } from './lib/extract/types';
|
||||||
import SvgTouchableMixin from './lib/SvgTouchableMixin';
|
import SvgTouchableMixin from './lib/SvgTouchableMixin';
|
||||||
import { IterableStyles, resolve } from './lib/resolve';
|
import { resolve } from './lib/resolve';
|
||||||
|
|
||||||
type BlurEvent = Object;
|
type BlurEvent = Object;
|
||||||
type FocusEvent = Object;
|
type FocusEvent = Object;
|
||||||
@@ -49,7 +49,7 @@ interface BaseProps {
|
|||||||
fontSize?: NumberProp;
|
fontSize?: NumberProp;
|
||||||
fontFamily?: string;
|
fontFamily?: string;
|
||||||
forwardedRef: {};
|
forwardedRef: {};
|
||||||
style: IterableStyles<{}>;
|
style: Iterable<{}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-5
@@ -1,11 +1,7 @@
|
|||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
export interface IterableStyles<T> {
|
|
||||||
[Symbol.iterator](): Iterator<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kept in separate file, to avoid name collision with Symbol element
|
// Kept in separate file, to avoid name collision with Symbol element
|
||||||
export function resolve<T>(styleProp: IterableStyles<T>, cleanedProps: T) {
|
export function resolve<T>(styleProp: Iterable<T>, cleanedProps: T) {
|
||||||
if (styleProp) {
|
if (styleProp) {
|
||||||
return StyleSheet
|
return StyleSheet
|
||||||
? [styleProp, cleanedProps]
|
? [styleProp, cleanedProps]
|
||||||
|
|||||||
Reference in New Issue
Block a user