Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies & fix linting errors #1028

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"parser" : "babel-eslint",
"parser" : "@babel/eslint-parser",
"extends" : [
"standard",
"standard-react"
"standard-react",
"plugin:react/recommended"
],
"plugins": [
"react"
Expand All @@ -15,9 +16,15 @@
"__DEV__": false
},
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true
},
"babelOptions": {
"parserOpts": {
"plugins": ["jsx"]
}
}
},
"rules": {
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v3.9.2

* Update package dependencies to eliminate vulnerability warnings
* Fix error due to deprecated ViewPropTypes usage
* Add lint script & fix existing linting errors

## v3.9.1

* Fix for `getNode()` deprecation warning with RN `0.62+` (thanks [@r0b0t3d](https://github.com/r0b0t3d))
Expand Down
3 changes: 2 additions & 1 deletion example/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Root from '../src/index';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

// eslint-disable-next-line no-undef
it('renders correctly', () => {
renderer.create(<Root />);
renderer.create(<Root />);
});
2 changes: 1 addition & 1 deletion example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:metro-react-native-babel-preset']
};
4 changes: 2 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @format
*/

import {AppRegistry} from 'react-native';
import { AppRegistry } from 'react-native';
import App from './src';
import {name as appName} from './app.json';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
16 changes: 8 additions & 8 deletions example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
})
}
};
54 changes: 29 additions & 25 deletions example/src/components/SliderEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,46 @@ export default class SliderEntry extends Component {
get image () {
const { data: { illustration }, parallax, parallaxProps, even } = this.props;

return parallax ? (
<ParallaxImage
source={{ uri: illustration }}
containerStyle={[styles.imageContainer, even ? styles.imageContainerEven : {}]}
style={styles.image}
parallaxFactor={0.35}
showSpinner={true}
spinnerColor={even ? 'rgba(255, 255, 255, 0.4)' : 'rgba(0, 0, 0, 0.25)'}
{...parallaxProps}
/>
) : (
<Image
source={{ uri: illustration }}
style={styles.image}
/>
);
return parallax ?
(
<ParallaxImage
source={{ uri: illustration }}
containerStyle={[styles.imageContainer, even ? styles.imageContainerEven : {}]}
style={styles.image}
parallaxFactor={0.35}
showSpinner={true}
spinnerColor={even ? 'rgba(255, 255, 255, 0.4)' : 'rgba(0, 0, 0, 0.25)'}
{...parallaxProps}
/>
) :
(
<Image
source={{ uri: illustration }}
style={styles.image}
/>
);
}

render () {
const { data: { title, subtitle }, even } = this.props;

const uppercaseTitle = title ? (
<Text
style={[styles.title, even ? styles.titleEven : {}]}
numberOfLines={2}
>
{ title.toUpperCase() }
</Text>
) : false;
const uppercaseTitle = title ?
(
<Text
style={[styles.title, even ? styles.titleEven : {}]}
numberOfLines={2}
>
{ title.toUpperCase() }
</Text>
) :
false;

return (
<TouchableOpacity
activeOpacity={1}
style={styles.slideInnerContainer}
onPress={() => { alert(`You've clicked '${title}'`); }}
>
>
<View style={styles.shadow} />
<View style={[styles.imageContainer, even ? styles.imageContainerEven : {}]}>
{ this.image }
Expand Down
46 changes: 24 additions & 22 deletions example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default class example extends Component {
};
}

_renderItem ({item, index}) {
_renderItem ({ item, index }) {
return <SliderEntry data={item} even={(index + 1) % 2 === 0} />;
}

_renderItemWithParallax ({item, index}, parallaxProps) {
_renderItemWithParallax ({ item, index }, parallaxProps) {
return (
<SliderEntry
data={item}
Expand All @@ -35,11 +35,11 @@ export default class example extends Component {
);
}

_renderLightItem ({item, index}) {
_renderLightItem ({ item, index }) {
return <SliderEntry data={item} even={false} />;
}

_renderDarkItem ({item, index}) {
_renderDarkItem ({ item, index }) {
return <SliderEntry data={item} even={true} />;
}

Expand All @@ -51,7 +51,7 @@ export default class example extends Component {
<Text style={styles.title}>{`Example ${number}`}</Text>
<Text style={styles.subtitle}>{title}</Text>
<Carousel
ref={c => this._slider1Ref = c}
ref={c => { this._slider1Ref = c; }}
data={ENTRIES1}
renderItem={this._renderItemWithParallax}
sliderWidth={sliderWidth}
Expand Down Expand Up @@ -136,23 +136,25 @@ export default class example extends Component {
const isEven = refNumber % 2 === 0;

// Do not render examples on Android; because of the zIndex bug, they won't work as is
return !IS_ANDROID ? (
<View style={[styles.exampleContainer, isEven ? styles.exampleContainerDark : styles.exampleContainerLight]}>
<Text style={[styles.title, isEven ? {} : styles.titleDark]}>{`Example ${number}`}</Text>
<Text style={[styles.subtitle, isEven ? {} : styles.titleDark]}>{title}</Text>
<Carousel
data={isEven ? ENTRIES2 : ENTRIES1}
renderItem={renderItemFunc}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
containerCustomStyle={styles.slider}
contentContainerCustomStyle={styles.sliderContentContainer}
scrollInterpolator={scrollInterpolators[`scrollInterpolator${refNumber}`]}
slideInterpolatedStyle={animatedStyles[`animatedStyles${refNumber}`]}
useScrollView={true}
/>
</View>
) : false;
return !IS_ANDROID ?
(
<View style={[styles.exampleContainer, isEven ? styles.exampleContainerDark : styles.exampleContainerLight]}>
<Text style={[styles.title, isEven ? {} : styles.titleDark]}>{`Example ${number}`}</Text>
<Text style={[styles.subtitle, isEven ? {} : styles.titleDark]}>{title}</Text>
<Carousel
data={isEven ? ENTRIES2 : ENTRIES1}
renderItem={renderItemFunc}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
containerCustomStyle={styles.slider}
contentContainerCustomStyle={styles.sliderContentContainer}
scrollInterpolator={scrollInterpolators[`scrollInterpolator${refNumber}`]}
slideInterpolatedStyle={animatedStyles[`animatedStyles${refNumber}`]}
useScrollView={true}
/>
</View>
) :
false;
}

get gradient () {
Expand Down
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "react-native-snap-carousel",
"version": "3.9.1",
"version": "3.9.2",
"description": "Swiper/carousel component for React Native with previews, multiple layouts, parallax images, performant handling of huge numbers of items, and RTL support. Compatible with Android & iOS.",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "github.com/meliorence/react-native-snap-carousel"
},
"scripts": {
"lint": "eslint ."
},
"keywords": [
"react",
"native",
Expand Down Expand Up @@ -37,23 +40,24 @@
"author": "Meliorence <[email protected]> (github.com/meliorence)",
"license": "BSD-3-Clause",
"dependencies": {
"deprecated-react-native-prop-types": "^5.0.0",
"prop-types": "^15.6.1",
"react-addons-shallow-compare": "15.6.2"
"react-addons-shallow-compare": "^15.6.3"
},
"peerDependencies": {
"react": ">=15.0.0",
"react-native": "*"
},
"devDependencies": {
"babel-eslint": "^8.2.2",
"eslint": "^4.19.1",
"eslint-config-standard": "^10.2.1",
"eslint-config-standard-react": "^5.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-standard": "^3.0.1"
"@babel/eslint-parser": "^7.24.7",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-react": "^13.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-standard": "^5.0.0"
},
"homepage": "https://github.com/meliorence/react-native-snap-carousel",
"bugs": {
Expand Down
Loading