Skip to content

Commit aa3afa1

Browse files
committed
Rebase after facebook#9292
1 parent aa5a37f commit aa3afa1

File tree

228 files changed

+6991
-1656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+6991
-1656
lines changed

Examples/TicTacToe/android/app/BUCK

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
include_defs('//ReactAndroid/DEFS')
2+
3+
android_binary(
4+
name = 'app',
5+
manifest = 'src/main/AndroidManifest.xml',
6+
keystore = '//keystores:debug',
7+
deps = [
8+
':tictactoe-lib',
9+
],
10+
)
11+
12+
android_library(
13+
name = 'tictactoe-lib',
14+
srcs = glob(['src/main/java/**/*.java']),
15+
deps = [
16+
':res',
17+
react_native_dep('third-party/java/jsr-305:jsr-305'),
18+
react_native_target('java/com/facebook/react/modules/core:core'),
19+
react_native_target('java/com/facebook/react/shell:shell'),
20+
react_native_target('java/com/facebook/react:react'),
21+
react_native_target('jni/prebuilt:android-jsc'),
22+
# .so files are prebuilt by Gradle with `./gradlew :ReactAndroid:packageReactNdkLibsForBuck`
23+
react_native_target('jni/prebuilt:reactnative-libs'),
24+
],
25+
)
26+
27+
android_resource(
28+
name = 'res',
29+
res = 'src/main/res',
30+
package = 'com.facebook.react.tictactoe',
31+
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.facebook.react.tictactoe"
9+
minSdkVersion 16
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
ndk {
14+
abiFilters "armeabi-v7a", "x86"
15+
}
16+
}
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
}
24+
25+
dependencies {
26+
compile fileTree(dir: 'libs', include: ['*.jar'])
27+
compile 'com.android.support:appcompat-v7:23.0.1'
28+
29+
// Build React Native from source
30+
compile project(':ReactAndroid')
31+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
android.useDeprecatedNdk=true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
#}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.facebook.react.tictactoe"
3+
android:versionCode="1"
4+
android:versionName="1.0">
5+
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
8+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
9+
10+
<uses-sdk
11+
android:minSdkVersion="16"
12+
android:targetSdkVersion="22" />
13+
14+
<application
15+
android:name=".TicTacToeApplication"
16+
android:allowBackup="true"
17+
android:label="@string/app_name"
18+
android:icon="@drawable/launcher_icon"
19+
android:theme="@style/AppTheme">
20+
<activity
21+
android:name=".TicTacToeActivity">
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
</activity>
27+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
28+
</application>
29+
30+
</manifest>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* The examples provided by Facebook are for non-commercial testing and
3+
* evaluation purposes only.
4+
*
5+
* Facebook reserves all rights not expressly granted.
6+
*
7+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9+
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
10+
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
11+
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
12+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
*/
14+
package com.facebook.react.tictactoe;
15+
16+
import com.facebook.react.ReactActivity;
17+
18+
public class TicTacToeActivity extends ReactActivity {
19+
@Override
20+
protected String getMainComponentName() {
21+
return "TicTacToeApp";
22+
}
23+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* The examples provided by Facebook are for non-commercial testing and
3+
* evaluation purposes only.
4+
*
5+
* Facebook reserves all rights not expressly granted.
6+
*
7+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9+
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
10+
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
11+
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
12+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
*/
14+
15+
package com.facebook.react.tictactoe;
16+
17+
import android.app.Application;
18+
19+
import com.facebook.react.ReactApplication;
20+
import com.facebook.react.ReactNativeHost;
21+
import com.facebook.react.ReactPackage;
22+
import com.facebook.react.shell.MainReactPackage;
23+
24+
import java.util.Arrays;
25+
import java.util.List;
26+
27+
import javax.annotation.Nullable;
28+
29+
public class TicTacToeApplication extends Application implements ReactApplication {
30+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
31+
@Override
32+
public String getJSMainModuleName() {
33+
return "Examples/TicTacToe/TicTacToeApp";
34+
}
35+
36+
@Override
37+
public @Nullable String getBundleAssetName() {
38+
return "TicTacToeApp.bundle";
39+
}
40+
41+
@Override
42+
protected boolean getUseDeveloperSupport() {
43+
return true;
44+
}
45+
46+
@Override
47+
protected List<ReactPackage> getPackages() {
48+
return Arrays.<ReactPackage>asList(
49+
new MainReactPackage()
50+
);
51+
}
52+
};
53+
54+
@Override
55+
public ReactNativeHost getReactNativeHost() {
56+
return mReactNativeHost;
57+
}
58+
}
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context=".TicTacToeApp">
6+
7+
<com.facebook.react.ReactRootView
8+
android:layout_width="match_parent"
9+
android:layout_height="match_parent"
10+
android:id="@+id/react_root_view"/>
11+
12+
</RelativeLayout>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">TicTacToeApp</string>
3+
</resources>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
1497CFAD1B21F5E400C1F8F2 /* RCTBridgeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA51B21F5E400C1F8F2 /* RCTBridgeTests.m */; };
4040
1497CFAE1B21F5E400C1F8F2 /* RCTJSCExecutorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA61B21F5E400C1F8F2 /* RCTJSCExecutorTests.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
4141
1497CFAF1B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */; };
42-
1497CFB01B21F5E400C1F8F2 /* RCTConvert_UIFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA81B21F5E400C1F8F2 /* RCTConvert_UIFontTests.m */; };
42+
1497CFB01B21F5E400C1F8F2 /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */; };
4343
1497CFB11B21F5E400C1F8F2 /* RCTEventDispatcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */; };
4444
1497CFB31B21F5E400C1F8F2 /* RCTUIManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */; };
4545
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14AADF041AC3DB95002390C9 /* libReact.a */; };
@@ -228,7 +228,7 @@
228228
1497CFA51B21F5E400C1F8F2 /* RCTBridgeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBridgeTests.m; sourceTree = "<group>"; };
229229
1497CFA61B21F5E400C1F8F2 /* RCTJSCExecutorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSCExecutorTests.m; sourceTree = "<group>"; };
230230
1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSURLTests.m; sourceTree = "<group>"; };
231-
1497CFA81B21F5E400C1F8F2 /* RCTConvert_UIFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_UIFontTests.m; sourceTree = "<group>"; };
231+
1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = "<group>"; };
232232
1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventDispatcherTests.m; sourceTree = "<group>"; };
233233
1497CFAB1B21F5E400C1F8F2 /* RCTUIManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerTests.m; sourceTree = "<group>"; };
234234
14AADEFF1AC3DB95002390C9 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../../React/React.xcodeproj; sourceTree = "<group>"; };
@@ -436,7 +436,7 @@
436436
1497CFA51B21F5E400C1F8F2 /* RCTBridgeTests.m */,
437437
1497CFA61B21F5E400C1F8F2 /* RCTJSCExecutorTests.m */,
438438
1497CFA71B21F5E400C1F8F2 /* RCTConvert_NSURLTests.m */,
439-
1497CFA81B21F5E400C1F8F2 /* RCTConvert_UIFontTests.m */,
439+
1497CFA81B21F5E400C1F8F2 /* RCTFontTests.m */,
440440
1497CFA91B21F5E400C1F8F2 /* RCTEventDispatcherTests.m */,
441441
1300627E1B59179B0043FE5A /* RCTGzipTests.m */,
442442
8385CF051B8747A000C6273E /* RCTImageLoaderHelpers.h */,
@@ -911,7 +911,7 @@
911911
isa = PBXSourcesBuildPhase;
912912
buildActionMask = 2147483647;
913913
files = (
914-
1497CFB01B21F5E400C1F8F2 /* RCTConvert_UIFontTests.m in Sources */,
914+
1497CFB01B21F5E400C1F8F2 /* RCTFontTests.m in Sources */,
915915
13BCE84F1C9C209600DD7AAD /* RCTComponentPropsTests.m in Sources */,
916916
144D21241B2204C5006DB32B /* RCTImageUtilTests.m in Sources */,
917917
1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.m in Sources */,

Examples/UIExplorer/UIExplorerUnitTests/RCTConvert_UIFontTests.m renamed to Examples/UIExplorer/UIExplorerUnitTests/RCTFontTests.m

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414

1515
#import <XCTest/XCTest.h>
1616

17-
#import "RCTConvert.h"
17+
#import "RCTFont.h"
1818

19-
@interface RCTConvert_UIFontTests : XCTestCase
19+
#import <CoreText/CoreText.h>
20+
21+
@interface RCTFontTests : XCTestCase
2022

2123
@end
2224

23-
@implementation RCTConvert_UIFontTests
25+
@implementation RCTFontTests
2426

2527
#define RCTAssertEqualFonts(font1, font2) { \
2628
XCTAssertEqualObjects(font1, font2); \
@@ -178,6 +180,27 @@ - (void)testFamilyStyleAndWeight
178180
}
179181
}
180182

183+
- (void)testVariant
184+
{
185+
{
186+
UIFont *expected = [UIFont monospacedDigitSystemFontOfSize:14 weight:UIFontWeightRegular];
187+
UIFont *result = [RCTConvert UIFont:@{@"fontVariant": @[@"tabular-nums"]}];
188+
RCTAssertEqualFonts(expected, result);
189+
}
190+
{
191+
UIFont *monospaceFont = [UIFont monospacedDigitSystemFontOfSize:14 weight:UIFontWeightRegular];
192+
UIFontDescriptor *fontDescriptor = [monospaceFont.fontDescriptor fontDescriptorByAddingAttributes:@{
193+
UIFontDescriptorFeatureSettingsAttribute: @[@{
194+
UIFontFeatureTypeIdentifierKey: @(kLowerCaseType),
195+
UIFontFeatureSelectorIdentifierKey: @(kLowerCaseSmallCapsSelector),
196+
}]
197+
}];
198+
UIFont *expected = [UIFont fontWithDescriptor:fontDescriptor size:14];
199+
UIFont *result = [RCTConvert UIFont:@{@"fontVariant": @[@"tabular-nums", @"small-caps"]}];
200+
RCTAssertEqualFonts(expected, result);
201+
}
202+
}
203+
181204
- (void)testInvalidFont
182205
{
183206
{

Examples/UIExplorer/android/app/src/main/java/com/facebook/react/uiapp/UIExplorerActivity.java

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,49 @@
1414

1515
package com.facebook.react.uiapp;
1616

17+
import android.app.Activity;
1718
import android.os.Bundle;
1819

1920
import com.facebook.react.ReactActivity;
21+
import com.facebook.react.ReactActivityDelegate;
22+
23+
import javax.annotation.Nullable;
2024

2125
public class UIExplorerActivity extends ReactActivity {
22-
private final String PARAM_ROUTE = "route";
23-
private Bundle mInitialProps = null;
26+
public static class UIExplorerActivityDelegate extends ReactActivityDelegate {
27+
private static final String PARAM_ROUTE = "route";
28+
private Bundle mInitialProps = null;
29+
private final @Nullable Activity mActivity;
2430

25-
@Override
26-
protected void onCreate(Bundle savedInstanceState) {
27-
// Get remote param before calling super which uses it
28-
Bundle bundle = getIntent().getExtras();
29-
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
30-
String routeUri = new StringBuilder("rnuiexplorer://example/")
31-
.append(bundle.getString(PARAM_ROUTE))
32-
.append("Example")
33-
.toString();
34-
mInitialProps = new Bundle();
35-
mInitialProps.putString("exampleFromAppetizeParams", routeUri);
31+
public UIExplorerActivityDelegate(Activity activity, String mainComponentName) {
32+
super(activity, mainComponentName);
33+
this.mActivity = activity;
34+
}
35+
36+
@Override
37+
protected void onCreate(Bundle savedInstanceState) {
38+
// Get remote param before calling super which uses it
39+
Bundle bundle = mActivity.getIntent().getExtras();
40+
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
41+
String routeUri = new StringBuilder("rnuiexplorer://example/")
42+
.append(bundle.getString(PARAM_ROUTE))
43+
.append("Example")
44+
.toString();
45+
mInitialProps = new Bundle();
46+
mInitialProps.putString("exampleFromAppetizeParams", routeUri);
47+
}
48+
super.onCreate(savedInstanceState);
49+
}
50+
51+
@Override
52+
protected Bundle getLaunchOptions() {
53+
return mInitialProps;
3654
}
37-
super.onCreate(savedInstanceState);
3855
}
3956

4057
@Override
41-
protected Bundle getLaunchOptions() {
42-
return mInitialProps;
58+
protected ReactActivityDelegate createReactActivityDelegate() {
59+
return new UIExplorerActivityDelegate(this, getMainComponentName());
4360
}
4461

4562
@Override

Examples/UIExplorer/js/AlertExample.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ class SimpleAlertExampleBlock extends React.Component {
106106
<Text>Alert with too many buttons</Text>
107107
</View>
108108
</TouchableHighlight>
109+
<TouchableHighlight style={styles.wrapper}
110+
onPress={() => Alert.alert(
111+
'Alert Title',
112+
null,
113+
[
114+
{text: 'OK', onPress: () => console.log('OK Pressed!')},
115+
],
116+
{
117+
cancelable: false
118+
}
119+
)}>
120+
<View style={styles.button}>
121+
<Text>Alert that cannot be dismissed</Text>
122+
</View>
123+
</TouchableHighlight>
109124
</View>
110125
);
111126
}

0 commit comments

Comments
 (0)