Skip to content

Commit

Permalink
Merge branch 'master' into remove-unused-code
Browse files Browse the repository at this point in the history
  • Loading branch information
shergin authored Jul 14, 2017
2 parents d30e1bf + 221286b commit 933b351
Show file tree
Hide file tree
Showing 35 changed files with 8,017 additions and 7,464 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@
**/main.js
Libraries/vendor/**/*
Libraries/Renderer/*
website/node_modules
pr-inactivity-bookmarklet.js
question-bookmarklet.js
flow/
website/core/metadata.js
website/core/metadata-blog.js
website/src/react-native/docs/
website/src/react-native/blog/
12 changes: 9 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,21 @@

Then, specify:

1. Target Platform (e.g. iOS, Android):
2. Development Operating System (e.g. macOS Sierra, Windows 10):
3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
<!-- (What platform are you building for? Choose any from iOS, Android, AppleTV.) -->
- Target Platform:

<!-- Which operating system are you using? Specify macOS, Windows, or Linux, along with specific release versions -->
- Development Operating System:

<!-- Include any additional relevant information. Are you using Xcode or Android Studio to build native code? Is the issue specific to a particular iOS or Android SDK? -->
- Build tools:

### Steps to Reproduce

<!--
How would you describe your issue to someone who doesn’t know you or your project?
Try to write a sequence of steps that anybody can repeat to see the issue.
Be specific! If the bug cannot be reproduced, your issue may be closed.
-->

(Write your steps here:)
Expand All @@ -79,6 +84,7 @@ Then, specify:
Did something go wrong?
Is something broken, or not behaving as you expected?
Describe this section in detail, and attach screenshots if possible.
Don't just say "it doesn't work"!
-->

(Write what happened. Add screenshots!)
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class VirtualizedList extends React.PureComponent<OptionalProps, Props, State> {
`scrollToIndex out of range: ${index} vs ${getItemCount(data) - 1}`,
);
invariant(
getItemLayout || index < this._highestMeasuredFrameIndex,
getItemLayout || index <= this._highestMeasuredFrameIndex,
'scrollToIndex should be used in conjunction with getItemLayout, ' +
'otherwise there is no way to know the location of an arbitrary index.',
);
Expand Down
1 change: 0 additions & 1 deletion Libraries/Network/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule fetch
* @nolint
*
*/

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Renderer/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cb32253d2f0376de899edb1bc6ebbd1602eec074
5495e495de0bd15cd96a76ee0d7ca823cc09cc71
8,679 changes: 4,455 additions & 4,224 deletions Libraries/Renderer/ReactNativeFiber-dev.js

Large diffs are not rendered by default.

396 changes: 175 additions & 221 deletions Libraries/Renderer/ReactNativeFiber-prod.js

Large diffs are not rendered by default.

6,070 changes: 3,165 additions & 2,905 deletions Libraries/Renderer/ReactNativeStack-dev.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions Libraries/Renderer/ReactNativeStack-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -1718,19 +1718,18 @@ function _classCallCheck(instance, Constructor) {
}

var CallbackQueue = function() {
function CallbackQueue(arg) {
_classCallCheck(this, CallbackQueue), this._callbacks = null, this._contexts = null,
this._arg = arg;
function CallbackQueue() {
_classCallCheck(this, CallbackQueue), this._callbacks = null, this._contexts = null;
}
return CallbackQueue.prototype.enqueue = function(callback, context) {
this._callbacks = this._callbacks || [], this._callbacks.push(callback), this._contexts = this._contexts || [],
this._contexts.push(context);
}, CallbackQueue.prototype.notifyAll = function() {
var callbacks = this._callbacks, contexts = this._contexts, arg = this._arg;
var callbacks = this._callbacks, contexts = this._contexts;
if (callbacks && contexts) {
invariant(callbacks.length === contexts.length, "Mismatched list of contexts in callback queue"),
this._callbacks = null, this._contexts = null;
for (var i = 0; i < callbacks.length; i++) validateCallback_1(callbacks[i]), callbacks[i].call(contexts[i], arg);
for (var i = 0; i < callbacks.length; i++) validateCallback_1(callbacks[i]), callbacks[i].call(contexts[i]);
callbacks.length = 0, contexts.length = 0;
}
}, CallbackQueue.prototype.checkpoint = function() {
Expand All @@ -1752,7 +1751,7 @@ var CallbackQueue = function() {
}, TRANSACTION_WRAPPERS$2 = [ ON_DOM_READY_QUEUEING ];

function ReactNativeReconcileTransaction() {
this.reinitializeTransaction(), this.reactMountReady = CallbackQueue_1.getPooled(null);
this.reinitializeTransaction(), this.reactMountReady = CallbackQueue_1.getPooled();
}

var Mixin = {
Expand Down
4 changes: 2 additions & 2 deletions React.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Pod::Spec.new do |s|
end

s.subspec "jschelpers_legacy" do |ss|
ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.{cpp,h}", "ReactCommon/jschelpers/systemJSCWrapper.cpp"
ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper}.h"
ss.source_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper,InspectorInterfaces}.{cpp,h}", "ReactCommon/jschelpers/systemJSCWrapper.cpp"
ss.private_header_files = "ReactCommon/jschelpers/{JavaScriptCore,JSCWrapper,InspectorInterfaces}.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
ss.framework = "JavaScriptCore"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ protected ARTSurfaceView createViewInstance(ThemedReactContext reactContext) {
public void updateExtraData(ARTSurfaceView root, Object extraData) {
root.setSurfaceTextureListener((ARTSurfaceViewShadowNode) extraData);
}

@Override
public void setBackgroundColor(ARTSurfaceView view, int backgroundColor) {
// As of Android N TextureView does not support calling setBackground on it.
// It will also throw an exception when target SDK is set to N or higher.

// Setting the background color for this view is handled in the shadow node.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.facebook.react.uimanager.LayoutShadowNode;
import com.facebook.react.uimanager.UIViewOperationQueue;
import com.facebook.react.uimanager.ReactShadowNode;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;

/**
* Shadow node for ART virtual tree root - ARTSurfaceView
Expand All @@ -33,6 +35,14 @@ public class ARTSurfaceViewShadowNode extends LayoutShadowNode

private @Nullable Surface mSurface;

private @Nullable Integer mBackgroundColor;

@ReactProp(name = ViewProps.BACKGROUND_COLOR, customType = "Color")
public void setBackgroundColor(Integer color) {
mBackgroundColor = color;
markUpdated();
}

@Override
public boolean isVirtual() {
return false;
Expand All @@ -59,6 +69,9 @@ private void drawOutput() {
try {
Canvas canvas = mSurface.lockCanvas(null);
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
if (mBackgroundColor != null) {
canvas.drawColor(mBackgroundColor);
}

Paint paint = new Paint();
for (int i = 0; i < getChildCount(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {

protected static final String REACT_CLASS = "RCTWebView";

private static final String HTML_ENCODING = "UTF-8";
private static final String HTML_MIME_TYPE = "text/html; charset=utf-8";
private static final String BRIDGE_NAME = "__REACT_WEB_VIEW_BRIDGE";
protected static final String HTML_ENCODING = "UTF-8";
protected static final String HTML_MIME_TYPE = "text/html; charset=utf-8";
protected static final String BRIDGE_NAME = "__REACT_WEB_VIEW_BRIDGE";

private static final String HTTP_METHOD_POST = "POST";
protected static final String HTTP_METHOD_POST = "POST";

public static final int COMMAND_GO_BACK = 1;
public static final int COMMAND_GO_FORWARD = 2;
Expand All @@ -102,14 +102,14 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {

// Use `webView.loadUrl("about:blank")` to reliably reset the view
// state and release page resources (including any running JavaScript).
private static final String BLANK_URL = "about:blank";
protected static final String BLANK_URL = "about:blank";

private WebViewConfig mWebViewConfig;
private @Nullable WebView.PictureListener mPictureListener;
protected WebViewConfig mWebViewConfig;
protected @Nullable WebView.PictureListener mPictureListener;

protected static class ReactWebViewClient extends WebViewClient {

private boolean mLastLoadFailed = false;
protected boolean mLastLoadFailed = false;

@Override
public void onPageFinished(WebView webView, String url) {
Expand Down Expand Up @@ -185,15 +185,15 @@ public void doUpdateVisitedHistory(WebView webView, String url, boolean isReload
createWebViewEvent(webView, url)));
}

private void emitFinishEvent(WebView webView, String url) {
protected void emitFinishEvent(WebView webView, String url) {
dispatchEvent(
webView,
new TopLoadingFinishEvent(
webView.getId(),
createWebViewEvent(webView, url)));
}

private WritableMap createWebViewEvent(WebView webView, String url) {
protected WritableMap createWebViewEvent(WebView webView, String url) {
WritableMap event = Arguments.createMap();
event.putDouble("target", webView.getId());
// Don't use webView.getUrl() here, the URL isn't updated to the new value yet in callbacks
Expand All @@ -212,10 +212,10 @@ private WritableMap createWebViewEvent(WebView webView, String url) {
* to call {@link WebView#destroy} on activty destroy event and also to clear the client
*/
protected static class ReactWebView extends WebView implements LifecycleEventListener {
private @Nullable String injectedJS;
private boolean messagingEnabled = false;
protected @Nullable String injectedJS;
protected boolean messagingEnabled = false;

private class ReactWebViewBridge {
protected class ReactWebViewBridge {
ReactWebView mContext;

ReactWebViewBridge(ReactWebView c) {
Expand Down Expand Up @@ -258,14 +258,18 @@ public void setInjectedJavaScript(@Nullable String js) {
injectedJS = js;
}

protected ReactWebViewBridge createReactWebViewBridge(ReactWebView webView) {
return new ReactWebViewBridge(webView);
}

public void setMessagingEnabled(boolean enabled) {
if (messagingEnabled == enabled) {
return;
}

messagingEnabled = enabled;
if (enabled) {
addJavascriptInterface(new ReactWebViewBridge(this), BRIDGE_NAME);
addJavascriptInterface(createReactWebViewBridge(this), BRIDGE_NAME);
linkBridge();
} else {
removeJavascriptInterface(BRIDGE_NAME);
Expand Down Expand Up @@ -308,7 +312,7 @@ public void onMessage(String message) {
dispatchEvent(this, new TopMessageEvent(this.getId(), message));
}

private void cleanupCallbacksAndDestroy() {
protected void cleanupCallbacksAndDestroy() {
setWebViewClient(null);
destroy();
}
Expand All @@ -330,9 +334,13 @@ public String getName() {
return REACT_CLASS;
}

protected ReactWebView createReactWebViewInstance(ThemedReactContext reactContext) {
return new ReactWebView(reactContext);
}

@Override
protected WebView createViewInstance(ThemedReactContext reactContext) {
ReactWebView webView = new ReactWebView(reactContext);
ReactWebView webView = createReactWebViewInstance(reactContext);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onConsoleMessage(ConsoleMessage message) {
Expand Down Expand Up @@ -568,7 +576,7 @@ public void onDropViewInstance(WebView webView) {
((ReactWebView) webView).cleanupCallbacksAndDestroy();
}

private WebView.PictureListener getPictureListener() {
protected WebView.PictureListener getPictureListener() {
if (mPictureListener == null) {
mPictureListener = new WebView.PictureListener() {
@Override
Expand All @@ -585,7 +593,7 @@ public void onNewPicture(WebView webView, Picture picture) {
return mPictureListener;
}

private static void dispatchEvent(WebView webView, Event event) {
protected static void dispatchEvent(WebView webView, Event event) {
ReactContext reactContext = (ReactContext) webView.getContext();
EventDispatcher eventDispatcher =
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
Expand Down
Loading

0 comments on commit 933b351

Please sign in to comment.