You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's some problems with GC in my use case that are supposedly not going to be fixed, so I'd like to fork and fix them myself. However I'm having a really hard time with this due to the complications of npm prepublish and postinstall scrips and also likely to do with the use of TS. I tried to follow along some previous related issue: [#1265 ] but in the end it still didn't work. There seems to be a decent amount of confusion around this: [#1245 ] and [#1603] (where a user mentions not being able to get a fork to work). Obviously a lot of people are getting this to work so its certainly doable, but I think the difficulties are specific to this library (searching/googling has been unhelpful).
At this point I made the following changes (based on [#1265]):
In my own project, I added the postinstall script suggested to package.json.
In my fork of GC, I changed main: to "lib/index.js" in package.json
I install my fork with the command: npm install --save "charles-goode/react-native-gifted-chat" and when running my app via expo, I get the following variant of the error in the title of #1265:
While trying to resolve module react-native-gifted-chat from file C:\Users\goode\Dive\screens\GiftedChatScreen.js, the package C:\Users\goode\Dive\node_modules\react-native-gifted-chat\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (C:\Users\goode\Dive\node_modules\react-native-gifted-chat\lib\index.js. Indeed, none of these files exist:
If I try to install my fork with yarn add charles-goode/react-native-gifted-chat. It fails in the build of my fork on the build command: rm -rf lib/ && node_modules/.bin/tsc && cp flow-typedefs/*.js.flow lib/ because of 24 TS errors. This is the same problem that a user has in the last comment on [#1265].
Ok after manually "fixing" the errors produced by tsc, it would seem that my fork installed into my app correctly. By the way most of the errors have to do with incorrect prop types for instances where a style prop is defined with as an object with a left property and right property.
So I would say the full solution is the following steps:
press fork on GC
clone your fork
Change main in package.json to lib/index.js (this might not be necessary if rest of commands execute without error)
Try to build (with yarn) so you get a list of TS errors
Fix them
make desired changes, commit, and push
In main app add the following to script in package.json: "postinstall": "cd node_modules/react-native-gifted-chat && yarn install && yarn lint && yarn build && yarn config:npm && rm -rf node_modules"
Issue Description
There's some problems with GC in my use case that are supposedly not going to be fixed, so I'd like to fork and fix them myself. However I'm having a really hard time with this due to the complications of npm prepublish and postinstall scrips and also likely to do with the use of TS. I tried to follow along some previous related issue: [#1265 ] but in the end it still didn't work. There seems to be a decent amount of confusion around this: [#1245 ] and [#1603] (where a user mentions not being able to get a fork to work). Obviously a lot of people are getting this to work so its certainly doable, but I think the difficulties are specific to this library (searching/googling has been unhelpful).
At this point I made the following changes (based on [#1265]):
In my own project, I added the postinstall script suggested to package.json.
In my fork of GC, I changed main: to "lib/index.js" in package.json
I install my fork with the command:
npm install --save "charles-goode/react-native-gifted-chat"
and when running my app via expo, I get the following variant of the error in the title of #1265:While trying to resolve module
react-native-gifted-chat
from fileC:\Users\goode\Dive\screens\GiftedChatScreen.js
, the packageC:\Users\goode\Dive\node_modules\react-native-gifted-chat\package.json
was successfully found. However, this package itself specifies amain
module field that could not be resolved (C:\Users\goode\Dive\node_modules\react-native-gifted-chat\lib\index.js
. Indeed, none of these files exist:C:\Users\goode\Dive\node_modules\react-native-gifted-chat\lib\index.js(.native|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
C:\Users\goode\Dive\node_modules\react-native-gifted-chat\lib\index.js\index(.native|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
Nodejs version: 12.14.0
Expo SDK 36
react-native-gifted-chat version: Just forked, so the most recent (says 0.14 in the package.json).
Platform(s) (iOS, Android, or both?): Both but also N/A
TypeScript version: I don't use TS in my project.
The text was updated successfully, but these errors were encountered: