Repository: callstack/react-native-paper
Pull request #1305 (2019-08-26 13:33:49)

chore: fix babel plugin import
`babel.js` was removed from the `files` field in package.json. It caused fails in release builds (at least Android #1302 ).

### Test plan

it can be tested with the next alpha release.


Patch:
diff --git a/babel.js b/babel.js
index 3ddfa4d58..ab674dd00 100644
--- a/babel.js
+++ b/babel.js
@@ -1,1 +1,1 @@
-module.exports = require('./src/babel');
+module.exports = require('./lib/module/babel/index.js');
diff --git a/package.json b/package.json
index 6ea4aa679..bcca9004c 100644
--- a/package.json
+++ b/package.json
@@ -5,9 +5,9 @@
   "main": "lib/module/index.js",
   "types": "lib/typescript/src/index.d.ts",
   "files": [
-    "src",
     "lib",
-    "dist"
+    "dist",
+    "babel.js"
   ],
   "sideEffects": false,
   "repository": {
@@ -134,4 +134,4 @@
       "src/"
     ]
   }
-}
+}
\ No newline at end of file
diff --git a/src/components/Button.tsx b/src/components/Button.tsx
index 91885c71d..3770c3abc 100644
--- a/src/components/Button.tsx
+++ b/src/components/Button.tsx
@@ -268,15 +268,12 @@ class Button extends React.Component<Props, State> {
               style={[
                 styles.label,
                 compact && styles.compactLabel,
+                uppercase && styles.uppercaseLabel,
                 textStyle,
                 font,
               ]}
             >
-              {React.Children.map(children, child =>
-                typeof child === 'string' && uppercase
-                  ? child.toUpperCase()
-                  : child
-              )}
+              {children}
             </Text>
           </View>
         </TouchableRipple>
@@ -312,6 +309,9 @@ const styles = StyleSheet.create({
   compactLabel: {
     marginHorizontal: 8,
   },
+  uppercaseLabel: {
+    textTransform: 'uppercase',
+  },
 });
 
 export default withTheme(Button);
diff --git a/src/components/Chip.tsx b/src/components/Chip.tsx
index ed962039d..6fd5e953c 100644
--- a/src/components/Chip.tsx
+++ b/src/components/Chip.tsx
@@ -302,7 +302,7 @@ class Chip extends React.Component<Props, State> {
                 accessibilityComponentType="button"
               >
                 <View style={styles.icon}>
-                  <Icon source="cancel" size={16} color={iconColor} />
+                  <Icon source="close-circle" size={16} color={iconColor} />
                 </View>
               </TouchableWithoutFeedback>
             ) : null}
diff --git a/src/components/FAB/FAB.tsx b/src/components/FAB/FAB.tsx
index a01b52754..dc8479d65 100644
--- a/src/components/FAB/FAB.tsx
+++ b/src/components/FAB/FAB.tsx
@@ -217,7 +217,7 @@ class FAB extends React.Component<Props, State> {
             {icon && loading !== true ? (
               <CrossFadeIcon source={icon} size={24} color={foregroundColor} />
             ) : null}
-            {loading && label ? (
+            {loading ? (
               <ActivityIndicator size={18} color={foregroundColor} />
             ) : null}
             {label ? (
diff --git a/src/components/List/ListAccordion.tsx b/src/components/List/ListAccordion.tsx
index 6acde24d9..7a31217a2 100644
--- a/src/components/List/ListAccordion.tsx
+++ b/src/components/List/ListAccordion.tsx
@@ -56,6 +56,16 @@ type Props = {
    * Style that is passed to Description element.
    */
   descriptionStyle?: StyleProp<TextStyle>;
+  /**
+   * Truncate Title text such that the total number of lines does not
+   * exceed this number.
+   */
+  titleNumberOfLines?: number;
+  /**
+   * Truncate Description text such that the total number of lines does not
+   * exceed this number.
+   */
+  descriptionNumberOfLines?: number;
 };
 
 type State = {
@@ -117,6 +127,11 @@ type State = {
 class ListAccordion extends React.Component<Props, State> {
   static displayName = 'List.Accordion';
 
+  static defaultProps: Partial<Props> = {
+    titleNumberOfLines: 1,
+    descriptionNumberOfLines: 2,
+  };
+
   state = {
     expanded: this.props.expanded || false,
   };
@@ -142,6 +157,8 @@ class ListAccordion extends React.Component<Props, State> {
       theme,
       titleStyle,
       descriptionStyle,
+      titleNumberOfLines,
+      descriptionNumberOfLines,
       style,
     } = this.props;
     const titleColor = color(theme.colors.text)
@@ -175,7 +192,7 @@ class ListAccordion extends React.Component<Props, State> {
               : null}
             <View style={[styles.item, styles.content]}>
               <Text
-                numberOfLines={1}
+                numberOfLines={titleNumberOfLines}
                 style={[
                   styles.title,
                   {
@@ -188,7 +205,7 @@ class ListAccordion extends React.Component<Props, State> {
               </Text>
               {description && (
                 <Text
-                  numberOfLines={2}
+                  numberOfLines={descriptionNumberOfLines}
                   style={[
                     styles.description,
                     {
diff --git a/src/components/List/ListItem.tsx b/src/components/List/ListItem.tsx
index e569ac108..0c18b42a1 100644
--- a/src/components/List/ListItem.tsx
+++ b/src/components/List/ListItem.tsx
@@ -71,10 +71,19 @@ type Props = $RemoveChildren<typeof TouchableRipple> & {
    * Style that is passed to Description element.
    */
   descriptionStyle?: StyleProp<TextStyle>;
+  /**
+   * Truncate Title text such that the total number of lines does not
+   * exceed this number.
+   */
+  titleNumberOfLines?: number;
+  /**
+   * Truncate Description text such that the total number of lines does not
+   * exceed this number.
+   */
+  descriptionNumberOfLines?: number;
   /**
    * Ellipsize Mode for the Title
    */
-
   titleEllipsizeMode?: EllipsizeProp;
   /**
    * Ellipsize Mode for the Description
@@ -110,11 +119,20 @@ type Props = $RemoveChildren<typeof TouchableRipple> & {
 class ListItem extends React.Component<Props> {
   static displayName = 'List.Item';
 
+  static defaultProps: Partial<Props> = {
+    titleNumberOfLines: 1,
+    descriptionNumberOfLines: 2,
+  };
+
   renderDescription(
     descriptionColor: string,
     description?: Description | null
   ) {
-    const { descriptionEllipsizeMode, descriptionStyle } = this.props;
+    const {
+      descriptionEllipsizeMode,
+      descriptionStyle,
+      descriptionNumberOfLines,
+    } = this.props;
 
     return typeof description === 'function' ? (
       description({
@@ -124,7 +142,7 @@ class ListItem extends React.Component<Props> {
       })
     ) : (
       <Text
-        numberOfLines={2}
+        numberOfLines={descriptionNumberOfLines}
         ellipsizeMode={descriptionEllipsizeMode}
         style={[
           styles.description,
@@ -147,6 +165,7 @@ class ListItem extends React.Component<Props> {
       theme,
       style,
       titleStyle,
+      titleNumberOfLines,
       titleEllipsizeMode,
       ...rest
     } = this.props;
@@ -180,7 +199,7 @@ class ListItem extends React.Component<Props> {
           <View style={[styles.item, styles.content]} pointerEvents="none">
             <Text
               ellipsizeMode={titleEllipsizeMode}
-              numberOfLines={1}
+              numberOfLines={titleNumberOfLines}
               style={[styles.title, { color: titleColor }, titleStyle]}
             >
               {title}
diff --git a/src/components/Snackbar.tsx b/src/components/Snackbar.tsx
index 1c29f8d65..3f6ad950b 100644
--- a/src/components/Snackbar.tsx
+++ b/src/components/Snackbar.tsx
@@ -257,7 +257,7 @@ class Snackbar extends React.Component<Props, State> {
               compact
               mode="text"
             >
-              {action.label.toUpperCase()}
+              {action.label}
             </Button>
           ) : null}
         </Surface>


Test patch:
diff --git a/src/components/__tests__/__snapshots__/Banner.test.js.snap b/src/components/__tests__/__snapshots__/Banner.test.js.snap
index 294f76703..fb100ea8f 100644
--- a/src/components/__tests__/__snapshots__/Banner.test.js.snap
+++ b/src/components/__tests__/__snapshots__/Banner.test.js.snap
@@ -267,6 +267,9 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
                       Object {
                         "marginHorizontal": 8,
                       },
+                      Object {
+                        "textTransform": "uppercase",
+                      },
                       Object {
                         "color": "#6200ee",
                         "fontFamily": "System",
@@ -280,7 +283,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
                   ]
                 }
               >
-                FIRST
+                first
               </Text>
             </View>
           </View>
@@ -440,6 +443,9 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
                       Object {
                         "marginHorizontal": 8,
                       },
+                      Object {
+                        "textTransform": "uppercase",
+                      },
                       Object {
                         "color": "#6200ee",
                         "fontFamily": "System",
@@ -453,7 +459,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
                   ]
                 }
               >
-                FIRST
+                first
               </Text>
             </View>
           </View>
@@ -527,6 +533,9 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
                       Object {
                         "marginHorizontal": 8,
                       },
+                      Object {
+                        "textTransform": "uppercase",
+                      },
                       Object {
                         "color": "#6200ee",
                         "fontFamily": "System",
@@ -540,7 +549,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
                   ]
                 }
               >
-                SECOND
+                second
               </Text>
             </View>
           </View>
diff --git a/src/components/__tests__/__snapshots__/Button.test.js.snap b/src/components/__tests__/__snapshots__/Button.test.js.snap
index 13eff66aa..82e5f5a16 100644
--- a/src/components/__tests__/__snapshots__/Button.test.js.snap
+++ b/src/components/__tests__/__snapshots__/Button.test.js.snap
@@ -67,6 +67,9 @@ exports[`renders button with color 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#e91e63",
                 "fontFamily": "System",
@@ -80,7 +83,7 @@ exports[`renders button with color 1`] = `
           ]
         }
       >
-        CUSTOM BUTTON
+        Custom Button
       </Text>
     </View>
   </View>
@@ -198,6 +201,9 @@ exports[`renders button with icon 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#6200ee",
                 "fontFamily": "System",
@@ -211,7 +217,7 @@ exports[`renders button with icon 1`] = `
           ]
         }
       >
-        ICON BUTTON
+        Icon Button
       </Text>
     </View>
   </View>
@@ -292,6 +298,9 @@ exports[`renders contained contained with mode 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#ffffff",
                 "fontFamily": "System",
@@ -305,7 +314,7 @@ exports[`renders contained contained with mode 1`] = `
           ]
         }
       >
-        CONTAINED BUTTON
+        Contained Button
       </Text>
     </View>
   </View>
@@ -383,6 +392,9 @@ exports[`renders disabled button 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "rgba(0, 0, 0, 0.32)",
                 "fontFamily": "System",
@@ -396,7 +408,7 @@ exports[`renders disabled button 1`] = `
           ]
         }
       >
-        DISABLED BUTTON
+        Disabled Button
       </Text>
     </View>
   </View>
@@ -653,6 +665,9 @@ exports[`renders loading button 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#6200ee",
                 "fontFamily": "System",
@@ -666,7 +681,7 @@ exports[`renders loading button 1`] = `
           ]
         }
       >
-        LOADING BUTTON
+        Loading Button
       </Text>
     </View>
   </View>
@@ -740,6 +755,9 @@ exports[`renders outlined button with mode 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#6200ee",
                 "fontFamily": "System",
@@ -753,7 +771,7 @@ exports[`renders outlined button with mode 1`] = `
           ]
         }
       >
-        OUTLINED BUTTON
+        Outlined Button
       </Text>
     </View>
   </View>
@@ -827,6 +845,9 @@ exports[`renders text button by default 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#6200ee",
                 "fontFamily": "System",
@@ -840,7 +861,7 @@ exports[`renders text button by default 1`] = `
           ]
         }
       >
-        TEXT BUTTON
+        Text Button
       </Text>
     </View>
   </View>
@@ -914,6 +935,9 @@ exports[`renders text button with mode 1`] = `
                 "textAlign": "center",
               },
               undefined,
+              Object {
+                "textTransform": "uppercase",
+              },
               Object {
                 "color": "#6200ee",
                 "fontFamily": "System",
@@ -927,7 +951,7 @@ exports[`renders text button with mode 1`] = `
           ]
         }
       >
-        TEXT BUTTON
+        Text Button
       </Text>
     </View>
   </View>
diff --git a/src/components/__tests__/__snapshots__/Chip.test.js.snap b/src/components/__tests__/__snapshots__/Chip.test.js.snap
index 0d1b156a4..594883973 100644
--- a/src/components/__tests__/__snapshots__/Chip.test.js.snap
+++ b/src/components/__tests__/__snapshots__/Chip.test.js.snap
@@ -169,7 +169,7 @@ exports[`renders chip with close button 1`] = `
             ]
           }
         >
-          
+          
         </Text>
       </View>
     </View>
diff --git a/src/components/__tests__/__snapshots__/Menu.test.js.snap b/src/components/__tests__/__snapshots__/Menu.test.js.snap
index b38af75e8..b09e5280c 100644
--- a/src/components/__tests__/__snapshots__/Menu.test.js.snap
+++ b/src/components/__tests__/__snapshots__/Menu.test.js.snap
@@ -70,6 +70,9 @@ exports[`renders menu with content styles 1`] = `
                   "textAlign": "center",
                 },
                 undefined,
+                Object {
+                  "textTransform": "uppercase",
+                },
                 Object {
                   "color": "#6200ee",
                   "fontFamily": "System",
@@ -83,7 +86,7 @@ exports[`renders menu with content styles 1`] = `
             ]
           }
         >
-          OPEN MENU
+          Open menu
         </Text>
       </View>
     </View>
@@ -161,6 +164,9 @@ exports[`renders not visible menu 1`] = `
                   "textAlign": "center",
                 },
                 undefined,
+                Object {
+                  "textTransform": "uppercase",
+                },
                 Object {
                   "color": "#6200ee",
                   "fontFamily": "System",
@@ -174,7 +180,7 @@ exports[`renders not visible menu 1`] = `
             ]
           }
         >
-          OPEN MENU
+          Open menu
         </Text>
       </View>
     </View>
@@ -252,6 +258,9 @@ exports[`renders visible menu 1`] = `
                   "textAlign": "center",
                 },
                 undefined,
+                Object {
+                  "textTransform": "uppercase",
+                },
                 Object {
                   "color": "#6200ee",
                   "fontFamily": "System",
@@ -265,7 +274,7 @@ exports[`renders visible menu 1`] = `
             ]
           }
         >
-          OPEN MENU
+          Open menu
         </Text>
       </View>
     </View>
diff --git a/src/components/__tests__/__snapshots__/Snackbar.test.js.snap b/src/components/__tests__/__snapshots__/Snackbar.test.js.snap
index 451ef410d..986c5f641 100644
--- a/src/components/__tests__/__snapshots__/Snackbar.test.js.snap
+++ b/src/components/__tests__/__snapshots__/Snackbar.test.js.snap
@@ -212,6 +212,9 @@ exports[`renders snackbar with action button 1`] = `
                   Object {
                     "marginHorizontal": 8,
                   },
+                  Object {
+                    "textTransform": "uppercase",
+                  },
                   Object {
                     "color": "#03dac4",
                     "fontFamily": "System",
@@ -225,7 +228,7 @@ exports[`renders snackbar with action button 1`] = `
               ]
             }
           >
-            UNDO
+            Undo
           </Text>
         </View>
       </View>