Reputation: 10967
I have three react native projects each with their own repo.
They use very similar components, is there a way I can share these components across repo's, so I don't have to update each repo independently?
Or can I create three different apps, from one repo? with only very slight changes to images and configs for each app.
Upvotes: 2
Views: 385
Reputation: 4631
In my project, I separated my core parts with each npm package.
npm
package and put your shared components into that.npm link
or specify your local package's absolute path with npm install
.npm
repository with private mode.You can separate your running environment with react-native-config. With this package, created multiple environments .env
or .env.production
you can separate your runtime variables with ENVFILE=.env npm start
or ENVFILE=.env.production npm start
. Then in your javascript code, you can refer your each runtime settings.
import Config from 'react-native-config';
const isProduction = Config.environment === 'production';
<Image source={isProduction ? require(..production_image) : require(..development_image)} />
How to show your slight difference in your app depends on you. like Platform.os === 'ios'
Upvotes: 2
Reputation: 252
Refere this: https://github.com/luggit/react-native-config
You can create different builds : Production, staging, testing.
You can set multiple environment and generate build.
Upvotes: 0