Skip to content

What to do when there's "src" and "lib" directory #304

@aprilmintacpineda

Description

@aprilmintacpineda

There are modules that deliver their libraries already built, but still includes the src. Patching the lib is not going to be easy as it's most likely already transpiled and also patch-package doesn't seem to be able to recognize changes in there...

I'm currently stuck on this problem, I use react-native-paper, it ships with both "lib" and "src":

image

my patches where applied to src

diff --git a/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx b/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
index 3b71389..a874e2b 100644
--- a/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
+++ b/node_modules/react-native-paper/src/components/Avatar/AvatarImage.tsx
@@ -58,6 +58,8 @@ const AvatarImage = ({
   source,
   style,
   theme,
+  onError,
+  onLoad,
   ...rest
 }: Props) => {
   const { colors } = theme;
@@ -82,6 +84,8 @@ const AvatarImage = ({
         <Image
           source={source}
           style={{ width: size, height: size, borderRadius: size / 2 }}
+          onError={onError}
+          onLoad={onLoad}
         />
       )}
     </View>
diff --git a/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx b/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
index 503cfab..cd3933d 100644
--- a/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
+++ b/node_modules/react-native-paper/src/components/Drawer/DrawerItem.tsx
@@ -5,6 +5,7 @@ import Text from '../Typography/Text';
 import Icon, { IconSource } from '../Icon';
 import TouchableRipple from '../TouchableRipple/TouchableRipple';
 import { withTheme } from '../../core/theming';
+import Badge from '../Badge';
 
 type Props = React.ComponentPropsWithRef<typeof View> & {
   /**
@@ -67,6 +68,7 @@ const DrawerItem = ({
   style,
   onPress,
   accessibilityLabel,
+  badge,
   ...rest
 }: Props) => {
   const { colors, roundness } = theme;
@@ -100,22 +102,25 @@ const DrawerItem = ({
         accessibilityState={{ selected: active }}
         accessibilityLabel={accessibilityLabel}
       >
-        <View style={styles.wrapper}>
-          {icon ? <Icon source={icon} size={24} color={contentColor} /> : null}
-          <Text
-            selectable={false}
-            numberOfLines={1}
-            style={[
-              styles.label,
-              {
-                color: contentColor,
-                ...font,
-                marginLeft: labelMargin,
-              },
-            ]}
-          >
-            {label}
-          </Text>
+        <View style={styles.badgeContainer}>
+          <View style={styles.wrapper}>
+            {icon ? <Icon source={icon} size={24} color={contentColor} /> : null}
+            <Text
+              selectable={false}
+              numberOfLines={1}
+              style={[
+                styles.label,
+                {
+                  color: contentColor,
+                  ...font,
+                  marginLeft: labelMargin,
+                },
+              ]}
+            >
+              I am patch-package
+            </Text>
+          </View>
+          {!isNaN(badge) ? <Badge visible={Boolean(badge)}>{badge}</Badge> : null}
         </View>
       </TouchableRipple>
     </View>
@@ -131,12 +136,17 @@ const styles = StyleSheet.create({
   },
   wrapper: {
     flexDirection: 'row',
-    alignItems: 'center',
-    padding: 8,
+    alignItems: 'center'
   },
   label: {
     marginRight: 32,
   },
+  badgeContainer: {
+    flexDirection: 'row',
+    justifyContent: 'space-between',
+    alignItems: 'center',
+    padding: 8,
+  },
 });
 
 export default withTheme(DrawerItem);

When I build my app for production, the patches don't seem to get applied, as you can see above, there's I am patch package, just for me to verify if my patch is getting applied, but I don't see it on the build app. This is currently preventing me from deploying my app as it's a critical bug for me.

IT WORKS IN DEVELOPMENT MODE BUT NOT IN PRODUCTION is what I'm trying to say in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions