Skip to content

Commit

Permalink
Fix few minor issues and commented out non working slider color picker
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalkishor1991 committed Sep 27, 2024
1 parent 3d5a3d8 commit 0162799
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 22 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"i18n-ally.localesPaths": [
"locales"
]
}
19 changes: 11 additions & 8 deletions components/ColorPickerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { ScrollView, View, StyleSheet, TouchableOpacity, Text, TextInput } from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import { logEvent, notifyMessage } from '../libs/Helpers';
import SliderColorPicker from './SliderColorPicker';
//import SliderColorPicker from './SliderColorPicker';
import AIColorPicker from './AIColorPicker';
import { CromaColorPicker } from './CromaColorPicker';
import Colors from '../constants/Styles';
Expand Down Expand Up @@ -61,11 +61,13 @@ export default function ColorPickerModal({ initialColor, onColorSelected, onClos
title: 'Color Wheel',
component: <WheelColorPicker color={color} onColorChange={(color) => setColor(color)} />
},
/*
{
key: 'HSB',
title: 'HSB',
component: <SliderColorPicker color={`${color}`} setColor={setColor} />
},
*/
{
key: 'AI',
title: 'AI',
Expand Down Expand Up @@ -94,7 +96,12 @@ export default function ColorPickerModal({ initialColor, onColorSelected, onClos
}, [activeTab]);

return (
<View style={styles.container}>
<View
style={styles.container}
onStartShouldSetResponder={(e) => {
e.stopPropagation();
return true;
}}>
<View style={styles.tabContainer}>
{tabs.map((tab) => (
<TouchableOpacity
Expand All @@ -109,13 +116,9 @@ export default function ColorPickerModal({ initialColor, onColorSelected, onClos
contentContainerStyle={styles.scrollViewContent}
scrollEnabled={activeTab !== 'wheel'} // TODO: find if there is some other way to solve this issue. - https://github.com/croma-app/huehive-mobile-app/pull/236/files#r1609216412
showsVerticalScrollIndicator={false}>
<TouchableOpacity
onPress={(e) => {
e.stopPropagation();
}}
style={styles.colorPickerContainer}>
<View style={styles.colorPickerContainer}>
{tabs.find((tab) => tab.key === activeTab)?.component}
</TouchableOpacity>
</View>
</ScrollView>
<View style={styles.bottomContainer}>
<View style={styles.selectedColorView}>
Expand Down
2 changes: 1 addition & 1 deletion components/SliderColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function SliderColorPicker(props) {
/>
</View>
<View style={{ marginHorizontal: 24, marginTop: 20, height: 36, width: width - 48 }}>
<Text>Seturation({hsv.s.toFixed(2)})</Text>
<Text>Saturation({hsv.s.toFixed(2)})</Text>
<SliderSaturationPicker
oldColor={color}
trackStyle={[{ height: 12, width: width - 48 }]}
Expand Down
21 changes: 12 additions & 9 deletions hooks/useIAPConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type PurchaseError,
flushFailedPurchasesCachedAsPendingAndroid,
finishTransaction,
ErrorCode,
} from 'react-native-iap';
import { notifyMessage, logEvent, sendClientError } from '../libs/Helpers';
// https://react-native-iap.dooboolab.com/docs/guides/purchases
Expand Down Expand Up @@ -51,15 +52,17 @@ const useIAPConnection = () => {
);
purchaseErrorSubscription = purchaseErrorListener(
(error: PurchaseError) => {
sendClientError('purchase_event_error', JSON.stringify({
name: error.name,
message: error.message,
debugMessage: error.debugMessage,
productId: error.productId,
code: error.code,
responseCode: error.responseCode
}));
logEvent('purchase_event_error');
if (error.code != ErrorCode.E_USER_CANCELLED) {
sendClientError('purchase_event_error', JSON.stringify({
name: error.name,
message: error.message,
debugMessage: error.debugMessage,
productId: error.productId,
code: error.code,
responseCode: error.responseCode
}));
logEvent('purchase_event_error');
}
},
);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"react-native-encrypted-storage": "^4.0.3",
"react-native-exception-handler": "^2.10.10",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.18.1",
"react-native-gesture-handler": "^2.19.0",
"react-native-get-random-values": "^1.11.0",
"react-native-iap": "^12.15.2",
"react-native-image-picker": "^7.1.2",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3521,7 +3521,7 @@ __metadata:
react-native-encrypted-storage: "npm:^4.0.3"
react-native-exception-handler: "npm:^2.10.10"
react-native-fs: "npm:^2.20.0"
react-native-gesture-handler: "npm:^2.18.1"
react-native-gesture-handler: "npm:^2.19.0"
react-native-get-random-values: "npm:^1.11.0"
react-native-iap: "npm:^12.15.2"
react-native-image-picker: "npm:^7.1.2"
Expand Down Expand Up @@ -10262,7 +10262,7 @@ __metadata:
languageName: node
linkType: hard

"react-native-gesture-handler@npm:^2.18.1":
"react-native-gesture-handler@npm:^2.19.0":
version: 2.19.0
resolution: "react-native-gesture-handler@npm:2.19.0"
dependencies:
Expand Down

0 comments on commit 0162799

Please sign in to comment.