UNPKG

3.06 kBSource Map (JSON)View Raw
1{"version":3,"sources":["DataTableCell.tsx"],"names":["DataTableCell","children","style","numeric","rest","styles","container","right","displayName","StyleSheet","create","flex","flexDirection","alignItems","justifyContent"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,aAAa,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,KAAZ;AAAmBC,EAAAA,OAAnB;AAA4B,KAAGC;AAA/B,CAAD,kBACpB,oBAAC,wBAAD,eACMA,IADN;AAEE,EAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBH,OAAO,IAAIE,MAAM,CAACE,KAArC,EAA4CL,KAA5C;AAFT,iBAIE,oBAAC,aAAD;AAAM,EAAA,aAAa,EAAE;AAArB,GAAyBD,QAAzB,CAJF,CADF;;AASAD,aAAa,CAACQ,WAAd,GAA4B,gBAA5B;;AAEA,MAAMH,MAAM,GAAGI,wBAAWC,MAAX,CAAkB;AAC/BJ,EAAAA,SAAS,EAAE;AACTK,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,aAAa,EAAE,KAFN;AAGTC,IAAAA,UAAU,EAAE;AAHH,GADoB;AAO/BN,EAAAA,KAAK,EAAE;AACLO,IAAAA,cAAc,EAAE;AADX;AAPwB,CAAlB,CAAf;;eAYed,a","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, StyleProp, ViewStyle } from 'react-native';\nimport Text from '../Typography/Text';\nimport TouchableRipple from '../TouchableRipple/TouchableRipple';\nimport type { $RemoveChildren } from '../../types';\n\ntype Props = $RemoveChildren<typeof TouchableRipple> & {\n /**\n * Content of the `DataTableCell`.\n */\n children: React.ReactNode;\n /**\n * Align the text to the right. Generally monetary or number fields are aligned to right.\n */\n numeric?: boolean;\n /**\n * Function to execute on press.\n */\n onPress?: () => void;\n style?: StyleProp<ViewStyle>;\n};\n\n/**\n * A component to show a single cell inside of a table.\n *\n * <div class=\"screenshots\">\n * <figure>\n * <img class=\"medium\" src=\"screenshots/data-table-row-cell.png\" />\n * </figure>\n * </div>\n *\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { DataTable } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <DataTable.Row>\n * <DataTable.Cell numeric>1</DataTable.Cell>\n * <DataTable.Cell numeric>2</DataTable.Cell>\n * <DataTable.Cell numeric>3</DataTable.Cell>\n * <DataTable.Cell numeric>4</DataTable.Cell>\n * </DataTable.Row>\n * );\n *\n * export default MyComponent;\n * ```\n *\n * If you want to support multiline text, please use View instead, as multiline text doesn't comply with\n * MD Guidelines (https://github.com/callstack/react-native-paper/issues/2381).\n */\n\nconst DataTableCell = ({ children, style, numeric, ...rest }: Props) => (\n <TouchableRipple\n {...rest}\n style={[styles.container, numeric && styles.right, style]}\n >\n <Text numberOfLines={1}>{children}</Text>\n </TouchableRipple>\n);\n\nDataTableCell.displayName = 'DataTable.Cell';\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n },\n\n right: {\n justifyContent: 'flex-end',\n },\n});\n\nexport default DataTableCell;\n"]}
\No newline at end of file