@momo-kits/foundation 0.79.6-beta.12 → 0.79.6-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Switch/index.tsx +8 -2
  2. package/package.json +1 -1
package/Switch/index.tsx CHANGED
@@ -1,9 +1,10 @@
1
1
  import React, {FC} from 'react';
2
- import {TouchableOpacity, View} from 'react-native';
2
+ import {NativeModules, TouchableOpacity, View} from 'react-native';
3
3
  import {SwitchProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Colors} from '../Consts';
6
6
 
7
+ const {HapticModule} = NativeModules;
7
8
  const Switch: FC<SwitchProps> = props => {
8
9
  const {value, onChange, disabled, style} = props;
9
10
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
@@ -14,11 +15,16 @@ const Switch: FC<SwitchProps> = props => {
14
15
  backgroundColor = value ? Colors.green_09 : Colors.black_05;
15
16
  }
16
17
 
18
+ const onChangeValue = () => {
19
+ HapticModule?.triggerHaptic?.('medium');
20
+ onChange?.(!value);
21
+ };
22
+
17
23
  return (
18
24
  <TouchableOpacity
19
25
  accessibilityLabel={'Switch'}
20
26
  disabled={disabled}
21
- onPress={() => onChange?.(!value)}
27
+ onPress={onChangeValue}
22
28
  style={[
23
29
  style,
24
30
  styles.container,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.79.6-beta.12",
3
+ "version": "0.79.6-beta.14",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {