flow import createStrictShapeTypeChecker from '../createStrictShapeTypeChecker' ; import StyleSheet from '../../exports/StyleSheet/index' ; type ReactPropsCheckType = any ; function StyleSheetPropType ( shape ) { const shapePropType = createStrictShapeTypeChecker ( shape ) ; return function ( props , propName , componentName , location ? , ... rest ) { let newProps = props ; if ( props [ propName ] ) { newProps = { } ; const flatStyle = StyleSheet . flatten ( props [ propName ] ) ; const nextStyle = Object . keys ( flatStyle ) . reduce ( ( acc , curr ) => { if ( curr . indexOf ( '--' ) !== 0 ) { acc [ curr ] = flatStyle [ curr ] ; } return acc ; } , { } as any ) ; newProps [ propName ] = nextStyle ; } return shapePropType ( newProps , propName , componentName , location , ... rest ) ; } ; } export default StyleSheetPropType ;