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

🔥 4.0.0 beta.x #678

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7b750d4
:construction: wip(Carousel): huge revamp of carousel's logic, props …
Apr 5, 2020
b6b1ed8
fix(Carousel): make sure that loop and autoplay props work well together
Apr 5, 2020
f2bc3f1
chore(package): update dependencies and info
Apr 5, 2020
cdbb46a
chore(package): promote alpha version to beta
Apr 5, 2020
46d337a
refactor(Carousel): move warnings to a dedicated function
Apr 5, 2020
ec9af31
refactor(misc): code cleaning
Apr 5, 2020
f4a1006
refactor(Carousel): miscellaneous optimizations and code cleaning
Apr 6, 2020
ac52189
feat(Carousel): retrieve RN version and update warnings
Apr 6, 2020
dc18753
refactor(Carousel): remove unneeded prop `preserveActiveSlideAlignment`
Apr 6, 2020
21f36ff
refactor(Carousel): don't activate `disableIntervalMomentum` for the …
Apr 6, 2020
3cb43dc
chore(package): bump to version 4.0.0-beta.2
Apr 6, 2020
01af5c4
fix: snapping to item with index 0 not working
focux May 19, 2020
5a54da3
fix(Carousel): disable RN version check as it's breaking on snack
May 26, 2020
ea01a68
chore(project): enable eslint locally
May 26, 2020
df5c39b
chore(package): bump to version 4.0.0-beta.3
May 26, 2020
4c7e258
fix(Carousel): prevent getNode() deprecation warning with RN 0.62+ wh…
May 27, 2020
a534e29
refactor(Carousel): code cleaning
May 27, 2020
c76869d
chore(package): bump to version 4.0.0-beta.4
May 27, 2020
ff99211
refactor(Carousel): allow prop `contentContainerCustomStyle` to overr…
May 27, 2020
4dc54b0
fix(Carousel): prevent a critical and random crash on android
Jul 23, 2020
981ed7d
chore(package): bump to version 4.0.0-beta.5
Jul 23, 2020
2300990
wip
Titozzz Aug 1, 2020
9f0dfe6
wip
Titozzz Aug 5, 2020
bc86b88
Delete whatthehell.js
Titozzz Aug 5, 2020
b96c5f4
Update animations.ts
Titozzz Aug 5, 2020
e719467
Update Example folder
Titozzz Aug 5, 2020
5f8ad4a
wip
Titozzz Aug 18, 2020
daa8e6e
diverse fixes
Titozzz Aug 18, 2020
f403a9a
Update package.json
Titozzz Aug 18, 2020
93fb6a0
wip
Titozzz Aug 21, 2020
0aee79e
Update Pagination.tsx
Titozzz Aug 21, 2020
12a2ea5
Finally it should be good
Titozzz Aug 24, 2020
089ecd3
Merge pull request #734 from Titozzz/typescript
Aug 27, 2020
86611dc
chore(eslint): update config
Aug 27, 2020
59fa895
chore(package): bump to version 4.0.0-beta.6
Aug 27, 2020
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
92 changes: 66 additions & 26 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,38 +1,78 @@
{
"parser" : "babel-eslint",
"extends" : [
"standard",
"standard-react"
],
"plugins": [
"react"
],
"parser" : "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"react"
],
"env" : {
"browser" : true,
"es6": true
},
"globals": {
"__DEV__": false
},
"parserOptions": {
"ecmaVersion": 6,
"extends" : [
"standard",
"standard-react",
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"globals": {
"__DEV__": false
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"generator-star-spacing": 0,
"indent": [2, 4, { "ignoredNodes": ["JSXAttribute", "JSXSpreadAttribute"], "SwitchCase": 1 }],
"no-warning-comments": [1, {
"terms": ["todo", "fixme", "xxx"],
"location": "start"
// Eslint
"comma-dangle": ["error", "never"],
"indent": ["error", 4, { "SwitchCase": 1 }],
"keyword-spacing": ["error", { "after": true, "before": true }],
"object-curly-spacing": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"space-before-function-paren": ["error", "always"],
"space-before-blocks": ["error", "always"],
"semi": ["error", "always"],
// React
"react/jsx-curly-brace-presence": ["error", "always"],
"react/jsx-curly-newline": ["error", "consistent"],
"react/jsx-equals-spacing": ["error", "never"],
"react/jsx-indent-props": ["error", 4],
"react/jsx-max-props-per-line": ["error", { "maximum": 1, "when": "multiline" }],
"react/jsx-wrap-multilines": ["error", {
"arrow": "parens-new-line",
"assignment": "parens-new-line",
"declaration": "parens-new-line",
"logical": "ignore",
"prop": "parens",
"return": "parens-new-line"
}],
"react/jsx-tag-spacing": ["error", {
"afterOpening": "never",
"beforeClosing": "never",
"beforeSelfClosing": "always",
"closingSlash": "never"
}],
// Typescript
"@typescript-eslint/ban-ts-comment": ["error", {
"ts-expect-error": true,
"ts-ignore": "allow-with-description",
"ts-nocheck": true,
"ts-check": false,
"minimumDescriptionLength": 10
}],
"operator-linebreak": [2, "after"],
"padded-blocks": 0,
"semi": [2, "always"],
"react/jsx-indent-props": [2, 2],
"react/jsx-boolean-value": [0, "never"],
"react/jsx-curly-spacing": [0, "never"],
"react/jsx-indent": [2, 4]
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/interface-name-prefix": 0,
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }]
}
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ node_modules

#LOCK
package-lock.json
yarn.lock
yarn.lock

lib
8 changes: 6 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/example
/node_modules
example
node_modules
doc
ISSUE_TEMPLATE.md
package-lock.json
yarn.lock
.vscode
.eslintrc
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"eslint.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion doc/PROPS_METHODS_AND_GETTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Prop | Description | Type | Default
`activeAnimationType` | Custom [animation type](https://facebook.github.io/react-native/docs/animated.html#configuring-animations): either `'decay`, `'spring'` or `'timing'`. Note that it will only be applied to the scale animation since opacity's animation type will always be set to `timing` (no one wants the opacity to 'bounce' around). | String | `'timing'`
`activeSlideAlignment` | Determine active slide's alignment relative to the carousel. Possible values are: `'start'`, `'center'` and `'end'`. **It is not recommended to use this prop in conjunction with the `layout` one.** | String | `'center'`
`containerCustomStyle` | Optional styles for Scrollview's global wrapper | View Style Object | `{}`
`contentContainerCustomStyle` | Optional styles for Scrollview's items container | View Style Object | `{}`
`contentContainerCustomStyle` | Optional styles for Scrollview's items container. **:warning: Tread softly as this can mess with the carousel's inner logic!** | View Style Object | `{}`
`inactiveSlideOpacity` | Value of the opacity effect applied to inactive slides | Number | `0.7`
`inactiveSlideScale` | Value of the 'scale' transform applied to inactive slides | Number | `0.9`
`inactiveSlideShift` | Value of the 'translate' transform applied to inactive slides (see [#204](https://github.com/archriss/react-native-snap-carousel/issues/204) or [the "custom interpolations" doc](https://github.com/archriss/react-native-snap-carousel/blob/master/doc/CUSTOM_INTERPOLATIONS.md) for an example usage). This prop will have no effect with layouts others than the default one. | Number | `0`
Expand Down
4 changes: 4 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
8 changes: 3 additions & 5 deletions example/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ node_modules/warning/.*
[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
Expand All @@ -36,9 +36,8 @@ module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand All @@ -57,7 +56,6 @@ untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
Expand All @@ -72,4 +70,4 @@ untyped-import
untyped-type-import

[version]
^0.105.0
^0.122.0
4 changes: 2 additions & 2 deletions example/__tests__/index.js → example/__tests__/App-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import 'react-native';
import React from 'react';
import Root from '../src/index';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<Root />);
renderer.create(<App />);
});
17 changes: 0 additions & 17 deletions example/android/.project

This file was deleted.

2 changes: 0 additions & 2 deletions example/android/.settings/org.eclipse.buildship.core.prefs

This file was deleted.

26 changes: 22 additions & 4 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import com.android.build.OutputFile
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
Expand Down Expand Up @@ -76,7 +78,6 @@ import com.android.build.OutputFile
*/

project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]

Expand Down Expand Up @@ -156,12 +157,13 @@ android {
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand All @@ -180,8 +182,24 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.example;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;

public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);

client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());

NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();

// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Loading