Skip to content

Commit 333d02a

Browse files
Soliman13Soliman
and
Soliman
authored
Fix close event not responding well (#52)
Co-authored-by: Soliman <soliman.achahbar@arhs-spikeseed.com>
1 parent 0f036bd commit 333d02a

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Changelog (Current version: 1.2.3)
1+
# Changelog (Current version: 1.2.4)
2+
3+
### Version 1.2.4
4+
5+
News
6+
- Fix close event not responding well
27

38
### Version 1.2.3
49

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-netwatch",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "Network traffic logger for React Native",
55
"homepage": "https://github.com/odemolliens/react-native-netwatch",
66
"main": "src/index.tsx",

src/Components/Main.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,11 @@ export const Main = (props: IProps) => {
209209
return (
210210
<>
211211
<Appbar.Header style={[styles.header, { backgroundColor: theme.secondaryDarkColor }]}>
212-
<TouchableOpacity style={[styles.button, { borderLeftWidth: 0 }]}>
213-
<FeatherIcon
214-
name="x"
215-
color={theme.textColorOne}
216-
size={24}
217-
onPress={() => (settingsVisible ? setSettingsVisible(false) : props.onPressClose(false))}
218-
/>
212+
<TouchableOpacity
213+
style={[styles.button, { borderLeftWidth: 0 }]}
214+
onPress={() => (settingsVisible ? setSettingsVisible(false) : props.onPressClose(false))}
215+
>
216+
<FeatherIcon name="x" color={theme.textColorOne} size={24} />
219217
</TouchableOpacity>
220218
<Appbar.Content color={theme.primaryColor} title="Netwatch" titleStyle={{ fontSize: 18 }} />
221219
{loadingXLSX ? (

src/Components/__tests__/Main.test.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ReduxAction from '../../Core/Objects/ReduxAction';
55
import { RNRequest } from '../../Core/Objects/RNRequest';
66
import { EnumFilterType, EnumSourceType } from '../../types';
77
import NRequest from '../../Core/Objects/NRequest';
8-
import { Alert } from 'react-native';
8+
import { Alert, TouchableOpacity } from 'react-native';
99
import Share from 'react-native-share';
1010

1111
describe('Main test suite', () => {
@@ -181,7 +181,8 @@ describe('Main test suite', () => {
181181
jest.spyOn(React, 'useState').mockImplementation(useStateMock);
182182
givenProps();
183183
givenComponent();
184-
component.find('[name="x"]').simulate('press');
184+
// @ts-ignore
185+
component.find(TouchableOpacity).first().props().onPress();
185186
expect(props.onPressClose).toHaveBeenCalledTimes(1);
186187
expect(props.onPressClose).toHaveBeenCalledWith(false);
187188
});

src/Components/__tests__/__snapshots__/Main.test.tsx.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ exports[`Main test suite Tests source should render properly 1`] = `
2020
}
2121
>
2222
<ForwardRef
23+
onPress={[Function]}
2324
style={
2425
Array [
2526
Object {
@@ -38,7 +39,6 @@ exports[`Main test suite Tests source should render properly 1`] = `
3839
<Icon
3940
color="#F9FAFB"
4041
name="x"
41-
onPress={[Function]}
4242
size={24}
4343
/>
4444
</ForwardRef>
@@ -220,6 +220,7 @@ exports[`Main test suite should render properly and showSettings 1`] = `
220220
}
221221
>
222222
<ForwardRef
223+
onPress={[Function]}
223224
style={
224225
Array [
225226
Object {
@@ -238,7 +239,6 @@ exports[`Main test suite should render properly and showSettings 1`] = `
238239
<Icon
239240
color="#F9FAFB"
240241
name="x"
241-
onPress={[Function]}
242242
size={24}
243243
/>
244244
</ForwardRef>

0 commit comments

Comments
 (0)