Skip to content

Commit aa9364f

Browse files
troZeePiotr Trocki
andauthored
chore: upgrade react-native in example to 0.63 (#210)
* chore: update example to 63 * fix ios, flow, lint * bump flow version * fix flow Co-authored-by: Piotr Trocki <[email protected]>
1 parent 426c05a commit aa9364f

File tree

17 files changed

+1153
-643
lines changed

17 files changed

+1153
-643
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ untyped-import
8181
untyped-type-import
8282

8383
[version]
84-
^0.113.0
84+
0.122.0

example/ViewPagerExample.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ export default class ViewPagerExample extends React.Component<*, State> {
8282
};
8383

8484
addPage = () => {
85-
this.setState(prevState => ({
85+
this.setState((prevState) => ({
8686
pages: [...prevState.pages, createPage(prevState.pages.length)],
8787
}));
8888
};
8989

9090
removeLastPage = () => {
91-
this.setState(prevState => ({
91+
this.setState((prevState) => ({
9292
pages: prevState.pages.slice(0, prevState.pages.length - 1),
9393
}));
9494
};
@@ -118,7 +118,7 @@ export default class ViewPagerExample extends React.Component<*, State> {
118118
}
119119

120120
toggleDotsVisibility = () => {
121-
this.setState(prevState => ({dotsVisible: !prevState.dotsVisible}));
121+
this.setState((prevState) => ({dotsVisible: !prevState.dotsVisible}));
122122
};
123123

124124
render() {
@@ -139,7 +139,7 @@ export default class ViewPagerExample extends React.Component<*, State> {
139139
transitionStyle="scroll"
140140
showPageIndicator={dotsVisible}
141141
ref={this.viewPager}>
142-
{pages.map(p => this.renderPage(p))}
142+
{pages.map((p) => this.renderPage(p))}
143143
</ViewPager>
144144
<View style={styles.buttons}>
145145
<Button

example/android/app/build.gradle

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21-
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
21+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
2222
* bundleCommand: "ram-bundle",
2323
*
2424
* // whether to bundle JS and assets in debug mode
@@ -76,7 +76,7 @@ import com.android.build.OutputFile
7676
*/
7777

7878
project.ext.react = [
79-
enableHermes: true, // clean and rebuild if changing
79+
enableHermes: true, // clean and rebuild if changing
8080
]
8181

8282
apply from: "../../../node_modules/react-native/react.gradle"
@@ -161,12 +161,12 @@ android {
161161
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
162162
}
163163
}
164-
packagingOptions {
165-
pickFirst "lib/armeabi-v7a/libc++_shared.so"
166-
pickFirst "lib/arm64-v8a/libc++_shared.so"
167-
pickFirst "lib/x86/libc++_shared.so"
168-
pickFirst "lib/x86_64/libc++_shared.so"
169-
}
164+
packagingOptions {
165+
pickFirst "lib/armeabi-v7a/libc++_shared.so"
166+
pickFirst "lib/arm64-v8a/libc++_shared.so"
167+
pickFirst "lib/x86/libc++_shared.so"
168+
pickFirst "lib/x86_64/libc++_shared.so"
169+
}
170170

171171
// applicationVariants are e.g. debug, release
172172
applicationVariants.all { variant ->
@@ -193,13 +193,14 @@ dependencies {
193193
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
194194

195195
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
196-
exclude group:'com.facebook.fbjni'
196+
exclude group: 'com.facebook.fbjni'
197197
}
198198
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
199-
exclude group:'com.facebook.flipper'
199+
exclude group: 'com.facebook.flipper'
200+
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
200201
}
201202
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
202-
exclude group:'com.facebook.flipper'
203+
exclude group: 'com.facebook.flipper'
203204
}
204205

205206
if (enableHermes) {

example/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "28.0.3"
5+
buildToolsVersion = "29.0.2"
66
minSdkVersion = 16
7-
compileSdkVersion = 28
8-
targetSdkVersion = 28
7+
compileSdkVersion = 29
8+
targetSdkVersion = 29
99
appCompatVersion = "1.0.2"
1010
}
1111
repositories {
@@ -14,7 +14,7 @@ buildscript {
1414
maven { url 'https://jitpack.io' }
1515
}
1616
dependencies {
17-
classpath("com.android.tools.build:gradle:3.5.2")
17+
classpath("com.android.tools.build:gradle:3.5.3")
1818

1919
// NOTE: Do not place your application dependencies here; they belong
2020
// in the individual module build.gradle files

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ android.useAndroidX=true
2525
android.enableJetifier=true
2626

2727
# Version of flipper SDK to use with React Native
28-
FLIPPER_VERSION=0.33.1
28+
FLIPPER_VERSION=0.37.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

example/android/gradlew

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
99
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
10+
# https://www.apache.org/licenses/LICENSE-2.0
1111
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154154
else
155155
eval `echo args$i`="\"$arg\""
156156
fi
157-
i=$((i+1))
157+
i=`expr $i + 1`
158158
done
159159
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" ;;
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" ;;
170170
esac
171171
fi
172172

@@ -175,14 +175,9 @@ save () {
175175
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176176
echo " "
177177
}
178-
APP_ARGS=$(save "$@")
178+
APP_ARGS=`save "$@"`
179179

180180
# Collect all arguments for the java command, following the shell quoting and substitution rules
181181
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182182

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" "$@"
183+
exec "$JAVACMD" "$@"

example/android/gradlew.bat

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@rem you may not use this file except in compliance with the License.
66
@rem You may obtain a copy of the License at
77
@rem
8-
@rem http://www.apache.org/licenses/LICENSE-2.0
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
99
@rem
1010
@rem Unless required by applicable law or agreed to in writing, software
1111
@rem distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

@@ -97,4 +100,4 @@ exit /b 1
97100
:mainEnd
98101
if "%OS%"=="Windows_NT" endlocal
99102

100-
:omega
103+
:omega

example/ios/Podfile

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,29 @@
1-
platform :ios, '9.0'
21
require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
2+
require_relative 'RNPod'
33

4-
def add_flipper_pods!
5-
version = '~> 0.33.1'
6-
pod 'FlipperKit', version, :configuration => 'Debug'
7-
pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'
8-
pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'
9-
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug'
10-
pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug'
11-
end
12-
# Post Install processing for Flipper
13-
def flipper_post_install(installer)
14-
installer.pods_project.targets.each do |target|
15-
if target.name == 'YogaKit'
16-
target.build_configurations.each do |config|
17-
config.build_settings['SWIFT_VERSION'] = '4.1'
18-
end
19-
end
20-
end
21-
end
4+
platform :ios, '10.0'
225

236
target 'ViewPagerExample' do
24-
# Pods for ViewPagerExample
25-
pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
26-
pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
27-
pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
28-
pod 'RCTTypeSafety', :path => "../../node_modules/react-native/Libraries/TypeSafety"
29-
pod 'React', :path => '../../node_modules/react-native/'
30-
pod 'React-Core', :path => '../../node_modules/react-native/'
31-
pod 'React-CoreModules', :path => '../../node_modules/react-native/React/CoreModules'
32-
pod 'React-Core/DevSupport', :path => '../../node_modules/react-native/'
33-
pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS'
34-
pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation'
35-
pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob'
36-
pod 'React-RCTImage', :path => '../../node_modules/react-native/Libraries/Image'
37-
pod 'React-RCTLinking', :path => '../../node_modules/react-native/Libraries/LinkingIOS'
38-
pod 'React-RCTNetwork', :path => '../../node_modules/react-native/Libraries/Network'
39-
pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings'
40-
pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text'
41-
pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration'
42-
pod 'React-Core/RCTWebSocket', :path => '../../node_modules/react-native/'
437

44-
pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact'
45-
pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
46-
pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
47-
pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
48-
pod 'ReactCommon/callinvoker', :path => "../../node_modules/react-native/ReactCommon"
49-
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
50-
51-
pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
52-
pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
53-
pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
8+
config = use_native_modules!
549

10+
use_react_native!(:path => config["reactNativePath"])
5511
pod 'react-native-viewpager', :path => '../../react-native-viewpager.podspec'
5612

5713
target 'ViewPagerExampleTests' do
5814
inherit! :complete
5915
# Pods for testing
6016
end
6117

62-
use_native_modules!
63-
6418
# Enables Flipper.
6519
#
6620
# Note that if you have use_frameworks! enabled, Flipper will not work and
6721
# you should disable these next few lines.
68-
add_flipper_pods!
22+
use_flipper!
6923
post_install do |installer|
7024
flipper_post_install(installer)
7125
end
26+
7227
end
7328

7429
target 'ViewPagerExample-tvOS' do

0 commit comments

Comments
 (0)