rn-css 1.11.11 → 1.12.0
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.
- package/dist/styleComponent.js +3 -2
- package/package.json +1 -1
- package/src/styleComponent.tsx +4 -3
package/dist/styleComponent.js
CHANGED
|
@@ -158,8 +158,9 @@ const styled = (Component) => {
|
|
|
158
158
|
const ComponentWithAttrs = styledComponent(chunks, ...functs);
|
|
159
159
|
// We need to limit the props control to only Result https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABBATgUwIZTQUQB7ZgAmaRAwnALYAOAPAAopzUDOAfABQU0BciH1Jqz6NmLAJSIAvG0QYwAT0kBvAFCJkCFlET5CJYt2rT+gsSKETpstRo3ooIFEiMDL49YgC+nvWmL+5FTUAHRYUCgsJrQASmgsIAA2OmgEgVH0GCiwGIkMlmyc4ZF8cQnJkjKItnYQWjqMaHVgwDAA5k5YpEYmbua6eBCJICT5YgA0iGVJUGyVNp52iA5OLsEcyiFbZqyTW2FQESxeHks+SyvOiI3NrR0oXUE0nufLaI5XfgGGwao+qqBILAEIgen1hNVENhtHxtCgYGA2pNtApEmhYREEW1vCpPJckDsWH9VM1tNd0Ld2j0pMh0F0viQntQuMFxAcjhsofEoHwAORwADWvJxqhuCDurmUiBRaL50KgwpOQA
|
|
160
160
|
const ForwardRefComponent = react_1.default.forwardRef((props, ref) => {
|
|
161
|
-
const
|
|
162
|
-
|
|
161
|
+
const castProps = props;
|
|
162
|
+
const attrs = (opts instanceof Function) ? opts(castProps) : opts;
|
|
163
|
+
return react_1.default.createElement(ComponentWithAttrs, { ref: ref, ...attrs, ...castProps });
|
|
163
164
|
});
|
|
164
165
|
// TODO : Find a way to remove from the Props the properties affected by opts
|
|
165
166
|
return ForwardRefComponent;
|
package/package.json
CHANGED
package/src/styleComponent.tsx
CHANGED
|
@@ -187,8 +187,9 @@ const styled = <StyleType, InitialProps extends { style?: StyleProp<StyleType> }
|
|
|
187
187
|
const ComponentWithAttrs = styledComponent(chunks, ...functs)
|
|
188
188
|
// We need to limit the props control to only Result https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABBATgUwIZTQUQB7ZgAmaRAwnALYAOAPAAopzUDOAfABQU0BciH1Jqz6NmLAJSIAvG0QYwAT0kBvAFCJkCFlET5CJYt2rT+gsSKETpstRo3ooIFEiMDL49YgC+nvWmL+5FTUAHRYUCgsJrQASmgsIAA2OmgEgVH0GCiwGIkMlmyc4ZF8cQnJkjKItnYQWjqMaHVgwDAA5k5YpEYmbua6eBCJICT5YgA0iGVJUGyVNp52iA5OLsEcyiFbZqyTW2FQESxeHks+SyvOiI3NrR0oXUE0nufLaI5XfgGGwao+qqBILAEIgen1hNVENhtHxtCgYGA2pNtApEmhYREEW1vCpPJckDsWH9VM1tNd0Ld2j0pMh0F0viQntQuMFxAcjhsofEoHwAORwADWvJxqhuCDurmUiBRaL50KgwpOQA
|
|
189
189
|
const ForwardRefComponent = React.forwardRef<any, Omit<Props, keyof Result> & Part & Partial<Pick<Props, Extract<keyof Props, keyof Result>>>>((props, ref) => {
|
|
190
|
-
const
|
|
191
|
-
|
|
190
|
+
const castProps = props as unknown as Props & Part
|
|
191
|
+
const attrs = (opts instanceof Function) ? opts(castProps) : opts
|
|
192
|
+
return <ComponentWithAttrs ref={ref} {...attrs} {...castProps} />
|
|
192
193
|
})
|
|
193
194
|
// TODO : Find a way to remove from the Props the properties affected by opts
|
|
194
195
|
return ForwardRefComponent
|
|
@@ -206,6 +207,6 @@ styledSectionList.attrs = <S, Result extends Partial<S & SectionListProps<any> &
|
|
|
206
207
|
export const styledVirtualizedList = <S, >(chunks: TemplateStringsArray, ...functs: (Primitive | Functs<S & VirtualizedListProps<any> & OptionalProps>)[]) => <Type, >(props: S & OptionalProps & VirtualizedListProps<Type>) => invoke(styled<ViewStyle, VirtualizedListProps<Type>>(VirtualizedList)(chunks, ...functs), props)
|
|
207
208
|
styledVirtualizedList.attrs = <S, Result extends Partial<S & VirtualizedListProps<any> & OptionalProps> = {} >(opts: Result | ((props: S & OptionalProps & VirtualizedListProps<any>) => Result)) => (chunks: TemplateStringsArray, ...functs: (Primitive | Functs<S>)[]) => <Props, >(componentProps: Omit<VirtualizedListProps<Props> & OptionalProps, keyof Result> & S & Partial<Result>) => invoke(styled<ViewStyle, VirtualizedListProps<Props>>(VirtualizedList).attrs<S>(opts)(chunks, ...functs), componentProps as any)
|
|
208
209
|
|
|
209
|
-
function invoke<T> (Component: React.ComponentType<T>, props: T) {
|
|
210
|
+
function invoke<T extends object> (Component: React.ComponentType<T>, props: T) {
|
|
210
211
|
return <Component {...props} />
|
|
211
212
|
}
|