react-native-box-lite
Advanced tools
Comparing version 0.1.6-beta.2 to 0.1.6-beta.3
{ | ||
"name": "react-native-box-lite", | ||
"version": "0.1.6-beta.2", | ||
"version": "0.1.6-beta.3", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "lint": "eslint .", |
@@ -5,1 +5,2 @@ export * from './Box'; | ||
export * from './Placeholder'; | ||
export {default as PanResponderBox} from './PanResponderBox'; |
@@ -9,1 +9,2 @@ export * from './TextInput'; | ||
export * from './SwitchBox'; | ||
export {default as CalendarItemBox} from './CalendarItemBox'; |
@@ -7,1 +7,2 @@ export * from './DropDowns'; | ||
export * from './PlaceholderBox'; | ||
export * from './CalendarBox'; |
@@ -5,3 +5,3 @@ import {useMemo} from 'react'; | ||
export default function useClassName(props?: VirtualListClassProps) { | ||
export default function useClassVirtualizedList(props?: VirtualListClassProps) { | ||
const getClassStyles = (classString?: string) => | ||
@@ -8,0 +8,0 @@ classString ? getClassNameStyles(classString) : undefined; |
@@ -51,3 +51,3 @@ export type Varian = 'primary' | 'outline' | 'secondary' | 'dark' | 'light'; | ||
className?: string; | ||
classNameText?: string; | ||
classText?: string; | ||
enableDebounce?: boolean; | ||
@@ -345,1 +345,41 @@ delayDebounce?: number; | ||
} | ||
export interface DateFormats { | ||
'YYYY-MM': string; | ||
'YYYY/MM': string; | ||
'YYYY-MM-DD': string; | ||
'YYYY/MM/DD': string; | ||
'MM/DD/YYYY': string; | ||
'DD/MM/YYYY': string; | ||
'DD-MM-YYYY': string; | ||
'MM-DD-YYYY': string; | ||
} | ||
export type DateFormatType = keyof DateFormats; | ||
export interface MonthOfYearType { | ||
year: number; | ||
month: number; | ||
days: DayItemType[]; | ||
} | ||
export interface DayItemType { | ||
dateString: string; | ||
isExtraDay?: boolean; | ||
isToday?: boolean; | ||
day: number; | ||
className?: string; | ||
classText?: string; | ||
disabled?: boolean; | ||
} | ||
export interface SelectedDateItemType { | ||
classBox?: string; | ||
classText?: string; | ||
dot?: boolean; | ||
classDot?: string; | ||
} | ||
export interface SelectedDateType { | ||
[key: string]: SelectedDateItemType; | ||
} |
@@ -17,5 +17,7 @@ import {styleConfig} from './Theme.styles'; | ||
const listClass = className?.split(' '); | ||
return listClass.map(item => { | ||
try { | ||
let customStyles: {[key: string]: number} = {}; | ||
customStyles = listClass.reduce( | ||
(acc, item) => { | ||
const customClass = item.match(/\[(\d+)\]/); | ||
let itemStyle = {}; | ||
if (customClass) { | ||
@@ -26,3 +28,3 @@ const typeClass = item?.split(customClass[0]); | ||
if (customsClass) { | ||
return createSizeCustomStyles( | ||
itemStyle = createSizeCustomStyles( | ||
Number(customClass[1]), | ||
@@ -33,10 +35,10 @@ customsClass[0], | ||
} | ||
return {}; | ||
} else { | ||
return classStyles[item as never] || {}; | ||
itemStyle = classStyles[item as never] || {}; | ||
} | ||
} catch (error) { | ||
return {}; | ||
} | ||
}); | ||
return {...acc, ...itemStyle}; | ||
}, | ||
{...customStyles}, | ||
); | ||
return customStyles; | ||
} | ||
@@ -43,0 +45,0 @@ return {}; |
@@ -25,1 +25,11 @@ import {OnEndReachedProps} from '../model'; | ||
Math.floor(Math.random() * length); | ||
// remove array null | ||
export const insertObjectArrayIf = (condition: any, element: any) => { | ||
return condition?.length > 0 ? element : {}; | ||
}; | ||
// remove object null | ||
export const insertObjectIf = (condition: any, element: any) => { | ||
return condition || condition?.length > 0 ? element : {}; | ||
}; |
@@ -38,7 +38,8 @@ import {CONFIG_BOX} from '../config'; | ||
if (keyStyleSplit.length > 1) { | ||
keyStyleSplit.forEach(item => { | ||
styles[styleProperty] = { | ||
styles[styleProperty] = keyStyleSplit.reduce((acc, item) => { | ||
return { | ||
...acc, | ||
[item]: value, | ||
}; | ||
}); | ||
}, styles[styleProperty] || {}); | ||
} else { | ||
@@ -85,5 +86,11 @@ styles[styleProperty] = { | ||
if (keysStyle.length > 1) { | ||
keysStyle.forEach(item => { | ||
styles[item] = value; | ||
}); | ||
styles = keysStyle.reduce( | ||
(acc, item) => { | ||
return { | ||
...acc, | ||
[item]: value, | ||
}; | ||
}, | ||
{...styles}, | ||
); | ||
} else { | ||
@@ -111,7 +118,8 @@ styles = { | ||
if (keyStyleSplit.length > 1) { | ||
keyStyleSplit.forEach(item => { | ||
styles[styleProperty] = { | ||
styles[styleProperty] = keyStyleSplit.reduce((acc, item) => { | ||
return { | ||
...acc, | ||
[item]: value, | ||
}; | ||
}); | ||
}, styles[styleProperty] || {}); | ||
} else { | ||
@@ -118,0 +126,0 @@ styles[styleProperty] = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8805
307857
63