Browse Source

clone to gogs

胡家华 5 years ago
commit
62719d6ea5
64 changed files with 9746 additions and 0 deletions
  1. 6 0
      .buckconfig
  2. 69 0
      .flowconfig
  3. 1 0
      .gitattributes
  4. 56 0
      .gitignore
  5. 1 0
      .watchmanconfig
  6. 57 0
      App.js
  7. 21 0
      LICENSE
  8. 68 0
      README.md
  9. 14 0
      __tests__/App-test.js
  10. 55 0
      android/app/BUCK
  11. 151 0
      android/app/build.gradle
  12. 19 0
      android/app/build_defs.bzl
  13. 17 0
      android/app/proguard-rules.pro
  14. 8 0
      android/app/src/debug/AndroidManifest.xml
  15. 26 0
      android/app/src/main/AndroidManifest.xml
  16. 15 0
      android/app/src/main/java/com/reactnativeswiper/MainActivity.java
  17. 45 0
      android/app/src/main/java/com/reactnativeswiper/MainApplication.java
  18. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  19. BIN
      android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  20. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  21. BIN
      android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  22. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  23. BIN
      android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  24. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  25. BIN
      android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  26. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  27. BIN
      android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  28. 3 0
      android/app/src/main/res/values/strings.xml
  29. 8 0
      android/app/src/main/res/values/styles.xml
  30. 33 0
      android/build.gradle
  31. 18 0
      android/gradle.properties
  32. BIN
      android/gradle/wrapper/gradle-wrapper.jar
  33. 5 0
      android/gradle/wrapper/gradle-wrapper.properties
  34. 188 0
      android/gradlew
  35. 100 0
      android/gradlew.bat
  36. 8 0
      android/keystores/BUCK
  37. 4 0
      android/keystores/debug.keystore.properties
  38. 3 0
      android/settings.gradle
  39. 4 0
      app.json
  40. 3 0
      babel.config.js
  41. 9 0
      index.js
  42. 54 0
      ios/ReactNativeSwiper-tvOS/Info.plist
  43. 24 0
      ios/ReactNativeSwiper-tvOSTests/Info.plist
  44. 1502 0
      ios/ReactNativeSwiper.xcodeproj/project.pbxproj
  45. 129 0
      ios/ReactNativeSwiper.xcodeproj/xcshareddata/xcschemes/ReactNativeSwiper-tvOS.xcscheme
  46. 129 0
      ios/ReactNativeSwiper.xcodeproj/xcshareddata/xcschemes/ReactNativeSwiper.xcscheme
  47. 15 0
      ios/ReactNativeSwiper/AppDelegate.h
  48. 42 0
      ios/ReactNativeSwiper/AppDelegate.m
  49. 42 0
      ios/ReactNativeSwiper/Base.lproj/LaunchScreen.xib
  50. 38 0
      ios/ReactNativeSwiper/Images.xcassets/AppIcon.appiconset/Contents.json
  51. 6 0
      ios/ReactNativeSwiper/Images.xcassets/Contents.json
  52. 60 0
      ios/ReactNativeSwiper/Info.plist
  53. 16 0
      ios/ReactNativeSwiper/main.m
  54. 24 0
      ios/ReactNativeSwiperTests/Info.plist
  55. 68 0
      ios/ReactNativeSwiperTests/ReactNativeSwiperTests.m
  56. 67 0
      lib/README.md
  57. 14 0
      lib/RNSwiper.d.ts
  58. 204 0
      lib/RNSwiper.js
  59. 2 0
      lib/index.js
  60. 24 0
      lib/package.json
  61. 17 0
      metro.config.js
  62. 25 0
      package.json
  63. BIN
      screenshot.gif
  64. 6229 0
      yarn.lock

+ 6 - 0
.buckconfig

@@ -0,0 +1,6 @@
1
+
2
+[android]
3
+  target = Google Inc.:Google APIs:23
4
+
5
+[maven_repositories]
6
+  central = https://repo1.maven.org/maven2

+ 69 - 0
.flowconfig

@@ -0,0 +1,69 @@
1
+[ignore]
2
+; We fork some components by platform
3
+.*/*[.]android.js
4
+
5
+; Ignore "BUCK" generated dirs
6
+<PROJECT_ROOT>/\.buckd/
7
+
8
+; Ignore unexpected extra "@providesModule"
9
+.*/node_modules/.*/node_modules/fbjs/.*
10
+
11
+; Ignore duplicate module providers
12
+; For RN Apps installed via npm, "Libraries" folder is inside
13
+; "node_modules/react-native" but in the source repo it is in the root
14
+.*/Libraries/react-native/React.js
15
+
16
+; Ignore polyfills
17
+.*/Libraries/polyfills/.*
18
+
19
+; Ignore metro
20
+.*/node_modules/metro/.*
21
+
22
+[include]
23
+
24
+[libs]
25
+node_modules/react-native/Libraries/react-native/react-native-interface.js
26
+node_modules/react-native/flow/
27
+
28
+[options]
29
+emoji=true
30
+
31
+esproposal.optional_chaining=enable
32
+esproposal.nullish_coalescing=enable
33
+
34
+module.system=haste
35
+module.system.haste.use_name_reducers=true
36
+# get basename
37
+module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
38
+# strip .js or .js.flow suffix
39
+module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
40
+# strip .ios suffix
41
+module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
42
+module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
43
+module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
44
+module.system.haste.paths.blacklist=.*/__tests__/.*
45
+module.system.haste.paths.blacklist=.*/__mocks__/.*
46
+module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
47
+module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
48
+
49
+munge_underscores=true
50
+
51
+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\)$' -> 'RelativeImageStub'
52
+
53
+module.file_ext=.js
54
+module.file_ext=.jsx
55
+module.file_ext=.json
56
+module.file_ext=.native.js
57
+
58
+suppress_type=$FlowIssue
59
+suppress_type=$FlowFixMe
60
+suppress_type=$FlowFixMeProps
61
+suppress_type=$FlowFixMeState
62
+
63
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
64
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
65
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
66
+suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
67
+
68
+[version]
69
+^0.92.0

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
1
+*.pbxproj -text

+ 56 - 0
.gitignore

@@ -0,0 +1,56 @@
1
+# OSX
2
+#
3
+.DS_Store
4
+
5
+# Xcode
6
+#
7
+build/
8
+*.pbxuser
9
+!default.pbxuser
10
+*.mode1v3
11
+!default.mode1v3
12
+*.mode2v3
13
+!default.mode2v3
14
+*.perspectivev3
15
+!default.perspectivev3
16
+xcuserdata
17
+*.xccheckout
18
+*.moved-aside
19
+DerivedData
20
+*.hmap
21
+*.ipa
22
+*.xcuserstate
23
+project.xcworkspace
24
+
25
+# Android/IntelliJ
26
+#
27
+build/
28
+.idea
29
+.gradle
30
+local.properties
31
+*.iml
32
+
33
+# node.js
34
+#
35
+node_modules/
36
+npm-debug.log
37
+yarn-error.log
38
+
39
+# BUCK
40
+buck-out/
41
+\.buckd/
42
+*.keystore
43
+
44
+# fastlane
45
+#
46
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
+# screenshots whenever they are needed.
48
+# For more information about the recommended setup visit:
49
+# https://docs.fastlane.tools/best-practices/source-control/
50
+
51
+*/fastlane/report.xml
52
+*/fastlane/Preview.html
53
+*/fastlane/screenshots
54
+
55
+# Bundle artifact
56
+*.jsbundle

+ 1 - 0
.watchmanconfig

@@ -0,0 +1 @@
1
+{}

+ 57 - 0
App.js

@@ -0,0 +1,57 @@
1
+
2
+import React, {Component} from 'react';
3
+import { StyleSheet, Text, View, Dimensions } from 'react-native';
4
+import RNSwiper from 'rnezswiper'
5
+const { width, height } = Dimensions.get("window")
6
+let data = 'HelloWord'.toUpperCase().split('')
7
+export default class App extends Component{
8
+  state = {
9
+    autoPlay: true
10
+  }
11
+  componentDidMount () {
12
+    // setTimeout(() => {
13
+    //   this.setState({
14
+    //     autoPlay: false
15
+    //   })
16
+    // }, 4000)
17
+  }
18
+  render() {
19
+    let { autoPlay } = this.state
20
+    return (
21
+      <View style={styles.container}>
22
+        <View style={{ height: 200 }}>
23
+          <RNSwiper
24
+            loop
25
+            autoPlay
26
+            initIndex={0}
27
+            onChangeIndex={(index) => {  }}
28
+            slideStyle={styles.slideStyle}
29
+            renderPagination={(index) => { // customize pagination
30
+              return (
31
+                <View style={[{ position: 'absolute', bottom: 0, height: 30, width, left: 0,zIndex: 1 }]}>
32
+                  <Text style={{ color: '#fff',textAlign: 'center' }}>{`${index + 1}/${data.length}`}</Text>
33
+                </View>
34
+              )
35
+            }}
36
+          >
37
+            {
38
+              data.map(item => <Text key={item} style={styles.font}>{item}</Text>)
39
+            }
40
+          </RNSwiper>
41
+        </View>
42
+        <Text>other content</Text>
43
+      </View>
44
+    );
45
+  }
46
+}
47
+
48
+const styles = StyleSheet.create({
49
+  container: {
50
+    flex: 1,
51
+  },
52
+  font: {
53
+    color: '#fff',
54
+    fontSize: 30
55
+  },
56
+  slideStyle: { height: 200, width, backgroundColor: '#7e57c2' },
57
+});

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2019 artmagic
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 68 - 0
README.md

@@ -0,0 +1,68 @@
1
+# RN-Swiper
2
+详见gitHub:https://github.com/CQKM/RN-Swiper
3
+
4
+#### ScreenShot
5
+![image](https://github.com/CQKM/RN-Swiper/blob/master/screenshot.gif)
6
+
7
+or
8
+project/screenshot.gif
9
+
10
+
11
+#### Usage
12
+
13
+`yarn add rnezswiper` or `npm install rnezswiper`
14
+
15
+`import RNSwiper from 'rnezswiper'`
16
+
17
+```javascript
18
+let data = 'HelloWord'.toUpperCase().split('')
19
+const { width, height } = Dimensions.get("window")
20
+
21
+<View style={styles.container}>
22
+    <View style={{ height: 200 }}> // wrapStyle
23
+        <RNSwiper
24
+        loop
25
+        autoPlay
26
+        initIndex={0}
27
+        onChangeIndex={(index) => {  }}
28
+        slideStyle={styles.slideStyle}
29
+        renderPagination={(index) => { // customize pagination
30
+            return (
31
+            <View style={[{ position: 'absolute', bottom: 0, height: 30, width, left: 0,zIndex: 1 }]}>
32
+                <Text style={{ color: '#fff',textAlign: 'center' }}>{`${index + 1}/${data.length}`}</Text>
33
+            </View>
34
+            )
35
+        }}
36
+        >
37
+        {
38
+            data.map(item => <Text key={item} style={styles.font}>{item}</Text>)
39
+        }
40
+        </RNSwiper>
41
+    </View>
42
+    <Text>other content</Text>
43
+</View>
44
+
45
+const styles = StyleSheet.create({
46
+  container: {
47
+    flex: 1,
48
+  },
49
+  font: {
50
+    color: '#fff',
51
+    fontSize: 30
52
+  },
53
+  slideStyle: { height: 200, width, backgroundColor: '#7e57c2' },
54
+});
55
+
56
+```
57
+#### Properties
58
+
59
+Prop | Default | Type | Description
60
+-|-|-|-
61
+slideStyle | {} | ViewStyle | none
62
+loop | true | boolean | Set to `false` to disable continuous loop mode.
63
+autoPlay | true | boolean | Set to `true` enable auto play mode.
64
+autoPlayTimeOut | 3000 | number | auto paly delay
65
+initIndex | 0 | number | Index number of initial slide
66
+onIndexChanged | (index) => null | function | Called with the new index when the user swiped
67
+renderPagination | (index) => null | JSX | customize pagination
68
+animation | (value, toValue) => Animated  | function | customize animated

+ 14 - 0
__tests__/App-test.js

@@ -0,0 +1,14 @@
1
+/**
2
+ * @format
3
+ */
4
+
5
+import 'react-native';
6
+import React from 'react';
7
+import App from '../App';
8
+
9
+// Note: test renderer must be required after react-native.
10
+import renderer from 'react-test-renderer';
11
+
12
+it('renders correctly', () => {
13
+  renderer.create(<App />);
14
+});

+ 55 - 0
android/app/BUCK

@@ -0,0 +1,55 @@
1
+# To learn about Buck see [Docs](https://buckbuild.com/).
2
+# To run your application with Buck:
3
+# - install Buck
4
+# - `npm start` - to start the packager
5
+# - `cd android`
6
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
+# - `buck install -r android/app` - compile, install and run application
9
+#
10
+
11
+load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
+
13
+lib_deps = []
14
+
15
+create_aar_targets(glob(["libs/*.aar"]))
16
+
17
+create_jar_targets(glob(["libs/*.jar"]))
18
+
19
+android_library(
20
+    name = "all-libs",
21
+    exported_deps = lib_deps,
22
+)
23
+
24
+android_library(
25
+    name = "app-code",
26
+    srcs = glob([
27
+        "src/main/java/**/*.java",
28
+    ]),
29
+    deps = [
30
+        ":all-libs",
31
+        ":build_config",
32
+        ":res",
33
+    ],
34
+)
35
+
36
+android_build_config(
37
+    name = "build_config",
38
+    package = "com.reactnativeswiper",
39
+)
40
+
41
+android_resource(
42
+    name = "res",
43
+    package = "com.reactnativeswiper",
44
+    res = "src/main/res",
45
+)
46
+
47
+android_binary(
48
+    name = "app",
49
+    keystore = "//android/keystores:debug",
50
+    manifest = "src/main/AndroidManifest.xml",
51
+    package_type = "debug",
52
+    deps = [
53
+        ":app-code",
54
+    ],
55
+)

+ 151 - 0
android/app/build.gradle

@@ -0,0 +1,151 @@
1
+apply plugin: "com.android.application"
2
+
3
+import com.android.build.OutputFile
4
+
5
+/**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ *   // the name of the generated asset file containing your JS bundle
16
+ *   bundleAssetName: "index.android.bundle",
17
+ *
18
+ *   // the entry file for bundle generation
19
+ *   entryFile: "index.android.js",
20
+ *
21
+ *   // whether to bundle JS and assets in debug mode
22
+ *   bundleInDebug: false,
23
+ *
24
+ *   // whether to bundle JS and assets in release mode
25
+ *   bundleInRelease: true,
26
+ *
27
+ *   // whether to bundle JS and assets in another build variant (if configured).
28
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29
+ *   // The configuration property can be in the following formats
30
+ *   //         'bundleIn${productFlavor}${buildType}'
31
+ *   //         'bundleIn${buildType}'
32
+ *   // bundleInFreeDebug: true,
33
+ *   // bundleInPaidRelease: true,
34
+ *   // bundleInBeta: true,
35
+ *
36
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
37
+ *   // for example: to disable dev mode in the staging build type (if configured)
38
+ *   devDisabledInStaging: true,
39
+ *   // The configuration property can be in the following formats
40
+ *   //         'devDisabledIn${productFlavor}${buildType}'
41
+ *   //         'devDisabledIn${buildType}'
42
+ *
43
+ *   // the root of your project, i.e. where "package.json" lives
44
+ *   root: "../../",
45
+ *
46
+ *   // where to put the JS bundle asset in debug mode
47
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48
+ *
49
+ *   // where to put the JS bundle asset in release mode
50
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51
+ *
52
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
53
+ *   // require('./image.png')), in debug mode
54
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55
+ *
56
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
57
+ *   // require('./image.png')), in release mode
58
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59
+ *
60
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
63
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64
+ *   // for example, you might want to remove it from here.
65
+ *   inputExcludes: ["android/**", "ios/**"],
66
+ *
67
+ *   // override which node gets called and with what additional arguments
68
+ *   nodeExecutableAndArgs: ["node"],
69
+ *
70
+ *   // supply additional arguments to the packager
71
+ *   extraPackagerArgs: []
72
+ * ]
73
+ */
74
+
75
+project.ext.react = [
76
+    entryFile: "index.js"
77
+]
78
+
79
+apply from: "../../node_modules/react-native/react.gradle"
80
+
81
+/**
82
+ * Set this to true to create two separate APKs instead of one:
83
+ *   - An APK that only works on ARM devices
84
+ *   - An APK that only works on x86 devices
85
+ * The advantage is the size of the APK is reduced by about 4MB.
86
+ * Upload all the APKs to the Play Store and people will download
87
+ * the correct one based on the CPU architecture of their device.
88
+ */
89
+def enableSeparateBuildPerCPUArchitecture = false
90
+
91
+/**
92
+ * Run Proguard to shrink the Java bytecode in release builds.
93
+ */
94
+def enableProguardInReleaseBuilds = false
95
+
96
+android {
97
+    compileSdkVersion rootProject.ext.compileSdkVersion
98
+
99
+    compileOptions {
100
+        sourceCompatibility JavaVersion.VERSION_1_8
101
+        targetCompatibility JavaVersion.VERSION_1_8
102
+    }
103
+
104
+    defaultConfig {
105
+        applicationId "com.reactnativeswiper"
106
+        minSdkVersion rootProject.ext.minSdkVersion
107
+        targetSdkVersion rootProject.ext.targetSdkVersion
108
+        versionCode 1
109
+        versionName "1.0"
110
+    }
111
+    splits {
112
+        abi {
113
+            reset()
114
+            enable enableSeparateBuildPerCPUArchitecture
115
+            universalApk false  // If true, also generate a universal APK
116
+            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
117
+        }
118
+    }
119
+    buildTypes {
120
+        release {
121
+            minifyEnabled enableProguardInReleaseBuilds
122
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
123
+        }
124
+    }
125
+    // applicationVariants are e.g. debug, release
126
+    applicationVariants.all { variant ->
127
+        variant.outputs.each { output ->
128
+            // For each separate APK per architecture, set a unique version code as described here:
129
+            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
130
+            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
131
+            def abi = output.getFilter(OutputFile.ABI)
132
+            if (abi != null) {  // null for the universal-debug, universal-release variants
133
+                output.versionCodeOverride =
134
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
135
+            }
136
+        }
137
+    }
138
+}
139
+
140
+dependencies {
141
+    implementation fileTree(dir: "libs", include: ["*.jar"])
142
+    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
143
+    implementation "com.facebook.react:react-native:+"  // From node_modules
144
+}
145
+
146
+// Run this once to be able to run the application with BUCK
147
+// puts all compile dependencies into folder libs for BUCK to use
148
+task copyDownloadableDepsToLibs(type: Copy) {
149
+    from configurations.compile
150
+    into 'libs'
151
+}

+ 19 - 0
android/app/build_defs.bzl

@@ -0,0 +1,19 @@
1
+"""Helper definitions to glob .aar and .jar targets"""
2
+
3
+def create_aar_targets(aarfiles):
4
+    for aarfile in aarfiles:
5
+        name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
+        lib_deps.append(":" + name)
7
+        android_prebuilt_aar(
8
+            name = name,
9
+            aar = aarfile,
10
+        )
11
+
12
+def create_jar_targets(jarfiles):
13
+    for jarfile in jarfiles:
14
+        name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
+        lib_deps.append(":" + name)
16
+        prebuilt_jar(
17
+            name = name,
18
+            binary_jar = jarfile,
19
+        )

+ 17 - 0
android/app/proguard-rules.pro

@@ -0,0 +1,17 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:
11
+
12
+# If your project uses WebView with JS, uncomment the following
13
+# and specify the fully qualified class name to the JavaScript interface
14
+# class:
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}

+ 8 - 0
android/app/src/debug/AndroidManifest.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools">
4
+
5
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
+
7
+    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8
+</manifest>

+ 26 - 0
android/app/src/main/AndroidManifest.xml

@@ -0,0 +1,26 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+  package="com.reactnativeswiper">
3
+
4
+    <uses-permission android:name="android.permission.INTERNET" />
5
+
6
+    <application
7
+      android:name=".MainApplication"
8
+      android:label="@string/app_name"
9
+      android:icon="@mipmap/ic_launcher"
10
+      android:roundIcon="@mipmap/ic_launcher_round"
11
+      android:allowBackup="false"
12
+      android:theme="@style/AppTheme">
13
+      <activity
14
+        android:name=".MainActivity"
15
+        android:label="@string/app_name"
16
+        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
17
+        android:windowSoftInputMode="adjustResize">
18
+        <intent-filter>
19
+            <action android:name="android.intent.action.MAIN" />
20
+            <category android:name="android.intent.category.LAUNCHER" />
21
+        </intent-filter>
22
+      </activity>
23
+      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
24
+    </application>
25
+
26
+</manifest>

+ 15 - 0
android/app/src/main/java/com/reactnativeswiper/MainActivity.java

@@ -0,0 +1,15 @@
1
+package com.reactnativeswiper;
2
+
3
+import com.facebook.react.ReactActivity;
4
+
5
+public class MainActivity extends ReactActivity {
6
+
7
+    /**
8
+     * Returns the name of the main component registered from JavaScript.
9
+     * This is used to schedule rendering of the component.
10
+     */
11
+    @Override
12
+    protected String getMainComponentName() {
13
+        return "ReactNativeSwiper";
14
+    }
15
+}

+ 45 - 0
android/app/src/main/java/com/reactnativeswiper/MainApplication.java

@@ -0,0 +1,45 @@
1
+package com.reactnativeswiper;
2
+
3
+import android.app.Application;
4
+
5
+import com.facebook.react.ReactApplication;
6
+import com.facebook.react.ReactNativeHost;
7
+import com.facebook.react.ReactPackage;
8
+import com.facebook.react.shell.MainReactPackage;
9
+import com.facebook.soloader.SoLoader;
10
+
11
+import java.util.Arrays;
12
+import java.util.List;
13
+
14
+public class MainApplication extends Application implements ReactApplication {
15
+
16
+  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
17
+    @Override
18
+    public boolean getUseDeveloperSupport() {
19
+      return BuildConfig.DEBUG;
20
+    }
21
+
22
+    @Override
23
+    protected List<ReactPackage> getPackages() {
24
+      return Arrays.<ReactPackage>asList(
25
+          new MainReactPackage()
26
+      );
27
+    }
28
+
29
+    @Override
30
+    protected String getJSMainModuleName() {
31
+      return "index";
32
+    }
33
+  };
34
+
35
+  @Override
36
+  public ReactNativeHost getReactNativeHost() {
37
+    return mReactNativeHost;
38
+  }
39
+
40
+  @Override
41
+  public void onCreate() {
42
+    super.onCreate();
43
+    SoLoader.init(this, /* native exopackage */ false);
44
+  }
45
+}

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png


BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png


BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png


BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png


+ 3 - 0
android/app/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">ReactNativeSwiper</string>
3
+</resources>

+ 8 - 0
android/app/src/main/res/values/styles.xml

@@ -0,0 +1,8 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5
+        <!-- Customize your theme here. -->
6
+    </style>
7
+
8
+</resources>

+ 33 - 0
android/build.gradle

@@ -0,0 +1,33 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    ext {
5
+        buildToolsVersion = "28.0.3"
6
+        minSdkVersion = 16
7
+        compileSdkVersion = 28
8
+        targetSdkVersion = 28
9
+        supportLibVersion = "28.0.0"
10
+    }
11
+    repositories {
12
+        google()
13
+        jcenter()
14
+    }
15
+    dependencies {
16
+        classpath("com.android.tools.build:gradle:3.4.0")
17
+
18
+        // NOTE: Do not place your application dependencies here; they belong
19
+        // in the individual module build.gradle files
20
+    }
21
+}
22
+
23
+allprojects {
24
+    repositories {
25
+        mavenLocal()
26
+        google()
27
+        jcenter()
28
+        maven {
29
+            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30
+            url "$rootDir/../node_modules/react-native/android"
31
+        }
32
+    }
33
+}

+ 18 - 0
android/gradle.properties

@@ -0,0 +1,18 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true

BIN
android/gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
android/gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
1
+distributionBase=GRADLE_USER_HOME
2
+distributionPath=wrapper/dists
3
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists

+ 188 - 0
android/gradlew

@@ -0,0 +1,188 @@
1
+#!/usr/bin/env sh
2
+
3
+#
4
+# Copyright 2015 the original author or authors.
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#      http://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
19
+##############################################################################
20
+##
21
+##  Gradle start up script for UN*X
22
+##
23
+##############################################################################
24
+
25
+# Attempt to set APP_HOME
26
+# Resolve links: $0 may be a link
27
+PRG="$0"
28
+# Need this for relative symlinks.
29
+while [ -h "$PRG" ] ; do
30
+    ls=`ls -ld "$PRG"`
31
+    link=`expr "$ls" : '.*-> \(.*\)$'`
32
+    if expr "$link" : '/.*' > /dev/null; then
33
+        PRG="$link"
34
+    else
35
+        PRG=`dirname "$PRG"`"/$link"
36
+    fi
37
+done
38
+SAVED="`pwd`"
39
+cd "`dirname \"$PRG\"`/" >/dev/null
40
+APP_HOME="`pwd -P`"
41
+cd "$SAVED" >/dev/null
42
+
43
+APP_NAME="Gradle"
44
+APP_BASE_NAME=`basename "$0"`
45
+
46
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+# Use the maximum available, or set MAX_FD != -1 to use that value.
50
+MAX_FD="maximum"
51
+
52
+warn () {
53
+    echo "$*"
54
+}
55
+
56
+die () {
57
+    echo
58
+    echo "$*"
59
+    echo
60
+    exit 1
61
+}
62
+
63
+# OS specific support (must be 'true' or 'false').
64
+cygwin=false
65
+msys=false
66
+darwin=false
67
+nonstop=false
68
+case "`uname`" in
69
+  CYGWIN* )
70
+    cygwin=true
71
+    ;;
72
+  Darwin* )
73
+    darwin=true
74
+    ;;
75
+  MINGW* )
76
+    msys=true
77
+    ;;
78
+  NONSTOP* )
79
+    nonstop=true
80
+    ;;
81
+esac
82
+
83
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+# Determine the Java command to use to start the JVM.
86
+if [ -n "$JAVA_HOME" ] ; then
87
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88
+        # IBM's JDK on AIX uses strange locations for the executables
89
+        JAVACMD="$JAVA_HOME/jre/sh/java"
90
+    else
91
+        JAVACMD="$JAVA_HOME/bin/java"
92
+    fi
93
+    if [ ! -x "$JAVACMD" ] ; then
94
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95
+
96
+Please set the JAVA_HOME variable in your environment to match the
97
+location of your Java installation."
98
+    fi
99
+else
100
+    JAVACMD="java"
101
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102
+
103
+Please set the JAVA_HOME variable in your environment to match the
104
+location of your Java installation."
105
+fi
106
+
107
+# Increase the maximum file descriptors if we can.
108
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109
+    MAX_FD_LIMIT=`ulimit -H -n`
110
+    if [ $? -eq 0 ] ; then
111
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112
+            MAX_FD="$MAX_FD_LIMIT"
113
+        fi
114
+        ulimit -n $MAX_FD
115
+        if [ $? -ne 0 ] ; then
116
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
117
+        fi
118
+    else
119
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120
+    fi
121
+fi
122
+
123
+# For Darwin, add options to specify how the application appears in the dock
124
+if $darwin; then
125
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126
+fi
127
+
128
+# For Cygwin, switch paths to Windows format before running java
129
+if $cygwin ; then
130
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132
+    JAVACMD=`cygpath --unix "$JAVACMD"`
133
+
134
+    # We build the pattern for arguments to be converted via cygpath
135
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136
+    SEP=""
137
+    for dir in $ROOTDIRSRAW ; do
138
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
139
+        SEP="|"
140
+    done
141
+    OURCYGPATTERN="(^($ROOTDIRS))"
142
+    # Add a user-defined pattern to the cygpath arguments
143
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145
+    fi
146
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
147
+    i=0
148
+    for arg in "$@" ; do
149
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
151
+
152
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
153
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154
+        else
155
+            eval `echo args$i`="\"$arg\""
156
+        fi
157
+        i=$((i+1))
158
+    done
159
+    case $i in
160
+        (0) set -- ;;
161
+        (1) set -- "$args0" ;;
162
+        (2) set -- "$args0" "$args1" ;;
163
+        (3) set -- "$args0" "$args1" "$args2" ;;
164
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170
+    esac
171
+fi
172
+
173
+# Escape application args
174
+save () {
175
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176
+    echo " "
177
+}
178
+APP_ARGS=$(save "$@")
179
+
180
+# Collect all arguments for the java command, following the shell quoting and substitution rules
181
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182
+
183
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185
+  cd "$(dirname "$0")"
186
+fi
187
+
188
+exec "$JAVACMD" "$@"

+ 100 - 0
android/gradlew.bat

@@ -0,0 +1,100 @@
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      http://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
17
+@if "%DEBUG%" == "" @echo off
18
+@rem ##########################################################################
19
+@rem
20
+@rem  Gradle startup script for Windows
21
+@rem
22
+@rem ##########################################################################
23
+
24
+@rem Set local scope for the variables with windows NT shell
25
+if "%OS%"=="Windows_NT" setlocal
26
+
27
+set DIRNAME=%~dp0
28
+if "%DIRNAME%" == "" set DIRNAME=.
29
+set APP_BASE_NAME=%~n0
30
+set APP_HOME=%DIRNAME%
31
+
32
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
+
35
+@rem Find java.exe
36
+if defined JAVA_HOME goto findJavaFromJavaHome
37
+
38
+set JAVA_EXE=java.exe
39
+%JAVA_EXE% -version >NUL 2>&1
40
+if "%ERRORLEVEL%" == "0" goto init
41
+
42
+echo.
43
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44
+echo.
45
+echo Please set the JAVA_HOME variable in your environment to match the
46
+echo location of your Java installation.
47
+
48
+goto fail
49
+
50
+:findJavaFromJavaHome
51
+set JAVA_HOME=%JAVA_HOME:"=%
52
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
+
54
+if exist "%JAVA_EXE%" goto init
55
+
56
+echo.
57
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58
+echo.
59
+echo Please set the JAVA_HOME variable in your environment to match the
60
+echo location of your Java installation.
61
+
62
+goto fail
63
+
64
+:init
65
+@rem Get command-line arguments, handling Windows variants
66
+
67
+if not "%OS%" == "Windows_NT" goto win9xME_args
68
+
69
+:win9xME_args
70
+@rem Slurp the command line arguments.
71
+set CMD_LINE_ARGS=
72
+set _SKIP=2
73
+
74
+:win9xME_args_slurp
75
+if "x%~1" == "x" goto execute
76
+
77
+set CMD_LINE_ARGS=%*
78
+
79
+:execute
80
+@rem Setup the command line
81
+
82
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83
+
84
+@rem Execute Gradle
85
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86
+
87
+:end
88
+@rem End local scope for the variables with windows NT shell
89
+if "%ERRORLEVEL%"=="0" goto mainEnd
90
+
91
+:fail
92
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93
+rem the _cmd.exe /c_ return code!
94
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95
+exit /b 1
96
+
97
+:mainEnd
98
+if "%OS%"=="Windows_NT" endlocal
99
+
100
+:omega

+ 8 - 0
android/keystores/BUCK

@@ -0,0 +1,8 @@
1
+keystore(
2
+    name = "debug",
3
+    properties = "debug.keystore.properties",
4
+    store = "debug.keystore",
5
+    visibility = [
6
+        "PUBLIC",
7
+    ],
8
+)

+ 4 - 0
android/keystores/debug.keystore.properties

@@ -0,0 +1,4 @@
1
+key.store=debug.keystore
2
+key.alias=androiddebugkey
3
+key.store.password=android
4
+key.alias.password=android

+ 3 - 0
android/settings.gradle

@@ -0,0 +1,3 @@
1
+rootProject.name = 'ReactNativeSwiper'
2
+
3
+include ':app'

+ 4 - 0
app.json

@@ -0,0 +1,4 @@
1
+{
2
+  "name": "ReactNativeSwiper",
3
+  "displayName": "ReactNativeSwiper"
4
+}

+ 3 - 0
babel.config.js

@@ -0,0 +1,3 @@
1
+module.exports = {
2
+  presets: ['module:metro-react-native-babel-preset'],
3
+};

+ 9 - 0
index.js

@@ -0,0 +1,9 @@
1
+/**
2
+ * @format
3
+ */
4
+
5
+import {AppRegistry} from 'react-native';
6
+import App from './App';
7
+import {name as appName} from './app.json';
8
+
9
+AppRegistry.registerComponent(appName, () => App);

+ 54 - 0
ios/ReactNativeSwiper-tvOS/Info.plist

@@ -0,0 +1,54 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>APPL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+	<key>LSRequiresIPhoneOS</key>
24
+	<true/>
25
+	<key>UILaunchStoryboardName</key>
26
+	<string>LaunchScreen</string>
27
+	<key>UIRequiredDeviceCapabilities</key>
28
+	<array>
29
+		<string>armv7</string>
30
+	</array>
31
+	<key>UISupportedInterfaceOrientations</key>
32
+	<array>
33
+		<string>UIInterfaceOrientationPortrait</string>
34
+		<string>UIInterfaceOrientationLandscapeLeft</string>
35
+		<string>UIInterfaceOrientationLandscapeRight</string>
36
+	</array>
37
+	<key>UIViewControllerBasedStatusBarAppearance</key>
38
+	<false/>
39
+	<key>NSLocationWhenInUseUsageDescription</key>
40
+	<string></string>
41
+	<key>NSAppTransportSecurity</key>
42
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
43
+	<dict>
44
+		<key>NSExceptionDomains</key>
45
+		<dict>
46
+			<key>localhost</key>
47
+			<dict>
48
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
49
+				<true/>
50
+			</dict>
51
+		</dict>
52
+	</dict>
53
+</dict>
54
+</plist>

+ 24 - 0
ios/ReactNativeSwiper-tvOSTests/Info.plist

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

File diff suppressed because it is too large
+ 1502 - 0
ios/ReactNativeSwiper.xcodeproj/project.pbxproj


+ 129 - 0
ios/ReactNativeSwiper.xcodeproj/xcshareddata/xcschemes/ReactNativeSwiper-tvOS.xcscheme

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0940"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React-tvOS"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32
+               BuildableName = "ReactNativeSwiper-tvOS.app"
33
+               BlueprintName = "ReactNativeSwiper-tvOS"
34
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
+               BuildableName = "ReactNativeSwiper-tvOSTests.xctest"
47
+               BlueprintName = "ReactNativeSwiper-tvOSTests"
48
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64
+               BuildableName = "ReactNativeSwiper-tvOSTests.xctest"
65
+               BlueprintName = "ReactNativeSwiper-tvOSTests"
66
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
+            BuildableName = "ReactNativeSwiper-tvOS.app"
75
+            BlueprintName = "ReactNativeSwiper-tvOS"
76
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97
+            BuildableName = "ReactNativeSwiper-tvOS.app"
98
+            BlueprintName = "ReactNativeSwiper-tvOS"
99
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116
+            BuildableName = "ReactNativeSwiper-tvOS.app"
117
+            BlueprintName = "ReactNativeSwiper-tvOS"
118
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 129 - 0
ios/ReactNativeSwiper.xcodeproj/xcshareddata/xcschemes/ReactNativeSwiper.xcscheme

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0940"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
+               BuildableName = "ReactNativeSwiper.app"
33
+               BlueprintName = "ReactNativeSwiper"
34
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
+               BuildableName = "ReactNativeSwiperTests.xctest"
47
+               BlueprintName = "ReactNativeSwiperTests"
48
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
+               BuildableName = "ReactNativeSwiperTests.xctest"
65
+               BlueprintName = "ReactNativeSwiperTests"
66
+               ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
+            BuildableName = "ReactNativeSwiper.app"
75
+            BlueprintName = "ReactNativeSwiper"
76
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
+            BuildableName = "ReactNativeSwiper.app"
98
+            BlueprintName = "ReactNativeSwiper"
99
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
+            BuildableName = "ReactNativeSwiper.app"
117
+            BlueprintName = "ReactNativeSwiper"
118
+            ReferencedContainer = "container:ReactNativeSwiper.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 15 - 0
ios/ReactNativeSwiper/AppDelegate.h

@@ -0,0 +1,15 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import <React/RCTBridgeDelegate.h>
9
+#import <UIKit/UIKit.h>
10
+
11
+@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
12
+
13
+@property (nonatomic, strong) UIWindow *window;
14
+
15
+@end

+ 42 - 0
ios/ReactNativeSwiper/AppDelegate.m

@@ -0,0 +1,42 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import "AppDelegate.h"
9
+
10
+#import <React/RCTBridge.h>
11
+#import <React/RCTBundleURLProvider.h>
12
+#import <React/RCTRootView.h>
13
+
14
+@implementation AppDelegate
15
+
16
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17
+{
18
+  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
20
+                                                   moduleName:@"ReactNativeSwiper"
21
+                                            initialProperties:nil];
22
+
23
+  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
24
+
25
+  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
26
+  UIViewController *rootViewController = [UIViewController new];
27
+  rootViewController.view = rootView;
28
+  self.window.rootViewController = rootViewController;
29
+  [self.window makeKeyAndVisible];
30
+  return YES;
31
+}
32
+
33
+- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34
+{
35
+#if DEBUG
36
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
37
+#else
38
+  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39
+#endif
40
+}
41
+
42
+@end

+ 42 - 0
ios/ReactNativeSwiper/Base.lproj/LaunchScreen.xib

@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
+    </dependencies>
8
+    <objects>
9
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
12
+            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
+            <subviews>
15
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
+                    <rect key="frame" x="20" y="439" width="441" height="21"/>
17
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
+                    <nil key="highlightedColor"/>
20
+                </label>
21
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ReactNativeSwiper" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
+                    <rect key="frame" x="20" y="140" width="441" height="43"/>
23
+                    <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
+                    <nil key="highlightedColor"/>
26
+                </label>
27
+            </subviews>
28
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
+            <constraints>
30
+                <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
+                <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
+                <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
+                <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
+                <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
+                <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
+            </constraints>
37
+            <nil key="simulatedStatusBarMetrics"/>
38
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
+            <point key="canvasLocation" x="548" y="455"/>
40
+        </view>
41
+    </objects>
42
+</document>

+ 38 - 0
ios/ReactNativeSwiper/Images.xcassets/AppIcon.appiconset/Contents.json

@@ -0,0 +1,38 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "iphone",
5
+      "size" : "29x29",
6
+      "scale" : "2x"
7
+    },
8
+    {
9
+      "idiom" : "iphone",
10
+      "size" : "29x29",
11
+      "scale" : "3x"
12
+    },
13
+    {
14
+      "idiom" : "iphone",
15
+      "size" : "40x40",
16
+      "scale" : "2x"
17
+    },
18
+    {
19
+      "idiom" : "iphone",
20
+      "size" : "40x40",
21
+      "scale" : "3x"
22
+    },
23
+    {
24
+      "idiom" : "iphone",
25
+      "size" : "60x60",
26
+      "scale" : "2x"
27
+    },
28
+    {
29
+      "idiom" : "iphone",
30
+      "size" : "60x60",
31
+      "scale" : "3x"
32
+    }
33
+  ],
34
+  "info" : {
35
+    "version" : 1,
36
+    "author" : "xcode"
37
+  }
38
+}

+ 6 - 0
ios/ReactNativeSwiper/Images.xcassets/Contents.json

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  }
6
+}

+ 60 - 0
ios/ReactNativeSwiper/Info.plist

@@ -0,0 +1,60 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>ReactNativeSwiper</string>
9
+	<key>CFBundleExecutable</key>
10
+	<string>$(EXECUTABLE_NAME)</string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>$(PRODUCT_NAME)</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>APPL</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>1.0</string>
21
+	<key>CFBundleSignature</key>
22
+	<string>????</string>
23
+	<key>CFBundleVersion</key>
24
+	<string>1</string>
25
+	<key>LSRequiresIPhoneOS</key>
26
+	<true/>
27
+	<key>NSLocationWhenInUseUsageDescription</key>
28
+	<string></string>
29
+	<key>UILaunchStoryboardName</key>
30
+	<string>LaunchScreen</string>
31
+	<key>UIRequiredDeviceCapabilities</key>
32
+	<array>
33
+		<string>armv7</string>
34
+	</array>
35
+	<key>UISupportedInterfaceOrientations</key>
36
+	<array>
37
+		<string>UIInterfaceOrientationPortrait</string>
38
+		<string>UIInterfaceOrientationLandscapeLeft</string>
39
+		<string>UIInterfaceOrientationLandscapeRight</string>
40
+	</array>
41
+	<key>UIViewControllerBasedStatusBarAppearance</key>
42
+	<false/>
43
+	<key>NSLocationWhenInUseUsageDescription</key>
44
+	<string></string>
45
+	<key>NSAppTransportSecurity</key>
46
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
47
+	<dict>
48
+    <key>NSAllowsArbitraryLoads</key>
49
+    <true/>
50
+		<key>NSExceptionDomains</key>
51
+		<dict>
52
+			<key>localhost</key>
53
+			<dict>
54
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
55
+				<true/>
56
+			</dict>
57
+		</dict>
58
+	</dict>
59
+</dict>
60
+</plist>

+ 16 - 0
ios/ReactNativeSwiper/main.m

@@ -0,0 +1,16 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import <UIKit/UIKit.h>
9
+
10
+#import "AppDelegate.h"
11
+
12
+int main(int argc, char * argv[]) {
13
+  @autoreleasepool {
14
+    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15
+  }
16
+}

+ 24 - 0
ios/ReactNativeSwiperTests/Info.plist

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 68 - 0
ios/ReactNativeSwiperTests/ReactNativeSwiperTests.m

@@ -0,0 +1,68 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+#import <UIKit/UIKit.h>
9
+#import <XCTest/XCTest.h>
10
+
11
+#import <React/RCTLog.h>
12
+#import <React/RCTRootView.h>
13
+
14
+#define TIMEOUT_SECONDS 600
15
+#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
16
+
17
+@interface ReactNativeSwiperTests : XCTestCase
18
+
19
+@end
20
+
21
+@implementation ReactNativeSwiperTests
22
+
23
+- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24
+{
25
+  if (test(view)) {
26
+    return YES;
27
+  }
28
+  for (UIView *subview in [view subviews]) {
29
+    if ([self findSubviewInView:subview matching:test]) {
30
+      return YES;
31
+    }
32
+  }
33
+  return NO;
34
+}
35
+
36
+- (void)testRendersWelcomeScreen
37
+{
38
+  UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
39
+  NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40
+  BOOL foundElement = NO;
41
+
42
+  __block NSString *redboxError = nil;
43
+  RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
44
+    if (level >= RCTLogLevelError) {
45
+      redboxError = message;
46
+    }
47
+  });
48
+
49
+  while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
50
+    [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
51
+    [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
52
+
53
+    foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
54
+      if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
55
+        return YES;
56
+      }
57
+      return NO;
58
+    }];
59
+  }
60
+
61
+  RCTSetLogFunction(RCTDefaultLogFunction);
62
+
63
+  XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64
+  XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65
+}
66
+
67
+
68
+@end

+ 67 - 0
lib/README.md

@@ -0,0 +1,67 @@
1
+# RN-Swiper
2
+
3
+#### ScreenShot
4
+![image](https://github.com/CQKM/RN-Swiper/blob/master/screenshot.gif)
5
+
6
+or
7
+project/screenshot.gif
8
+
9
+
10
+#### Usage
11
+
12
+`yarn add rnezswiper` or `npm install rnezswiper`
13
+
14
+`import RNSwiper from 'rnezswiper'`
15
+
16
+```javascript
17
+let data = 'HelloWord'.toUpperCase().split('')
18
+const { width, height } = Dimensions.get("window")
19
+
20
+<View style={styles.container}>
21
+    <View style={{ height: 200 }}> // wrapStyle
22
+        <RNSwiper
23
+        loop
24
+        autoPlay
25
+        initIndex={0}
26
+        onChangeIndex={(index) => {  }}
27
+        slideStyle={styles.slideStyle}
28
+        renderPagination={(index) => { // customize pagination
29
+            return (
30
+            <View style={[{ position: 'absolute', bottom: 0, height: 30, width, left: 0,zIndex: 1 }]}>
31
+                <Text style={{ color: '#fff',textAlign: 'center' }}>{`${index + 1}/${data.length}`}</Text>
32
+            </View>
33
+            )
34
+        }}
35
+        >
36
+        {
37
+            data.map(item => <Text key={item} style={styles.font}>{item}</Text>)
38
+        }
39
+        </RNSwiper>
40
+    </View>
41
+    <Text>other content</Text>
42
+</View>
43
+
44
+const styles = StyleSheet.create({
45
+  container: {
46
+    flex: 1,
47
+  },
48
+  font: {
49
+    color: '#fff',
50
+    fontSize: 30
51
+  },
52
+  slideStyle: { height: 200, width, backgroundColor: '#7e57c2' },
53
+});
54
+
55
+```
56
+#### Properties
57
+
58
+Prop | Default | Type | Description
59
+-|-|-|-
60
+slideStyle | {} | ViewStyle | none
61
+loop | true | boolean | Set to `false` to disable continuous loop mode.
62
+autoPlay | true | boolean | Set to `true` enable auto play mode.
63
+autoPlayTimeOut | 3000 | number | auto paly delay
64
+initIndex | 0 | number | Index number of initial slide
65
+onIndexChanged | (index) => null | function | Called with the new index when the user swiped
66
+renderPagination | (index) => null | JSX | customize pagination
67
+animation | (value, toValue) => Animated  | function | customize animated

+ 14 - 0
lib/RNSwiper.d.ts

@@ -0,0 +1,14 @@
1
+
2
+import { ViewStyle, Animated } from 'react-native'
3
+interface RNSwiperProps {
4
+    slideStyle: ViewStyle
5
+    loop: boolean
6
+    autoPlay: boolean
7
+    autoPlayTimeOut: number
8
+    initIndex: number
9
+    animation: () => {}
10
+    onChangeIndex: () => {}
11
+    renderPagination: () => {}
12
+}
13
+
14
+export default class RNSwiper extends Component <RNSwiperProps>{}

+ 204 - 0
lib/RNSwiper.js

@@ -0,0 +1,204 @@
1
+import React, { Component, PureComponent } from 'react'
2
+import { View, Text, Animated, ScrollView, PanResponder, Dimensions, StyleSheet,} from 'react-native'
3
+const { width, height } = Dimensions.get("window")
4
+
5
+export default class RNSwiper extends Component {
6
+  static defaultProps = {
7
+    slideStyle: {},
8
+    loop: true,
9
+    autoPlay: true,
10
+    autoPlayTimeOut: 3000,
11
+    initIndex: 0,
12
+    onChangeIndex: () => {  },
13
+    renderPagination: () => {},
14
+    animation: (value, toValue) => {
15
+      return Animated.spring(value, {
16
+        toValue: toValue,
17
+        friction: 10,
18
+        tension: 50,
19
+        useNativeDriver: true
20
+      });
21
+    },
22
+  }
23
+  scrollViewRef;
24
+  dx = 0;
25
+  autoPlayTimer;
26
+  state = {
27
+    activeIndex: 1,
28
+    scrollValue: new Animated.Value(-styles.slideStyle.width),
29
+  }
30
+
31
+  componentWillMount() {
32
+    this._panResponder = PanResponder.create({
33
+      // 要求成为响应者:
34
+      onStartShouldSetPanResponder: (evt, gestureState) => true,
35
+      onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
36
+      onMoveShouldSetPanResponder: (evt, gestureState) => true,
37
+      onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,
38
+      onPanResponderGrant: (evt, gestureState) => { },
39
+      onPanResponderMove: (evt, gestureState) => {
40
+        this.getLoopStatus(gestureState) ? this.onPanResponderMove(gestureState.dx) : null
41
+        this.stopAutoPlay();
42
+      },
43
+      onPanResponderTerminationRequest: (evt, gestureState) => true,
44
+      onPanResponderRelease: (evt, gestureState) => {
45
+        let nextStatu = this.computeNextOrPrev(gestureState)
46
+        this.getLoopStatus(gestureState) ? nextStatu ? this.goPage(nextStatu) : null : null;
47
+        this.props.autoPlay
48
+        ? (this.stopAutoPlay(),
49
+          this.startAutoPlay())
50
+        : null;
51
+      },
52
+      onPanResponderTerminate: (evt, gestureState) => {
53
+        // 另一个组件已经成为了新的响应者,所以当前手势将被取消。
54
+      },
55
+      onShouldBlockNativeResponder: (evt, gestureState) => {
56
+        return true;
57
+      },
58
+    });
59
+  }
60
+  
61
+  componentWillReceiveProps (nextProps, nextState) {
62
+    if (nextProps.autoplay) {
63
+      this.startAutoPlay();
64
+    } else {
65
+        this.stopAutoPlay();
66
+    }
67
+  }
68
+
69
+  componentDidMount () {
70
+    const { autoPlay, initIndex } = this.props
71
+    let index = (initIndex > this.getPageNumber() - 2 || initIndex < 0)
72
+    ? (this.getPageNumber() - 2, this.console('warn', 'The props “initIndex” is out of range!'))
73
+    : initIndex;
74
+    console.log('index', index)
75
+    if (autoPlay) {
76
+      this.startAutoPlay()
77
+    } else {
78
+      this.stopAutoPlay()
79
+    }
80
+    this.goPage('Next', index, false)
81
+  }
82
+  startAutoPlay = () => {
83
+    this.stopAutoPlay();
84
+    this.autoPlayTimer = setInterval(() => {
85
+      this.goPage('Next')
86
+    }, this.props.autoPlayTimeOut)
87
+  }
88
+  stopAutoPlay = () => {
89
+    if (this.autoPlayTimer) {
90
+      clearInterval(this.autoPlayTimer)
91
+    }
92
+  }
93
+  onPanResponderMove = (dx) => {
94
+    let childrenWidth = styles.slideStyle.width;
95
+    const { activeIndex } = this.state
96
+    this.state.scrollValue.setValue(-activeIndex * childrenWidth + dx)
97
+  }
98
+  computeNextOrPrev = (gestureState) =>{
99
+    let dx = gestureState.dx
100
+    if (dx === 0) return // 单纯的点击事件
101
+    return dx > 0 ? 'Prev' : 'Next';
102
+  }
103
+  goPage = (nextStatu = 'Next', index = undefined, animate = true) => {
104
+    let { activeIndex } = this.state
105
+    let childrenWidth = styles.slideStyle.width;
106
+    let nextIndex = index !== undefined ? index : nextStatu === 'Prev' ? --activeIndex : ++activeIndex;
107
+    this.getNowIndex(nextStatu, nextIndex)
108
+    if (animate) {
109
+      this.startGoPageAnimated(nextStatu, nextIndex)
110
+    } else {
111
+      let initIndex = nextIndex === 0 ? 1 : nextIndex === this.getPageNumber() - 2 ? 0 : ++nextIndex;
112
+      this.setState({ activeIndex: initIndex }, () => { this.state.scrollValue.setValue(-initIndex * childrenWidth) })
113
+    }
114
+  }
115
+  startGoPageAnimated = (nextStatu, nextIndex) => {
116
+    let pageNum = this.getPageNumber();
117
+    let childrenWidth = styles.slideStyle.width;
118
+    this.setState({ activeIndex: nextIndex }, () => {
119
+      this.props.animation(this.state.scrollValue, -nextIndex * childrenWidth).start(() => {
120
+         // 上一页
121
+        nextIndex <= 0 && nextStatu === 'Prev'
122
+          ? this.setState({ activeIndex: pageNum - 2 }, () => { this.state.scrollValue.setValue(-childrenWidth * ( pageNum - 2 )) }) // 滑动动画
123
+          : this.state.scrollValue.setValue(-nextIndex * childrenWidth); // 超出边界重置位置
124
+         // 下一页
125
+        nextIndex >= pageNum - 1 && nextStatu === 'Next'
126
+          ? this.setState({ activeIndex: 1 }, () => { this.state.scrollValue.setValue(-childrenWidth); })
127
+          : this.state.scrollValue.setValue(-nextIndex * childrenWidth)
128
+      });
129
+    })
130
+  }
131
+  getLoopStatus = (gestureState) => {
132
+    let { activeIndex } = this.state
133
+    let { loop } = this.props
134
+    let nextStatu = this.computeNextOrPrev(gestureState)
135
+    let nextIndex = nextStatu === 'Prev' ? --activeIndex : ++activeIndex;
136
+    let pageNum = this.getPageNumber();
137
+    let isLastPage = (nextIndex <= 0 || nextIndex >= pageNum - 1);
138
+    return isLastPage ? isLastPage && loop : true;
139
+  }
140
+  getNowIndex = (status, index) => {
141
+    const { onChangeIndex } = this.props
142
+    const childLength = this.getPageNumber() - 2;
143
+    status === 'Prev'
144
+      ? onChangeIndex(index <= 0 ? childLength - 1 : index - 1)
145
+      : onChangeIndex(index > childLength ? 0 : index - 1)
146
+  }
147
+  getPageArr = () => {
148
+    const { children } = this.props
149
+    let childArr = React.Children.toArray(children)
150
+    childArr.unshift(childArr[childArr.length - 1]);
151
+    childArr.push(childArr[1]);
152
+    return childArr
153
+  }
154
+  getPageNumber = () => {
155
+    return this.getPageArr().length
156
+  }
157
+  console = (type = 'log', msg = '') => {
158
+    console[type](msg);
159
+  }
160
+  render (){
161
+    const { slideStyle, renderPagination } = this.props
162
+    const { activeIndex } = this.state
163
+    let pageArr = this.getPageArr();
164
+    let pageNum = this.getPageNumber();
165
+    const transform = [{ translateX: this.state.scrollValue }]
166
+    let pageIndex = activeIndex > this.getPageNumber() - 2 ? 0 : activeIndex <= 0 ? this.getPageNumber() - 3 : activeIndex - 1;
167
+    const content = (
168
+      <Animated.View
169
+        style={[styles.flex_start,{ width: pageNum * width, transform}]}
170
+        {...this._panResponder.panHandlers}
171
+      >
172
+        {
173
+          pageArr.map((item,index) => {
174
+            return (
175
+              <View key={index} style={[styles.slideStyle, styles.flex_center, slideStyle]}>
176
+                {item}
177
+              </View>
178
+            )
179
+          })
180
+        }
181
+      </Animated.View>
182
+    )
183
+    return (
184
+      <ScrollView
185
+        ref={(ref) => {this.scrollViewRef = ref}}
186
+        horizontal
187
+        scrollEnabled={false}
188
+        scrollEventThrottle = {200}
189
+      >
190
+        { content }
191
+        <View style={[styles.slideStyle, { position: 'absolute',backgroundColor: 'transparents' }]}>
192
+          {
193
+            renderPagination(pageIndex)
194
+          }
195
+        </View>
196
+      </ScrollView>
197
+    )
198
+  }
199
+}
200
+const styles = StyleSheet.create({
201
+    flex_start: { justifyContent: 'flex-start', flexDirection: 'row', alignItems: 'center'},
202
+    flex_center: { justifyContent: 'center', alignItems: 'center' },
203
+    slideStyle: { height: 200, width, backgroundColor: 'red' },
204
+})

+ 2 - 0
lib/index.js

@@ -0,0 +1,2 @@
1
+import RNSwiper from './RNSwiper'
2
+export default RNSwiper

+ 24 - 0
lib/package.json

@@ -0,0 +1,24 @@
1
+{
2
+  "name": "rnezswiper",
3
+  "version": "1.0.1",
4
+  "description": "a simple swiper",
5
+  "main": "index.js",
6
+  "scripts": {
7
+    "test": "echo \"Error: no test specified\" && exit 1"
8
+  },
9
+  "repository": {
10
+    "type": "git",
11
+    "url": "git+https://github.com/CQKM/RN-Swiper.git"
12
+  },
13
+  "keywords": [
14
+    "swiper",
15
+    "RN",
16
+    "RN-Swiper"
17
+  ],
18
+  "author": "hjhgzem@163.com",
19
+  "license": "ISC",
20
+  "bugs": {
21
+    "url": "https://github.com/CQKM/RN-Swiper/issues"
22
+  },
23
+  "homepage": "https://github.com/CQKM/RN-Swiper#readme"
24
+}

+ 17 - 0
metro.config.js

@@ -0,0 +1,17 @@
1
+/**
2
+ * Metro configuration for React Native
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+
8
+module.exports = {
9
+  transformer: {
10
+    getTransformOptions: async () => ({
11
+      transform: {
12
+        experimentalImportSupport: false,
13
+        inlineRequires: false,
14
+      },
15
+    }),
16
+  },
17
+};

+ 25 - 0
package.json

@@ -0,0 +1,25 @@
1
+{
2
+  "name": "ReactNativeSwiper",
3
+  "version": "0.0.1",
4
+  "private": true,
5
+  "scripts": {
6
+    "start": "node node_modules/react-native/local-cli/cli.js start",
7
+    "test": "jest"
8
+  },
9
+  "dependencies": {
10
+    "react": "16.8.3",
11
+    "react-native": "0.59.9",
12
+    "rnezswiper": "^1.0.1"
13
+  },
14
+  "devDependencies": {
15
+    "@babel/core": "^7.4.5",
16
+    "@babel/runtime": "^7.4.5",
17
+    "babel-jest": "^24.8.0",
18
+    "jest": "^24.8.0",
19
+    "metro-react-native-babel-preset": "^0.54.1",
20
+    "react-test-renderer": "16.8.3"
21
+  },
22
+  "jest": {
23
+    "preset": "react-native"
24
+  }
25
+}

BIN
screenshot.gif


File diff suppressed because it is too large
+ 6229 - 0
yarn.lock