forked from reduxjs/redux-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Redux Toolkit): Added patch files to resolve types issues with us…
…ing node16 module resolution
- Loading branch information
1 parent
aacb6de
commit 3df58d0
Showing
31 changed files
with
15,263 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** @type {Detox.DetoxConfig} */ | ||
module.exports = { | ||
testRunner: { | ||
args: { | ||
'$0': 'jest', | ||
config: 'tests/detox/jest.config.js' | ||
}, | ||
jest: { | ||
setupTimeout: 120000 | ||
} | ||
}, | ||
apps: { | ||
'ios.release': { | ||
type: 'ios.app', | ||
build: 'xcodebuild -workspace ios/eastestsexample.xcworkspace -scheme eastestsexample -configuration Release -sdk iphonesimulator -arch x86_64 -derivedDataPath ios/build', | ||
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/eastestsexample.app' | ||
}, | ||
'android.release': { | ||
type: 'android.apk', | ||
build: 'cd android && ./gradlew :app:assembleRelease :app:assembleAndroidTest -DtestBuildType=release && cd ..', | ||
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk' | ||
} | ||
}, | ||
devices: { | ||
simulator: { | ||
type: 'ios.simulator', | ||
device: { | ||
type: 'iPhone 12' | ||
} | ||
}, | ||
emulator: { | ||
type: 'android.emulator', | ||
device: { | ||
avdName: 'Pixel_API_29_AOSP' | ||
} | ||
} | ||
}, | ||
configurations: { | ||
'android.emu.release': { | ||
device: 'emulator', | ||
app: 'android.release' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
jest: true, | ||
}, | ||
environments: { | ||
detox: { | ||
globals: { | ||
detox: false, | ||
device: false, | ||
expect: false, | ||
waitFor: false, | ||
element: false, | ||
by: false, | ||
} | ||
} | ||
}, | ||
extends: [ | ||
'@react-native-community', | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react', '@typescript-eslint'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
rules: { | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'no-shadow': 'off', | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, | ||
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.expo/* | ||
npm-debug.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
# Pre-Builds | ||
/android | ||
/ios | ||
|
||
# Dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
typesversions | ||
.cache | ||
.yarnrc | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/releases | ||
!.yarn/plugins | ||
!.yarn/sdks | ||
!.yarn/versions | ||
.pnp.* | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.jks | ||
*.key | ||
*.mobileprovision | ||
*.p12 | ||
*.p8 | ||
.DS_Store | ||
.expo | ||
.npmignore | ||
.vscode | ||
package-lock.json | ||
yarn.lock | ||
yarn-error.log | ||
yarn-debug.log* | ||
npm-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
arrowParens: 'avoid', | ||
bracketSameLine: true, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { store } from './src/app/store'; | ||
import { App } from './src'; | ||
|
||
const MainApp = () => ( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider> | ||
); | ||
|
||
export default MainApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"expo": { | ||
"name": "HelloWorld", | ||
"slug": "expo-template-blank-typescript", | ||
"version": "1.0.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/icon.png", | ||
"splash": { | ||
"image": "./assets/splash.png", | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"updates": { | ||
"fallbackToCacheTimeout": 0 | ||
}, | ||
"assetBundlePatterns": [ | ||
"**/*" | ||
], | ||
"ios": { | ||
"supportsTablet": true, | ||
"bundleIdentifier": "com.anonymous.expotemplateblanktypescript" | ||
}, | ||
"android": { | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/adaptive-icon.png", | ||
"backgroundColor": "#FFFFFF" | ||
}, | ||
"package": "com.anonymous.expotemplateblanktypescript" | ||
}, | ||
"web": { | ||
"favicon": "./assets/favicon.png" | ||
}, | ||
"plugins": [ | ||
"@config-plugins/detox" | ||
] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = function(api) { | ||
api.cache(true); | ||
return { | ||
presets: ['babel-preset-expo'], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { registerRootComponent } from 'expo'; | ||
|
||
import App from './App'; | ||
|
||
// registerRootComponent calls AppRegistry.registerComponent('main', () => App); | ||
// It also ensures that whether you load the app in Expo Go or in a native build, | ||
// the environment is set up appropriately. | ||
registerRootComponent(App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Learn more https://docs.expo.io/guides/customizing-metro | ||
const { getDefaultConfig } = require('expo/metro-config'); | ||
|
||
module.exports = getDefaultConfig(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "expo-template-redux-typescript", | ||
"description": "The Blank project template includes typescript and redux.", | ||
"version": "47.0.0", | ||
"scripts": { | ||
"start": "expo start --dev-client", | ||
"android": "expo run:android", | ||
"ios": "expo run:ios", | ||
"web": "expo start --web", | ||
"build": "expo prebuild && yarn build:emu", | ||
"build:emu": "detox build --configuration android.emu.release", | ||
"test": "detox test --configuration android.emu.release --headless" | ||
}, | ||
"dependencies": { | ||
"@reduxjs/toolkit": "^1.8.6", | ||
"expo": "~47.0.12", | ||
"expo-splash-screen": "~0.17.5", | ||
"expo-status-bar": "~1.4.1", | ||
"react": "18.1.0", | ||
"react-dom": "^18.2.0", | ||
"react-native": "0.70.5", | ||
"react-native-web": "~0.18.9", | ||
"react-redux": "^8.0.5" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.9", | ||
"@config-plugins/detox": "^4.0.0", | ||
"@react-native-community/eslint-config": "^3.1.0", | ||
"@types/detox": "^18.1.0", | ||
"@types/jest": "^29.4.0", | ||
"@types/react": "^18.0.26", | ||
"@types/react-dom": "^18.0.10", | ||
"@types/react-native": "0.70.4", | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/parser": "^5.41.0", | ||
"detox": "^20.3.0", | ||
"detox-cli": "^20.0.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-universe": "^11.1.0", | ||
"jest": "^29.4.3", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.8.4" | ||
}, | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useRef, useEffect } from 'react'; | ||
import { useWindowDimensions, Animated } from 'react-native'; | ||
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; | ||
import { RootState, AppDispatch } from '../store'; | ||
|
||
// Use throughout your app instead of plain `useDispatch` and `useSelector` | ||
export const useAppDispatch = () => useDispatch<AppDispatch>(); | ||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector; | ||
|
||
export const useViewportUnits = () => { | ||
const { width, height } = useWindowDimensions(); | ||
|
||
const vh = height / 100; | ||
const vw = width / 100; | ||
|
||
return { vh, vw }; | ||
}; | ||
|
||
export const useBounceAnimation = (value = 10) => { | ||
const bounce = useRef(new Animated.Value(0)).current; | ||
|
||
bounce.interpolate({ | ||
inputRange: [-300, -100, 0, 100, 101], | ||
outputRange: [300, 0, 1, 0, 0], | ||
}); | ||
|
||
useEffect(() => { | ||
Animated.loop( | ||
Animated.sequence([ | ||
Animated.timing(bounce, { | ||
toValue: value, | ||
duration: 1500, | ||
useNativeDriver: true, | ||
}), | ||
Animated.timing(bounce, { | ||
toValue: 0, | ||
duration: 1500, | ||
useNativeDriver: true, | ||
}), | ||
]), | ||
).start(); | ||
}, [bounce, value]); | ||
|
||
return bounce; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit'; | ||
import counterReducer from '../features/counter/counterSlice'; | ||
|
||
export const store = configureStore({ | ||
reducer: { | ||
counter: counterReducer, | ||
}, | ||
}); | ||
|
||
export type RootState = ReturnType<typeof store.getState>; | ||
export type AppDispatch = typeof store.dispatch; | ||
export type AppThunk<ReturnType = void> = ThunkAction< | ||
ReturnType, | ||
RootState, | ||
unknown, | ||
Action<string> | ||
>; |
Oops, something went wrong.