Skip to content

Commit 458c326

Browse files
authored
Swap react-native-dotenv for react-native-config (#71)
1 parent cc842f5 commit 458c326

File tree

7 files changed

+36
-16
lines changed

7 files changed

+36
-16
lines changed

babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3-
plugins: ['module:react-native-dotenv'],
43
};

sample/babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3-
plugins: ['module:react-native-dotenv'],
43
};

sample/ios/Podfile.lock

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ PODS:
315315
- React-jsinspector (0.72.8)
316316
- React-logger (0.72.8):
317317
- glog
318+
- react-native-config (1.5.1):
319+
- react-native-config/App (= 1.5.1)
320+
- react-native-config/App (1.5.1):
321+
- React-Core
318322
- react-native-safe-area-context (4.7.4):
319323
- React-Core
320324
- React-NativeModulesApple (0.72.8):
@@ -464,7 +468,7 @@ PODS:
464468
- RNScreens (3.27.0):
465469
- RCT-Folly (= 2021.07.22.00)
466470
- React-Core
467-
- RNShopifyCheckoutSheetKit (1.0.0):
471+
- RNShopifyCheckoutSheetKit (1.0.2):
468472
- React-Core
469473
- ShopifyCheckoutSheetKit (~> 1.0.1)
470474
- RNVectorIcons (10.0.2):
@@ -499,6 +503,7 @@ DEPENDENCIES:
499503
- React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`)
500504
- React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
501505
- React-logger (from `../../node_modules/react-native/ReactCommon/logger`)
506+
- react-native-config (from `../node_modules/react-native-config`)
502507
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
503508
- React-NativeModulesApple (from `../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
504509
- React-perflogger (from `../../node_modules/react-native/ReactCommon/reactperflogger`)
@@ -578,6 +583,8 @@ EXTERNAL SOURCES:
578583
:path: "../../node_modules/react-native/ReactCommon/jsinspector"
579584
React-logger:
580585
:path: "../../node_modules/react-native/ReactCommon/logger"
586+
react-native-config:
587+
:path: "../node_modules/react-native-config"
581588
react-native-safe-area-context:
582589
:path: "../node_modules/react-native-safe-area-context"
583590
React-NativeModulesApple:
@@ -653,6 +660,7 @@ SPEC CHECKSUMS:
653660
React-jsiexecutor: 03baea362e7475543e7cd091cb4fcf2bd78e041e
654661
React-jsinspector: fdf0a09bddecf9ce8da830bcb89a9814230c04a4
655662
React-logger: c2e7bb772d6e9fc3d0109d1243b81546a9c93c0f
663+
react-native-config: 86038147314e2e6d10ea9972022aa171e6b1d4d8
656664
react-native-safe-area-context: 2cd91d532de12acdb0a9cbc8d43ac72a8e4c897c
657665
React-NativeModulesApple: f6153767facad322a10b07fa2dbd747abbe10302
658666
React-perflogger: 2a7d221549cd5b69e95c5afa2e8d336f0465e1ec
@@ -675,7 +683,7 @@ SPEC CHECKSUMS:
675683
RNGestureHandler: 7909c50383a18f0cb10ce1db7262b9a6da504c03
676684
RNReanimated: b3fe5092e7c7da790180e28c48f31e6b2bd3bfec
677685
RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581
678-
RNShopifyCheckoutSheetKit: 222ec9eafcf1bacd1c0e4f83eccc4d472ef27bd8
686+
RNShopifyCheckoutSheetKit: 80878bf51cf6fbc9466c312dc37102591b4fd65f
679687
RNVectorIcons: 23b6e11af4aaf104d169b1b0afa7e5cf96c676ce
680688
ShopifyCheckoutSheetKit: b5f689803c6ddf5793191d39ef2ae7db52e5936c
681689
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17

sample/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@shopify/checkout-sheet-kit": "*",
2727
"graphql": "^16.8.1",
2828
"jotai": "^2.6.0",
29-
"react-native-dotenv": "^3.4.9",
29+
"react-native-config": "^1.5.1",
3030
"react-native-reanimated": "^3.5.4",
3131
"react-native-safe-area-context": "^4.7.4",
3232
"react-native-screens": "^3.27.0",
@@ -48,7 +48,6 @@
4848
"@babel/preset-env": "^7.20.0",
4949
"@babel/runtime": "^7.20.0",
5050
"@react-native/metro-config": "^0.72.11",
51-
"@types/react-native-dotenv": "^0.2.1",
5251
"@types/react-native-vector-icons": "^6.4.18",
5352
"babel-plugin-module-resolver": "^5.0.0",
5453
"metro-react-native-babel-preset": "0.76.8"

sample/src/App.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {Link, NavigationContainer} from '@react-navigation/native';
2626
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
2727
import {createNativeStackNavigator} from '@react-navigation/native-stack';
2828
import {ApolloClient, InMemoryCache, ApolloProvider} from '@apollo/client';
29-
import {STOREFRONT_DOMAIN, STOREFRONT_ACCESS_TOKEN} from '@env';
29+
import env from 'react-native-config';
3030
import Icon from 'react-native-vector-icons/Entypo';
3131

3232
import CatalogScreen from './screens/CatalogScreen';
@@ -83,11 +83,11 @@ const Stack = createNativeStackNavigator<RootStackParamList>();
8383
export const cache = new InMemoryCache();
8484

8585
const client = new ApolloClient({
86-
uri: `https://${STOREFRONT_DOMAIN}/api/2023-10/graphql.json`,
86+
uri: `https://${env.STOREFRONT_DOMAIN}/api/2023-10/graphql.json`,
8787
cache,
8888
headers: {
8989
'Content-Type': 'application/json',
90-
'X-Shopify-Storefront-Access-Token': STOREFRONT_ACCESS_TOKEN,
90+
'X-Shopify-Storefront-Access-Token': env.STOREFRONT_ACCESS_TOKEN ?? '',
9191
},
9292
});
9393

@@ -168,9 +168,11 @@ function CatalogStack() {
168168
}
169169

170170
function CartIcon() {
171+
const theme = useTheme();
172+
171173
return (
172174
<Link to="/CartModal">
173-
<Icon name="shopping-basket" size={20} />
175+
<Icon name="shopping-basket" size={24} color={theme.colors.secondary} />
174176
</Link>
175177
);
176178
}

sample/src/utils.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import {
1+
import env from 'react-native-config';
2+
import {NativeModules, Platform} from 'react-native';
3+
import {AppConfig} from './context/Config';
4+
5+
const {
26
EMAIL,
37
ADDRESS_1,
48
ADDRESS_2,
@@ -10,9 +14,7 @@ import {
1014
PROVINCE,
1115
ZIP,
1216
PHONE,
13-
} from '@env';
14-
import {NativeModules, Platform} from 'react-native';
15-
import {AppConfig} from './context/Config';
17+
} = env;
1618

1719
export function createBuyerIdentityCartInput(appConfig: AppConfig) {
1820
if (!appConfig.prefillBuyerInformation) {

yarn.lock

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8546,6 +8546,18 @@ __metadata:
85468546
languageName: node
85478547
linkType: hard
85488548

8549+
"react-native-config@npm:^1.5.1":
8550+
version: 1.5.1
8551+
resolution: "react-native-config@npm:1.5.1"
8552+
peerDependencies:
8553+
react-native-windows: ">=0.61"
8554+
peerDependenciesMeta:
8555+
react-native-windows:
8556+
optional: true
8557+
checksum: bde915ccc2c43df5e5a3f1df1c68495b598dc788cd0227d3b7a847b37fd6bbcf094a5cf9932816f7599132fa9e201c1d4db134f99e72565d20c30f69777d07ed
8558+
languageName: node
8559+
linkType: hard
8560+
85498561
"react-native-dotenv@npm:^3.4.9":
85508562
version: 3.4.9
85518563
resolution: "react-native-dotenv@npm:3.4.9"
@@ -9100,13 +9112,12 @@ __metadata:
91009112
"@react-navigation/native-stack": "npm:^6.9.17"
91019113
"@react-navigation/stack": "npm:^6.3.21"
91029114
"@shopify/checkout-sheet-kit": "npm:*"
9103-
"@types/react-native-dotenv": "npm:^0.2.1"
91049115
"@types/react-native-vector-icons": "npm:^6.4.18"
91059116
babel-plugin-module-resolver: "npm:^5.0.0"
91069117
graphql: "npm:^16.8.1"
91079118
jotai: "npm:^2.6.0"
91089119
metro-react-native-babel-preset: "npm:0.76.8"
9109-
react-native-dotenv: "npm:^3.4.9"
9120+
react-native-config: "npm:^1.5.1"
91109121
react-native-reanimated: "npm:^3.5.4"
91119122
react-native-safe-area-context: "npm:^4.7.4"
91129123
react-native-screens: "npm:^3.27.0"

0 commit comments

Comments
 (0)