Skip to content

Commit

Permalink
use generic react-native-flash-message library to display info/error
Browse files Browse the repository at this point in the history
message
  • Loading branch information
kamalkishor1991 committed Oct 8, 2024
1 parent 69c3ad8 commit c1c3515
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ApplicationRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import UserProfile from './screens/UserProfileScreen.js';
import useApplicationStore from './hooks/useApplicationStore.js';
import ExplorePaletteScreen from './screens/ExplorePaletteScreen.js';
import { notifyMessage } from './libs/Helpers.js';
import FlashMessage from "react-native-flash-message";


const Stack = createNativeStackNavigator();

Expand Down Expand Up @@ -148,6 +150,7 @@ export default function App() {
</AppAuthProvider>
</NavigationContainer>
</View>
<FlashMessage position="top" />
</SideMenu>
</GestureHandlerRootView>
);
Expand Down
8 changes: 4 additions & 4 deletions ios/croma.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 50;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = FH9K879287;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = croma/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -501,14 +501,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 50;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = FH9K879287;
INFOPLIST_FILE = croma/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0;
MARKETING_VERSION = 3.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
15 changes: 9 additions & 6 deletions libs/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { NativeModules, Platform, Alert, ToastAndroid } from 'react-native';
import * as RNIap from 'react-native-iap';
import { requestPurchase, getProducts } from 'react-native-iap';
import { sendClientErrorAsync } from '../network/errors';
import { showMessage } from "react-native-flash-message";
import Colors from '../constants/Styles';


const isProduction = () => {
// eslint-disable-next-line no-undef
Expand Down Expand Up @@ -181,12 +184,12 @@ const getPlanPrice = async (currentPlan, toPlans) => {
}
};

function notifyMessage(msg, duration = ToastAndroid.LONG) {
if (Platform.OS === 'android') {
ToastAndroid.show(msg, duration);
} else {
Alert.alert(msg);
}
function notifyMessage(msg) {
showMessage({
message: msg,
backgroundColor: Colors.primary,
duration: 3000,
});
}

function extractHexColors1(text) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"react-native-draggable-flatlist": "^4.0.1",
"react-native-encrypted-storage": "^4.0.3",
"react-native-exception-handler": "^2.10.10",
"react-native-flash-message": "^0.4.2",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.19.0",
"react-native-get-random-values": "^1.11.0",
Expand Down
24 changes: 24 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3520,6 +3520,7 @@ __metadata:
react-native-draggable-flatlist: ^4.0.1
react-native-encrypted-storage: ^4.0.3
react-native-exception-handler: ^2.10.10
react-native-flash-message: ^0.4.2
react-native-fs: ^2.20.0
react-native-gesture-handler: ^2.19.0
react-native-get-random-values: ^1.11.0
Expand Down Expand Up @@ -10232,6 +10233,20 @@ __metadata:
languageName: node
linkType: hard

"react-native-flash-message@npm:^0.4.2":
version: 0.4.2
resolution: "react-native-flash-message@npm:0.4.2"
dependencies:
prop-types: ^15.8.1
react-native-iphone-screen-helper: ^2.0.2
peerDependencies:
prop-types: ^15.0 || ^16.0
react: "*"
react-native: "*"
checksum: ab1e83db9f75888607cdeac8160194630a3e16f5e16133b6316d595b392b92f1c3b8e597e365636dcf3c622a4a5731753ce24fe9710867335c06ec0d212c5178
languageName: node
linkType: hard

"react-native-fs@npm:^2.20.0":
version: 2.20.0
resolution: "react-native-fs@npm:2.20.0"
Expand Down Expand Up @@ -10298,6 +10313,15 @@ __metadata:
languageName: node
linkType: hard

"react-native-iphone-screen-helper@npm:^2.0.2":
version: 2.1.2
resolution: "react-native-iphone-screen-helper@npm:2.1.2"
peerDependencies:
react-native: ">=0.42.0"
checksum: 20a59d0596d836b2a98eaedbf83662cbb318998c4de0d378c9a39d2ea33184c578e8aba0731acbc98b47d362b6ef7323b61c664715b011c7c6e39b926557ada7
languageName: node
linkType: hard

"react-native-linear-gradient@npm:^2.8.3":
version: 2.8.3
resolution: "react-native-linear-gradient@npm:2.8.3"
Expand Down

0 comments on commit c1c3515

Please sign in to comment.