Skip to content

Commit 0cad63c

Browse files
committed
test(upgrade react-native in example):
1 parent 4388d85 commit 0cad63c

File tree

9 files changed

+72
-122
lines changed

9 files changed

+72
-122
lines changed

example/.flowconfig

+20-61
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,28 @@
11
[ignore]
22

33
# We fork some components by platform.
4-
.*/*.web.js
54
.*/*.android.js
65

7-
# Some modules have their own node_modules with overlap
8-
.*/node_modules/node-haste/.*
9-
10-
# Ugh
11-
.*/node_modules/babel.*
12-
.*/node_modules/babylon.*
13-
.*/node_modules/invariant.*
14-
15-
# Ignore react and fbjs where there are overlaps, but don't ignore
16-
# anything that react-native relies on
17-
.*/node_modules/fbjs/lib/Map.js
18-
.*/node_modules/fbjs/lib/ErrorUtils.js
19-
20-
# Flow has a built-in definition for the 'react' module which we prefer to use
21-
# over the currently-untyped source
22-
.*/node_modules/react/react.js
23-
.*/node_modules/react/lib/React.js
24-
.*/node_modules/react/lib/ReactDOM.js
25-
26-
.*/__mocks__/.*
27-
.*/__tests__/.*
28-
29-
.*/commoner/test/source/widget/share.js
30-
31-
# Ignore commoner tests
32-
.*/node_modules/commoner/test/.*
33-
34-
# See https://github.com/facebook/flow/issues/442
35-
.*/react-tools/node_modules/commoner/lib/reader.js
36-
37-
# Ignore jest
38-
.*/node_modules/jest-cli/.*
39-
40-
# Ignore Website
41-
.*/website/.*
42-
43-
# Ignore generators
6+
# Ignore templates with `@flow` in header
447
.*/local-cli/generator.*
458

46-
# Ignore BUCK generated folders
47-
.*\.buckd/
9+
# Ignore malformed json
10+
.*/node_modules/y18n/test/.*\.json
4811

49-
# Ignore RNPM
50-
.*/local-cli/rnpm/.*
12+
# Ignore the website subdir
13+
<PROJECT_ROOT>/website/.*
5114

52-
.*/node_modules/is-my-json-valid/test/.*\.json
53-
.*/node_modules/iconv-lite/encodings/tables/.*\.json
54-
.*/node_modules/y18n/test/.*\.json
55-
.*/node_modules/spdx-license-ids/spdx-license-ids.json
56-
.*/node_modules/spdx-exceptions/index.json
57-
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
58-
.*/node_modules/resolve/lib/core.json
59-
.*/node_modules/jsonparse/samplejson/.*\.json
60-
.*/node_modules/json5/test/.*\.json
61-
.*/node_modules/ua-parser-js/test/.*\.json
62-
.*/node_modules/builtin-modules/builtin-modules.json
63-
.*/node_modules/binary-extensions/binary-extensions.json
64-
.*/node_modules/url-regex/tlds.json
65-
.*/node_modules/joi/.*\.json
66-
.*/node_modules/isemail/.*\.json
67-
.*/node_modules/tr46/.*\.json
15+
# Ignore BUCK generated dirs
16+
<PROJECT_ROOT>/\.buckd/
17+
18+
# Ignore unexpected extra @providesModule
19+
.*/node_modules/commoner/test/source/widget/share.js
6820

21+
# Ignore duplicate module providers
22+
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
23+
.*/Libraries/react-native/React.js
24+
.*/Libraries/react-native/ReactNative.js
25+
.*/node_modules/jest-runtime/build/__tests__/.*
6926

7027
[include]
7128

@@ -91,9 +48,11 @@ suppress_type=$FlowIssue
9148
suppress_type=$FlowFixMe
9249
suppress_type=$FixMe
9350

94-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
95-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
51+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
52+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
9653
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
9754

55+
unsafe.enable_getters_and_setters=true
56+
9857
[version]
99-
^0.26.0
58+
^0.30.0

example/android/app/BUCK

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import re
55
# - install Buck
66
# - `npm start` - to start the packager
77
# - `cd android`
8-
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
8+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
99
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
1010
# - `buck install -r android/app` - compile, install and run application
1111
#

example/android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
android:targetSdkVersion="22" />
1212

1313
<application
14+
android:name=".MainApplication"
1415
android:allowBackup="true"
1516
android:label="@string/app_name"
1617
android:icon="@mipmap/ic_launcher"
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package com.example;
22

33
import com.facebook.react.ReactActivity;
4-
import com.facebook.react.ReactPackage;
5-
import com.facebook.react.shell.MainReactPackage;
6-
7-
import java.util.Arrays;
8-
import java.util.List;
94

105
public class MainActivity extends ReactActivity {
116

@@ -17,24 +12,4 @@ public class MainActivity extends ReactActivity {
1712
protected String getMainComponentName() {
1813
return "example";
1914
}
20-
21-
/**
22-
* Returns whether dev mode should be enabled.
23-
* This enables e.g. the dev menu.
24-
*/
25-
@Override
26-
protected boolean getUseDeveloperSupport() {
27-
return BuildConfig.DEBUG;
28-
}
29-
30-
/**
31-
* A list of packages used by the app. If the app uses additional views
32-
* or modules besides the default ones, add more packages here.
33-
*/
34-
@Override
35-
protected List<ReactPackage> getPackages() {
36-
return Arrays.<ReactPackage>asList(
37-
new MainReactPackage()
38-
);
39-
}
4015
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.example;
2+
3+
import android.app.Application;
4+
import android.util.Log;
5+
6+
import com.facebook.react.ReactApplication;
7+
import com.facebook.react.ReactInstanceManager;
8+
import com.facebook.react.ReactNativeHost;
9+
import com.facebook.react.ReactPackage;
10+
import com.facebook.react.shell.MainReactPackage;
11+
12+
import java.util.Arrays;
13+
import java.util.List;
14+
15+
public class MainApplication extends Application implements ReactApplication {
16+
17+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18+
@Override
19+
protected boolean getUseDeveloperSupport() {
20+
return BuildConfig.DEBUG;
21+
}
22+
23+
@Override
24+
protected List<ReactPackage> getPackages() {
25+
return Arrays.<ReactPackage>asList(
26+
new MainReactPackage()
27+
);
28+
}
29+
};
30+
31+
@Override
32+
public ReactNativeHost getReactNativeHost() {
33+
return mReactNativeHost;
34+
}
35+
}

example/index.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class example extends Component {
3131
<Text style={styles.welcome}>
3232
Welcome to react-native-datepicker example!
3333
</Text>
34+
<DatePicker placeholder="Please insert a date" />
3435
<DatePicker
3536
style={{width: 200}}
3637
date={this.state.date}

example/ios/example.xcodeproj/project.pbxproj

+10-8
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,11 @@
614614
);
615615
INFOPLIST_FILE = "example/Info.plist";
616616
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
617-
OTHER_LDFLAGS = (
618-
"-ObjC",
619-
"-lc++",
620-
);
617+
OTHER_LDFLAGS = (
618+
"$(inherited)",
619+
"-ObjC",
620+
"-lc++",
621+
);
621622
PRODUCT_NAME = example;
622623
};
623624
name = Debug;
@@ -633,10 +634,11 @@
633634
);
634635
INFOPLIST_FILE = "example/Info.plist";
635636
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
636-
OTHER_LDFLAGS = (
637-
"-ObjC",
638-
"-lc++",
639-
);
637+
OTHER_LDFLAGS = (
638+
"$(inherited)",
639+
"-ObjC",
640+
"-lc++",
641+
);
640642
PRODUCT_NAME = example;
641643
};
642644
name = Release;

example/ios/example/AppDelegate.m

+2-25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#import "AppDelegate.h"
1111

12+
#import "RCTBundleURLProvider.h"
1213
#import "RCTRootView.h"
1314

1415
@implementation AppDelegate
@@ -17,31 +18,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1718
{
1819
NSURL *jsCodeLocation;
1920

20-
/**
21-
* Loading JavaScript code - uncomment the one you want.
22-
*
23-
* OPTION 1
24-
* Load from development server. Start the server from the repository root:
25-
*
26-
* $ npm start
27-
*
28-
* To run on device, change `localhost` to the IP address of your computer
29-
* (you can get this by typing `ifconfig` into the terminal and selecting the
30-
* `inet` value under `en0:`) and make sure your computer and iOS device are
31-
* on the same Wi-Fi network.
32-
*/
33-
34-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
35-
36-
/**
37-
* OPTION 2
38-
* Load from pre-bundled file on disk. The static bundle is automatically
39-
* generated by the "Bundle React Native code and images" build step when
40-
* running the project on an actual device or running the project on the
41-
* simulator in the "Release" build configuration.
42-
*/
43-
44-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
21+
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
4522

4623
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4724
moduleName:@"example"

example/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"start": "react-native start"
77
},
88
"dependencies": {
9-
"react": "15.2.1",
10-
"react-native": "^0.28.0",
9+
"react": "~15.3.1",
10+
"react-native": "^0.33.0",
1111
"react-native-datepicker": "latest"
1212
}
1313
}

0 commit comments

Comments
 (0)