integration with patch-package
See original GitHub issueCurrent behaviour
Expected behaviour
I’m trying to apply the following patch:
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);
These are some of my custom changes, it seems to work when running my app locally on my device, but when I deploy it to production, I don’t see my patches being applied, I even put I am patch-package there in purpose just to see, but it didn’t work.
I’m running the build and deploy using this bash script
export STAGE="<hidden value>"
export API_BASE_URL="<hidden value>"
export APPLE_ID="<hidden value>"
export APPSTORE_ISSUER_ID="<hidden value>"
export APPSTORE_KEY_ID="<hidden value>"
export APPSTORE_TEAM_ID="<hidden value>"
export MATCH_GIT_BASIC_AUTHORIZATION="<hidden value>"
export MATCH_PASSWORD="<hidden value>"
export MATCH_REPO="<hidden value>"
rm -rf ios-build
git clone <hidden value>.git ios-build
cp FastlaneDeploymentCI.p8 ios-build/ios/FastlaneDeploymentCI.p8
cp GoogleService-Info.plist ios-build/ios/my-app/GoogleService-Info.plist
cd ios-build
cp src/env.example.js src/env.js
bundle
yarn --prefer-offline
cd ios
NODE_ENV=production pod install
yarn patch-package
bundle exec fastlane ios preprod
cd ../../
rm -rf ios-build
As you can see, I’m already manually running the yarn patch-package
command, plus on my package.json
, I have "postinstall": "husky install && patch-package",
but I manually ran patch-package
while debugging because I’m trying to figure out why it’s happening, he only reason I can see is because there’s src
and lib
. It could be that when building for production, the metro bundler is looking at lib
instead of src
, but all my patches are in src
not in lib
because the lib
is built, that would mean I will have to build react-native-paper locally but I can’t because I don’t think the files I get are complete, bob build
fails when I try it out.
Code sample
N/A
Screenshots (if applicable)
N/A
What have you tried
N/A
Your Environment
software | version |
---|---|
ios or android | |
react-native | |
react-native-paper | |
node | |
npm or yarn | |
expo sdk |
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top GitHub Comments
Couldn’t find version numbers for the following packages in the issue:
react-native
react-native-paper
react-native-vector-icons
yarn
npm
expo
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
REF: https://github.com/ds300/patch-package/issues/304