import React, { forwardRef } from 'react';
import { Pressable as RNPressable, } from 'react-native';
import { createStyleSheet, normalizeValue, viewStyles, } from '../../styled';
export const Pressable = forwardRef((props, ref) => {
    const styles = {};
    const attrs = {};
    Object.entries(props).forEach(([prop, value]) => {
        const styleProp = prop;
        const styleValue = value;
        const attrsProp = prop;
        if (viewStyles.includes(styleProp)) {
            styles[styleProp] = (state) => normalizeValue(styleProp, typeof styleValue === 'function' ? styleValue(state) : styleValue);
        }
        else {
            attrs[attrsProp] = value;
        }
    });
    const style = (state) => createStyleSheet({
        style: Object.entries(styles).reduce((styles, [prop, value]) => (Object.assign(Object.assign({}, styles), {
            [prop]: value(state),
        })), {}),
    }).style;
    return <RNPressable {...attrs} ref={ref} style={style}/>;
});
Pressable.displayName = 'Pressable';
//# sourceMappingURL=Pressable.jsx.map