Skip to content

Commit

Permalink
Merge pull request #146 from react-native-community/fix/ios-module-rn-62
Browse files Browse the repository at this point in the history
Update Example App to RN 0.62.2
  • Loading branch information
luancurti authored Apr 27, 2020
2 parents 3ef9515 + 3f374db commit c864ac4
Show file tree
Hide file tree
Showing 18 changed files with 1,049 additions and 775 deletions.
42 changes: 13 additions & 29 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js

Expand All @@ -29,10 +28,12 @@ node_modules/warning/.*
[include]

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

[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src
emoji=true

esproposal.optional_chaining=enable
Expand All @@ -42,27 +43,10 @@ module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

munge_underscores=true

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

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand Down Expand Up @@ -96,4 +80,4 @@ untyped-import
untyped-type-import

[version]
^0.98.0
^0.113.0
1 change: 1 addition & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const App = () => {

const showTimepicker = () => {
showMode('time');
setDisplay('default');
};

const showTimepickerSpinner = () => {
Expand Down
38 changes: 18 additions & 20 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ import com.android.build.OutputFile

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

Expand Down Expand Up @@ -159,34 +161,30 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}

packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
}
}

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

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:"com.facebook.fbjni"
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:"com.facebook.flipper"
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:"com.facebook.flipper"
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand All @@ -204,4 +202,4 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project, "../..")
applyNativeModulesAppBuildGradle(project);
Binary file added example/android/app/debug.keystore
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.util.Arrays;
import java.util.List;

import com.reactcommunity.rndatetimepicker.RNDateTimePickerPackage;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
Expand Down
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

android.useAndroidX=true
android.enableJetifier=true
FLIPPER_VERSION=0.33.1
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rootProject.name = 'example'

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesSettingsGradle(settings, "../..")
applyNativeModulesSettingsGradle(settings);

include ':app'
71 changes: 64 additions & 7 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,57 @@ $node_modules_path = "../../node_modules"

require_relative "#{$node_modules_path}/@react-native-community/cli-platform-ios/native_modules"

def add_flipper_pods!(versions = {})
versions["Flipper"] ||= "~> 0.33.1"
versions["DoubleConversion"] ||= "1.1.7"
versions["Flipper-Folly"] ||= "~> 2.1"
versions["Flipper-Glog"] ||= "0.3.6"
versions["Flipper-PeerTalk"] ||= "~> 0.0.4"
versions["Flipper-RSocket"] ||= "~> 1.0"
pod "FlipperKit", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitLayoutPlugin", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/SKIOSNetworkPlugin", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitUserDefaultsPlugin", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitReactPlugin", versions["Flipper"], :configuration => "Debug"
# List all transitive dependencies for FlipperKit pods
# to avoid them being linked in Release builds
pod "Flipper", versions["Flipper"], :configuration => "Debug"
pod "Flipper-DoubleConversion", versions["DoubleConversion"], :configuration => "Debug"
pod "Flipper-Folly", versions["Flipper-Folly"], :configuration => "Debug"
pod "Flipper-Glog", versions["Flipper-Glog"], :configuration => "Debug"
pod "Flipper-PeerTalk", versions["Flipper-PeerTalk"], :configuration => "Debug"
pod "Flipper-RSocket", versions["Flipper-RSocket"], :configuration => "Debug"
pod "FlipperKit/Core", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/CppBridge", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FBCxxFollyDynamicConvert", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FBDefines", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FKPortForwarding", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitHighlightOverlay", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitLayoutTextSearchable", versions["Flipper"], :configuration => "Debug"
pod "FlipperKit/FlipperKitNetworkPlugin", versions["Flipper"], :configuration => "Debug"
end

# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == "YogaKit"
target.build_configurations.each do |config|
config.build_settings["SWIFT_VERSION"] = "4.1"
end
end
end
end

target "example" do
# Pods for example
pod "FBLazyVector", :path => "#{$node_modules_path}/react-native/Libraries/FBLazyVector"
pod "FBReactNativeSpec", :path => "#{$node_modules_path}/react-native/Libraries/FBReactNativeSpec"
pod "RCTRequired", :path => "#{$node_modules_path}/react-native/Libraries/RCTRequired"
pod "RCTTypeSafety", :path => "#{$node_modules_path}/react-native/Libraries/TypeSafety"
pod "React", :path => "#{$node_modules_path}/react-native/"
pod "React-Core", :path => "#{$node_modules_path}/react-native/React"
pod "React-DevSupport", :path => "#{$node_modules_path}/react-native/React"
pod "React-Core", :path => "#{$node_modules_path}/react-native/"
pod "React-CoreModules", :path => "#{$node_modules_path}/react-native/React/CoreModules"
pod "React-Core/DevSupport", :path => "#{$node_modules_path}/react-native/"
pod "React-RCTActionSheet", :path => "#{$node_modules_path}/react-native/Libraries/ActionSheetIOS"
pod "React-RCTAnimation", :path => "#{$node_modules_path}/react-native/Libraries/NativeAnimation"
pod "React-RCTBlob", :path => "#{$node_modules_path}/react-native/Libraries/Blob"
Expand All @@ -17,17 +63,28 @@ target "example" do
pod "React-RCTSettings", :path => "#{$node_modules_path}/react-native/Libraries/Settings"
pod "React-RCTText", :path => "#{$node_modules_path}/react-native/Libraries/Text"
pod "React-RCTVibration", :path => "#{$node_modules_path}/react-native/Libraries/Vibration"
pod "React-RCTWebSocket", :path => "#{$node_modules_path}/react-native/Libraries/WebSocket"

pod "React-Core/RCTWebSocket", :path => "#{$node_modules_path}/react-native/"
pod "React-cxxreact", :path => "#{$node_modules_path}/react-native/ReactCommon/cxxreact"
pod "React-jsi", :path => "#{$node_modules_path}/react-native/ReactCommon/jsi"
pod "React-jsiexecutor", :path => "#{$node_modules_path}/react-native/ReactCommon/jsiexecutor"
pod "React-jsinspector", :path => "#{$node_modules_path}/react-native/ReactCommon/jsinspector"
pod "yoga", :path => "#{$node_modules_path}/react-native/ReactCommon/yoga"

pod "ReactCommon/callinvoker", :path => "#{$node_modules_path}/react-native/ReactCommon"
pod "ReactCommon/turbomodule/core", :path => "#{$node_modules_path}/react-native/ReactCommon"
pod "Yoga", :path => "#{$node_modules_path}/react-native/ReactCommon/yoga", :modular_headers => true
pod "DoubleConversion", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/DoubleConversion.podspec"
pod "glog", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/glog.podspec"
pod "Folly", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/Folly.podspec"

use_native_modules!("../..")
use_native_modules!
# pod 'RNDateTimePicker', :path => '../../RNDateTimePicker.podspec'

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
add_flipper_pods!
end

post_install do |installer|
flipper_post_install(installer)
end
Loading

0 comments on commit c864ac4

Please sign in to comment.