Skip to content
This repository was archived by the owner on Dec 3, 2022. It is now read-only.

Commit 6a0c61d

Browse files
authored
Merge pull request #10 from bySabi/master
Moved to typescript environment
2 parents 092e7ab + 2ca0b6b commit 6a0c61d

18 files changed

+2483
-2349
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
# VSCode
99
.vscode/
10-
tsconfig.json
1110
jsconfig.json
1211

1312
# Xcode
@@ -49,5 +48,11 @@ buck-out/
4948
android/app/libs
5049
android/keystores/debug.keystore
5150

51+
# Test
52+
coverage/
53+
.jest/
54+
**/__snapshots__/**
55+
5256
# Build
5357
dist/
58+

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"trailingComma": "es5",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"bracketSpacing": true,
8+
"jsxBracketSameLine": false
9+
}

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
🏄‍♀️ Surfing the wave of React Hook hype with a few convenience hooks for `@react-navigation/core` v3. Destined to work on web, server, and React Native. Contributions welcome!
66

7-
87
## Examples (web only so far)
98

109
See an example web app which uses react-navigation and hooks on the client and the server:
@@ -82,9 +81,9 @@ function ReportNavigationEvents() {
8281
// prev state on evt.lastState
8382
// triggering navigation action on evt.action
8483

85-
setEvents(events => [...events, evt.type]);
86-
// evt.type is [will/did][Focus/Blur]
84+
setEvents(events => [...events, evt]);
8785
});
86+
// evt.type is [will/did][Focus/Blur]
8887
return (
8988
<>
9089
{events.map(evt => (

__mocks__/react.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Right now is not a way to trigger useEffect from Jest
2+
// see: https://github.com/facebook/react/issues/14050
3+
// TODO: Remove this module mock when solved
4+
import * as React from 'react';
5+
module.exports = { ...React, useEffect: React.useLayoutEffect };

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:metro-react-native-babel-preset'],
3+
};

jest-setup.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

jest.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { defaults: tsjPreset } = require('ts-jest/presets');
2+
3+
module.exports = {
4+
...tsjPreset,
5+
preset: 'react-native',
6+
transform: {
7+
...tsjPreset.transform,
8+
'\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js',
9+
},
10+
globals: {
11+
'ts-jest': {
12+
babelConfig: true,
13+
},
14+
},
15+
testPathIgnorePatterns: [
16+
"\\.snap$",
17+
"<rootDir>/node_modules/",
18+
"<rootDir>/dist/"
19+
],
20+
transformIgnorePatterns: [
21+
"<rootDir>/node_modules/(?!react-native)/"
22+
],
23+
cacheDirectory: '.jest/cache',
24+
};

0 commit comments

Comments
 (0)