Skip to content

Commit 9bb6bc7

Browse files
committed
Migrated segmentedControlIos from RN core to community version
1 parent 1fff604 commit 9bb6bc7

23 files changed

+1345
-0
lines changed

.circleci/config.yml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# -------------------------
2+
# DEFAULTS
3+
# -------------------------
4+
defaults: &defaults
5+
working_directory: ~/react-native-segmented-control
6+
environment:
7+
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
8+
9+
# LINUX
10+
linux_defaults: &linux_defaults
11+
<<: *defaults
12+
docker:
13+
- image: circleci/node:8
14+
environment:
15+
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
16+
17+
# ANDROID
18+
android_defaults: &android_defaults
19+
<<: *defaults
20+
docker:
21+
- image: circleci/android:api-27-node8-alpha
22+
resource_class: "large"
23+
environment:
24+
- TERM: "dumb"
25+
- ADB_INSTALL_TIMEOUT: 10
26+
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
27+
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
28+
- BUILD_THREADS: 2
29+
30+
# MACOS
31+
macos_defaults: &macos_defaults
32+
<<: *defaults
33+
resource_class: "large"
34+
macos:
35+
xcode: "10.1.0"
36+
37+
# -------------------------
38+
# ALIASES
39+
# -------------------------
40+
41+
aliases:
42+
# CACHE
43+
- &restore-yarn-cache
44+
keys:
45+
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
46+
- yarn-cache-{{ arch }}
47+
- &save-yarn-cache
48+
paths:
49+
- ~/.cache/yarn
50+
- ~/Library/Detox/ios
51+
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
52+
53+
- &restore-gradle-cache
54+
keys:
55+
- gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
56+
- &save-gradle-cache
57+
paths:
58+
- ~/.gradle
59+
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
60+
61+
# INSTALLATION
62+
- &yarn
63+
name: Yarn Install
64+
command: |
65+
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
66+
67+
# ANALYSE
68+
# - &eslint
69+
# name: ESLint Checks
70+
# command: yarn test:eslint
71+
72+
- &flow
73+
name: Flow Checks
74+
command: yarn flow check
75+
76+
# - &jest
77+
# name: Jest Unit Tests
78+
# command: yarn test:jest
79+
80+
# -------------------------
81+
# JOBS
82+
# -------------------------
83+
version: 2
84+
jobs:
85+
# Set up a Linux environment for downstream jobs
86+
linux-checkout:
87+
<<: *linux_defaults
88+
steps:
89+
- checkout
90+
- restore-cache: *restore-yarn-cache
91+
- run: rm -rf node_modules
92+
- run: yarn cache clean
93+
- run: *yarn
94+
- save-cache: *save-yarn-cache
95+
- persist_to_workspace:
96+
root: .
97+
paths: .
98+
99+
# eslint:
100+
# <<: *linux_defaults
101+
# steps:
102+
# - attach_workspace:
103+
# at: ~/react-native-viewpager
104+
# - run: *eslint
105+
106+
flow:
107+
<<: *linux_defaults
108+
steps:
109+
- attach_workspace:
110+
at: ~/react-native-viewpager
111+
- run: *flow
112+
113+
# jest:
114+
# <<: *linux_defaults
115+
# steps:
116+
# - attach_workspace:
117+
# at: ~/react-native-viewpager
118+
# - run: *jest
119+
120+
android-compile:
121+
<<: *android_defaults
122+
steps:
123+
- attach_workspace:
124+
at: ~/react-native-viewpager
125+
- restore-cache: *restore-gradle-cache
126+
- run:
127+
name: Accept Android licences
128+
command: |-
129+
yes | sdkmanager --licenses || exit 0
130+
yes | sdkmanager --update || exit 0
131+
- run:
132+
name: Build Android Example App and Library
133+
command: |-
134+
cd example/android
135+
./gradlew clean assembleDebug
136+
- save-cache: *save-gradle-cache
137+
138+
ios-checkout:
139+
<<: *macos_defaults
140+
steps:
141+
- checkout
142+
- restore-cache: *restore-yarn-cache
143+
- run: rm -rf node_modules
144+
- run: yarn cache clean
145+
- run: *yarn
146+
- save-cache: *save-yarn-cache
147+
- persist_to_workspace:
148+
root: .
149+
paths: .
150+
151+
ios-compile:
152+
<<: *macos_defaults
153+
steps:
154+
- attach_workspace:
155+
at: ~/react-native-viewpager
156+
- run:
157+
name: Build example app
158+
command: |-
159+
react-native run-ios --project-path example/ios
160+
161+
# -------------------------
162+
# WORKFLOWS
163+
# -------------------------
164+
workflows:
165+
version: 2
166+
Test:
167+
jobs:
168+
- linux-checkout
169+
# - eslint:
170+
# requires:
171+
# - linux-checkout
172+
- flow:
173+
requires:
174+
- linux-checkout
175+
# - jest:
176+
# requires:
177+
# - linux-checkout
178+
- android-compile:
179+
requires:
180+
- linux-checkout
181+
# Disabled until we have macOS containers enabled
182+
# - ios-checkout
183+
# - ios-compile:
184+
# requires:
185+
# - ios-checkout

.flowconfig

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/node_modules/react-native/.*/*[.]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+
node_modules/react-native/flow-github/
28+
29+
[options]
30+
emoji=true
31+
32+
esproposal.optional_chaining=enable
33+
esproposal.nullish_coalescing=enable
34+
35+
module.system=haste
36+
module.system.haste.use_name_reducers=true
37+
# get basename
38+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39+
# strip .js or .js.flow suffix
40+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41+
# strip .ios suffix
42+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
44+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
45+
module.system.haste.paths.blacklist=.*/__tests__/.*
46+
module.system.haste.paths.blacklist=.*/__mocks__/.*
47+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
48+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
49+
50+
munge_underscores=true
51+
52+
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'
53+
# Support the library import in examples
54+
module.name_mapper='^\@react-native-community/viewpager$' -> '<PROJECT_ROOT>/js/index.js'
55+
56+
module.file_ext=.js
57+
module.file_ext=.jsx
58+
module.file_ext=.json
59+
module.file_ext=.native.js
60+
module.file_ext=.android.js
61+
module.file_ext=.ios.js
62+
63+
suppress_type=$FlowIssue
64+
suppress_type=$FlowFixMe
65+
suppress_type=$FlowFixMeProps
66+
suppress_type=$FlowFixMeState
67+
68+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
69+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
70+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
71+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
72+
73+
[version]
74+
^0.86.0

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2015-present, Facebook, Inc.
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.

android/build.gradle

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
jcenter()
5+
}
6+
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:3.2.1'
9+
}
10+
}
11+
12+
def getExtOrDefault(name) {
13+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeSegmentedControl_' + name]
14+
}
15+
16+
def getExtOrIntegerDefault(name) {
17+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeSegmentedControl_' + name]).toInteger()
18+
}
19+
20+
apply plugin: 'com.android.library'
21+
22+
android {
23+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
24+
buildToolsVersion getExtOrDefault('buildToolsVersion')
25+
26+
defaultConfig {
27+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
28+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
29+
}
30+
}
31+
32+
repositories {
33+
google()
34+
jcenter()
35+
mavenCentral()
36+
}
37+
38+
dependencies {
39+
//noinspection GradleDynamicVersion
40+
api 'com.facebook.react:react-native:+'
41+
}

android/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ReactNativeSegmentedControl_compileSdkVersion=28
2+
ReactNativeSegmentedControl_buildToolsVersion=28.0.3
3+
ReactNativeSegmentedControl_targetSdkVersion=27
4+
ReactNativeSegmentedControl_minSdkVersion=16
53.1 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Feb 08 22:19:11 CET 2019
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

0 commit comments

Comments
 (0)