Skip to content

Commit

Permalink
Upgraded the react-native package peer dependency version to >=0.70.0…
Browse files Browse the repository at this point in the history
… and react version to >=18.1.0. This is to avoid dependency on unmaintained <v70 versions. This will also address the security issues in outdated packages. Updated some of the dev dependencies to possible versions without hitting the dependency resolution conflicts (#128)

* Upgraded the react-native package peer dependency version to >=0.70.0 and react version to >=18.1.0. This is to avoid dependency on unmaintained <v70 versions. This will also address the security issues in outdated packages. 
* Updated some of the dev dependencies to possible versions without hitting the dependency resolution conflicts.
* Source code changes are purely related ESLint format.
  • Loading branch information
UdaySravanK authored Jun 5, 2024
1 parent db596a1 commit 85cf3cf
Show file tree
Hide file tree
Showing 7 changed files with 687 additions and 1,149 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run format && git add .
3 changes: 2 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all'
};
1,371 changes: 530 additions & 841 deletions package-lock.json

Large diffs are not rendered by default.

25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"test": "echo \\\"Error: no test specified\\\" && exit 1",
"lint": "eslint .",
"format": "prettier --write 'src/**/*.js'"
"format": "prettier --write 'src/**/*.js'",
"prepare": "husky"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -39,25 +40,19 @@
"homepage": "https://github.com/UdaySravanK/RNSwipeButton#readme",
"devDependencies": {
"@react-native-community/eslint-config": "^3.2.0",
"eslint": "^8.0.0",
"@tsconfig/react-native": "^2.0.2",
"eslint": "^8.19.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
"metro-react-native-babel-preset": "^0.56.0",
"husky": "^9.0.1",
"metro-react-native-babel-preset": "^0.77.0",
"pretty-quick": "^2.0.1",
"stylelint-config-prettier": "^8.0.1",
"stylelint-prettier": "^1.1.2",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0"
"stylelint-prettier": "^1.1.2"
},
"peerDependencies": {
"react": ">=16.8.6",
"react-native": ">=0.60.5"
"react": ">=18.1.0",
"react-native": ">=0.70.0"
},
"types": "./types.d.ts",
"husky": {
"hooks": {
"pre-commit": "yarn format && git add ."
}
}
"types": "./types.d.ts"
}
14 changes: 6 additions & 8 deletions src/components/SwipeButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
TITLE_COLOR,
} from '../../constants';

const SwipeButton = (props) => {
const SwipeButton = props => {
const [layoutWidth, setLayoutWidth] = useState(0);
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false);
const [isUnmounting, setIsUnmounting] = useState(false);
Expand All @@ -33,15 +33,15 @@ const SwipeButton = (props) => {
* Correct layout width will be received only after first render but we need it before render.
* So render SwipeThumb only if layoutWidth > 0
*/
const onLayoutContainer = async (e) => {
const onLayoutContainer = async e => {
if (isUnmounting || layoutWidth) {
return;
}
setLayoutWidth(e.nativeEvent.layout.width);
};

useEffect(() => {
const handleScreenReaderToggled = (isEnabled) => {
const handleScreenReaderToggled = isEnabled => {
if (isUnmounting || screenReaderEnabled === isEnabled) {
return;
}
Expand All @@ -53,7 +53,7 @@ const SwipeButton = (props) => {
handleScreenReaderToggled,
);

AccessibilityInfo.isScreenReaderEnabled().then((isEnabled) => {
AccessibilityInfo.isScreenReaderEnabled().then(isEnabled => {
if (isUnmounting) {
return;
}
Expand Down Expand Up @@ -114,8 +114,7 @@ const SwipeButton = (props) => {
...(width ? { width } : {}),
},
]}
onLayout={onLayoutContainer}
>
onLayout={onLayoutContainer}>
<Text
maxFontSizeMultiplier={titleMaxFontScale}
ellipsizeMode={'tail'}
Expand All @@ -130,8 +129,7 @@ const SwipeButton = (props) => {
fontSize: titleFontSize,
...titleStyles,
},
]}
>
]}>
{title}
</Text>
{layoutWidth > 0 && (
Expand Down
8 changes: 3 additions & 5 deletions src/components/SwipeThumb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { TRANSPARENT_COLOR } from '../../constants';
const DEFAULT_ANIMATION_DURATION = 400;
const RESET_AFTER_SUCCESS_DEFAULT_DELAY = 1000;

const SwipeThumb = (props) => {
const SwipeThumb = props => {
const paddingAndMarginsOffset = borderWidth + 2 * margin;
var defaultContainerWidth = 0;
if (props.thumbIconWidth == undefined) {
Expand Down Expand Up @@ -241,8 +241,7 @@ const SwipeThumb = (props) => {
}`}
disabled={disabled}
onPress={onSwipeSuccess}
accessible
>
accessible>
<View style={[panStyle, { width: defaultContainerWidth }]}>
{renderThumbIcon()}
</View>
Expand All @@ -251,8 +250,7 @@ const SwipeThumb = (props) => {
<Animated.View
style={[panStyle]}
{...panResponder.panHandlers}
pointerEvents={shouldDisableTouch ? 'none' : 'auto'}
>
pointerEvents={shouldDisableTouch ? 'none' : 'auto'}>
{renderThumbIcon()}
</Animated.View>
)}
Expand Down
Loading

0 comments on commit 85cf3cf

Please sign in to comment.