mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
116
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc04bf3d96 | ||
|
|
8e34e7bd5f | ||
|
|
68f6799b7c | ||
|
|
2c130e6a9f | ||
|
|
21423bdf22 | ||
|
|
e5332504cc | ||
|
|
292f035ae8 | ||
|
|
a6c4ae0e75 | ||
|
|
e4b5e9ef85 | ||
|
|
732831dc27 | ||
|
|
b150fdfdce | ||
|
|
73f2007679 | ||
|
|
da2a8b365c | ||
|
|
143ecf4c62 | ||
|
|
c8d6cb9e49 | ||
|
|
0661c6f254 | ||
|
|
5f4a5388ac | ||
|
|
445dac2743 | ||
|
|
2d230bee78 | ||
|
|
382abb4b45 | ||
|
|
b0e4b89b58 | ||
|
|
0b8525847f | ||
|
|
09a923599e | ||
|
|
e7b7951c96 | ||
|
|
a91d0d8c35 | ||
|
|
47206fdd3c | ||
|
|
b02efd9e96 | ||
|
|
31894136f4 | ||
|
|
9b6639ad12 | ||
|
|
11f838f349 | ||
|
|
34787cc0eb | ||
|
|
d40bea925f | ||
|
|
692d3f72fb | ||
|
|
cb9b266b8e | ||
|
|
ccb4e67756 | ||
|
|
ad9b66fc6f | ||
|
|
1fe8f89bc8 | ||
|
|
a1e053cc50 | ||
|
|
221286be13 | ||
|
|
07972cf3bf | ||
|
|
09401ed56f | ||
|
|
c885357cc9 | ||
|
|
6dd9d16833 | ||
|
|
cad2d9b072 | ||
|
|
e3cfcdfb9c | ||
|
|
e2c87b59be | ||
|
|
aafccdf622 | ||
|
|
bfece1d800 | ||
|
|
e43c061e95 | ||
|
|
e02bafd9cf | ||
|
|
c198911561 | ||
|
|
320aea8bca | ||
|
|
e57655274d | ||
|
|
c41b5a02f2 | ||
|
|
d9f98191eb | ||
|
|
fc86f25f9a | ||
|
|
1d353b4ef7 | ||
|
|
98b925ceec | ||
|
|
820026f69b | ||
|
|
9f87728f5d | ||
|
|
999851a389 | ||
|
|
fc68dfbed6 | ||
|
|
ec8118b637 | ||
|
|
8ea6cea39a | ||
|
|
0c44b9e9b0 | ||
|
|
7cdd4d48c8 | ||
|
|
18c795bfcc | ||
|
|
3f16aa5559 | ||
|
|
a616a2d99d | ||
|
|
6b29fe78c4 | ||
|
|
5f1408858a | ||
|
|
51e258e6e7 | ||
|
|
78e2030e95 | ||
|
|
50f200ba90 | ||
|
|
ad0fe15e2e | ||
|
|
88fb45ddf9 | ||
|
|
8f363b2c49 | ||
|
|
684e03590b | ||
|
|
10230707cb | ||
|
|
d7f671135c | ||
|
|
dfd3b22275 | ||
|
|
40fdd6d91c | ||
|
|
5da0a9909e | ||
|
|
dec62ffc3e | ||
|
|
c00abe53c3 | ||
|
|
f1cbb11620 | ||
|
|
dc97e3fb4e | ||
|
|
e6941990ef | ||
|
|
1954fd4cef | ||
|
|
2781739fbe | ||
|
|
bf1b67ee5f | ||
|
|
dedffdc235 | ||
|
|
6db97d638d | ||
|
|
9afb71fde8 | ||
|
|
20224b74a4 | ||
|
|
8548ca09f1 | ||
|
|
e0eee0bb49 | ||
|
|
9b06a3193e | ||
|
|
361f03badb | ||
|
|
3e96fb1de3 | ||
|
|
6796abbe55 | ||
|
|
a8a29a92a0 | ||
|
|
9108f98ca7 | ||
|
|
6e13adbf56 | ||
|
|
6c2beaffdc | ||
|
|
79bf089bc5 | ||
|
|
26f01faf1b | ||
|
|
1ef21ece92 | ||
|
|
1054644631 | ||
|
|
352c3d97b3 | ||
|
|
f8ae461bc1 | ||
|
|
465a68db1f | ||
|
|
2be921c88a | ||
|
|
2c9e113f8e | ||
|
|
ed04d77c2c | ||
|
|
1ab96fd077 |
+9
-1
@@ -3,4 +3,12 @@
|
||||
**/staticBundle.js
|
||||
**/main.js
|
||||
Libraries/vendor/**/*
|
||||
packager/src/worker-farm/**/*
|
||||
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/
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"parser": "babel-eslint",
|
||||
|
||||
"ecmaFeatures": {
|
||||
@@ -11,6 +13,8 @@
|
||||
},
|
||||
|
||||
"plugins": [
|
||||
"flowtype",
|
||||
"prettier",
|
||||
"react"
|
||||
],
|
||||
|
||||
@@ -49,33 +53,17 @@
|
||||
"setTimeout": false,
|
||||
"window": false,
|
||||
"XMLHttpRequest": false,
|
||||
"pit": false,
|
||||
|
||||
// Flow global types.
|
||||
"ReactComponent": false,
|
||||
"ReactClass": false,
|
||||
"ReactElement": false,
|
||||
"ReactPropsCheckType": false,
|
||||
"ReactPropsChainableTypeChecker": false,
|
||||
"ReactPropTypes": false,
|
||||
"SyntheticEvent": false,
|
||||
"$Either": false,
|
||||
"$All": false,
|
||||
"$ArrayBufferView": false,
|
||||
"$Tuple": false,
|
||||
"$Supertype": false,
|
||||
"$Subtype": false,
|
||||
"$Shape": false,
|
||||
"$Diff": false,
|
||||
"$Keys": false,
|
||||
"$Enum": false,
|
||||
"$Exports": false,
|
||||
"$FlowIssue": false,
|
||||
"$FlowFixMe": false,
|
||||
"$FixMe": false
|
||||
"pit": false
|
||||
},
|
||||
|
||||
"rules": {
|
||||
// Flow Plugin
|
||||
// The following rules are made available via `eslint-plugin-flowtype`
|
||||
"flowtype/define-flow-type": 1,
|
||||
"flowtype/use-flow-type": 1,
|
||||
|
||||
// General
|
||||
|
||||
"comma-dangle": 0, // disallow trailing commas in object literals
|
||||
"no-cond-assign": 1, // disallow assignment in conditional expressions
|
||||
"no-console": 0, // disallow use of console (off by default in the node environment)
|
||||
@@ -176,6 +164,10 @@
|
||||
"no-restricted-modules": 1, // restrict usage of specified node modules (off by default)
|
||||
"no-sync": 0, // disallow use of synchronous methods (off by default)
|
||||
|
||||
// Prettier Plugin
|
||||
// https://github.com/prettier/eslint-plugin-prettier
|
||||
"prettier/prettier": [2, "fb", "@format"],
|
||||
|
||||
// Stylistic Issues
|
||||
// These rules are purely matters of style and are quite subjective.
|
||||
|
||||
@@ -241,6 +233,6 @@
|
||||
"react/prop-types": 0,
|
||||
"react/react-in-jsx-scope": 1,
|
||||
"react/self-closing-comp": 1,
|
||||
"react/wrap-multilines": 0,
|
||||
"react/wrap-multilines": 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
docs/* @hramos
|
||||
blog/* @hramos
|
||||
Libraries/Animated/* @janicduplessis
|
||||
Libraries/NativeAnimation/* @janicduplessis
|
||||
ReactAndroid/src/main/java/com/facebook/react/animated/* @janicduplessis
|
||||
website/* @hramos
|
||||
website/showcase.json @hramos
|
||||
package.json @hramos @ericnakagawa
|
||||
website/package.json @hramos @ericnakagawa
|
||||
@@ -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:)
|
||||
@@ -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!)
|
||||
|
||||
@@ -57,3 +57,6 @@ node_modules
|
||||
|
||||
/coverage
|
||||
/third-party
|
||||
|
||||
/website/src
|
||||
/website/build
|
||||
|
||||
+9
-15
@@ -3,25 +3,20 @@ language: objective-c
|
||||
osx_image: xcode8.3
|
||||
|
||||
install:
|
||||
- mkdir -p /Users/travis/build/facebook/.nvm
|
||||
- export NVM_DIR="/Users/travis/build/facebook/.nvm"
|
||||
- brew install nvm
|
||||
- source $(brew --prefix nvm)/nvm.sh
|
||||
# TODO npm 2 started stalling on Travis, t11852928
|
||||
|
||||
# Use node 6 because that is what runs on land-blocking tests
|
||||
- nvm install 6
|
||||
- nvm install 7
|
||||
- rm -Rf "${TMPDIR}/jest_preprocess_cache"
|
||||
- wget https://github.com/yarnpkg/yarn/releases/download/v0.16.0/yarn-0.16.0.js
|
||||
- export yarn="node $(pwd)/yarn-0.16.0.js"
|
||||
- $yarn install
|
||||
- brew install yarn --ignore-dependencies
|
||||
- yarn install
|
||||
|
||||
script:
|
||||
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh test; fi
|
||||
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait ./scripts/objc-test-tvos.sh; fi
|
||||
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait 30 ./scripts/objc-test-ios.sh test; fi
|
||||
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait 30 ./scripts/objc-test-tvos.sh; fi
|
||||
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
|
||||
- if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && ./scripts/process-podspecs.sh; fi
|
||||
- if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && travis_wait 30 ./scripts/process-podspecs.sh; fi
|
||||
|
||||
cache:
|
||||
- cocoapods
|
||||
- yarn
|
||||
|
||||
matrix:
|
||||
- fast_finish: true # Fail the whole build as soon as one test type fails. Should help with Travis capacity issues (very long queues).
|
||||
@@ -41,7 +36,6 @@ branches:
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- mkonicek@fb.com
|
||||
- douglowder@mac.com # Doug Lowder built and maintains Apple TV specific code and wants to be notified about tvOS failures.
|
||||
- eloy@artsy.net # Eloy Durán maintains the podspecs test and wants to be notified about failures.
|
||||
on_failure: change
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible Node.js debug attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceRoot}/Libraries/react-native/react-native-implementation.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
FROM library/node:6.9.2
|
||||
|
||||
ENV YARN_VERSION=0.19.1
|
||||
ENV YARN_VERSION=0.27.5
|
||||
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get install ocaml libelf-dev -y
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
Image,
|
||||
@@ -58,7 +59,8 @@ type State = {
|
||||
containerStyle?: Style,
|
||||
};
|
||||
|
||||
var LayoutEventsTest = React.createClass({
|
||||
var LayoutEventsTest = createReactClass({
|
||||
displayName: 'LayoutEventsTest',
|
||||
getInitialState(): State {
|
||||
return {
|
||||
didAnimation: false,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
|
||||
var Subscribable = require('Subscribable');
|
||||
@@ -24,7 +25,8 @@ var reactViewHeight = 102;
|
||||
var newReactViewWidth = 201;
|
||||
var newReactViewHeight = 202;
|
||||
|
||||
var ReactContentSizeUpdateTest = React.createClass({
|
||||
var ReactContentSizeUpdateTest = createReactClass({
|
||||
displayName: 'ReactContentSizeUpdateTest',
|
||||
mixins: [Subscribable.Mixin,
|
||||
TimerMixin],
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
|
||||
var Subscribable = require('Subscribable');
|
||||
@@ -22,7 +23,8 @@ var reactViewHeight = 222;
|
||||
|
||||
var finalState = false;
|
||||
|
||||
var SizeFlexibilityUpdateTest = React.createClass({
|
||||
var SizeFlexibilityUpdateTest = createReactClass({
|
||||
displayName: 'SizeFlexibilityUpdateTest',
|
||||
mixins: [Subscribable.Mixin],
|
||||
|
||||
componentWillMount: function() {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
|
||||
@@ -22,7 +23,8 @@ var {
|
||||
} = ReactNative;
|
||||
var { TestModule } = ReactNative.NativeModules;
|
||||
|
||||
var TimersTest = React.createClass({
|
||||
var TimersTest = createReactClass({
|
||||
displayName: 'TimersTest',
|
||||
mixins: [TimerMixin],
|
||||
|
||||
_nextTest: () => {},
|
||||
|
||||
@@ -392,7 +392,7 @@ class Shape extends React.Component {
|
||||
render() {
|
||||
var props = this.props;
|
||||
var path = props.d || childrenAsString(props.children);
|
||||
var d = new Path(path).toJSON();
|
||||
var d = (path instanceof Path ? path : new Path(path)).toJSON();
|
||||
return (
|
||||
<NativeShape
|
||||
fill={extractBrush(props.fill, props)}
|
||||
@@ -486,7 +486,8 @@ function extractAlignment(alignment) {
|
||||
class Text extends React.Component {
|
||||
render() {
|
||||
var props = this.props;
|
||||
var textPath = props.path ? new Path(props.path).toJSON() : null;
|
||||
var path = props.path;
|
||||
var textPath = path ? (path instanceof Path ? path : new Path(path)).toJSON() : null;
|
||||
var textFrame = extractFontAndLines(
|
||||
props.font,
|
||||
childrenAsString(props.children)
|
||||
|
||||
@@ -2825,9 +2825,9 @@ module.exports = {
|
||||
*
|
||||
*```javascript
|
||||
* onScroll={Animated.event(
|
||||
* [{nativeEvent: {contentOffset: {x: this._scrollX}}}]
|
||||
* [{nativeEvent: {contentOffset: {x: this._scrollX}}}],
|
||||
* {listener}, // Optional async listener
|
||||
* )
|
||||
* )}
|
||||
* ...
|
||||
* onPanResponderMove: Animated.event([
|
||||
* null, // raw event arg ignored
|
||||
|
||||
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
|
||||
const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
const GRAY = '#999999';
|
||||
@@ -36,7 +37,8 @@ type DefaultProps = {
|
||||
/**
|
||||
* Displays a circular loading indicator.
|
||||
*/
|
||||
const ActivityIndicator = React.createClass({
|
||||
const ActivityIndicator = createReactClass({
|
||||
displayName: 'ActivityIndicator',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
|
||||
const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type DefaultProps = {
|
||||
@@ -36,7 +37,8 @@ type Event = Object;
|
||||
* source of truth.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const DatePickerIOS = React.createClass({
|
||||
const DatePickerIOS = createReactClass({
|
||||
displayName: 'DatePickerIOS',
|
||||
// TOOD: Put a better type for _picker
|
||||
_picker: (undefined: ?$FlowFixMe),
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ var ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var DrawerConsts = UIManager.AndroidDrawerLayout.Constants;
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var dismissKeyboard = require('dismissKeyboard');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
@@ -67,7 +68,8 @@ var DRAWER_STATES = [
|
||||
* },
|
||||
* ```
|
||||
*/
|
||||
var DrawerLayoutAndroid = React.createClass({
|
||||
var DrawerLayoutAndroid = createReactClass({
|
||||
displayName: 'DrawerLayoutAndroid',
|
||||
statics: {
|
||||
positions: DrawerConsts.DrawerPosition,
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const Keyboard = require('Keyboard');
|
||||
const LayoutAnimation = require('LayoutAnimation');
|
||||
const Platform = require('Platform');
|
||||
@@ -21,13 +22,8 @@ const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
import type EmitterSubscription from 'EmitterSubscription';
|
||||
import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes';
|
||||
|
||||
type Rect = {
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
};
|
||||
type ScreenRect = {
|
||||
screenX: number,
|
||||
screenY: number,
|
||||
@@ -40,11 +36,6 @@ type KeyboardChangeEvent = {
|
||||
duration?: number,
|
||||
easing?: string,
|
||||
};
|
||||
type LayoutEvent = {
|
||||
nativeEvent: {
|
||||
layout: Rect,
|
||||
}
|
||||
};
|
||||
|
||||
const viewRef = 'VIEW';
|
||||
|
||||
@@ -53,7 +44,8 @@ const viewRef = 'VIEW';
|
||||
* It can automatically adjust either its position or bottom padding based on the position of the keyboard.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const KeyboardAvoidingView = React.createClass({
|
||||
const KeyboardAvoidingView = createReactClass({
|
||||
displayName: 'KeyboardAvoidingView',
|
||||
mixins: [TimerMixin],
|
||||
|
||||
propTypes: {
|
||||
@@ -85,7 +77,7 @@ const KeyboardAvoidingView = React.createClass({
|
||||
},
|
||||
|
||||
subscriptions: ([]: Array<EmitterSubscription>),
|
||||
frame: (null: ?Rect),
|
||||
frame: (null: ?ViewLayout),
|
||||
|
||||
relativeKeyboardHeight(keyboardFrame: ScreenRect): number {
|
||||
const frame = this.frame;
|
||||
@@ -121,7 +113,7 @@ const KeyboardAvoidingView = React.createClass({
|
||||
this.setState({bottom: height});
|
||||
},
|
||||
|
||||
onLayout(event: LayoutEvent) {
|
||||
onLayout(event: ViewLayoutEvent) {
|
||||
this.frame = event.nativeEvent.layout;
|
||||
},
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('React');
|
||||
var createReactClass = require('create-react-class');
|
||||
var PropTypes = require('prop-types');
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
|
||||
var LazyRenderer = React.createClass({
|
||||
var LazyRenderer = createReactClass({
|
||||
displayName: 'LazyRenderer',
|
||||
mixin: [TimerMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
Executable → Regular
+4
-16
@@ -5,22 +5,10 @@
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule MaskedViewIOS
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var React = require('React');
|
||||
|
||||
var fourOhFour = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<html>
|
||||
<head>
|
||||
<meta httpEquiv="refresh" content="0; /react-native/docs/getting-started.html" />
|
||||
</head>
|
||||
<body />
|
||||
</html>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = fourOhFour;
|
||||
module.exports = require('UnimplementedView');
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule MaskedViewIOS
|
||||
* @flow
|
||||
*/
|
||||
|
||||
const React = require('React');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const ReactPropTypes = React.PropTypes;
|
||||
|
||||
import type { ViewProps } from 'ViewPropTypes';
|
||||
|
||||
type Props = ViewProps & {
|
||||
children: any,
|
||||
/**
|
||||
* Should be a React element to be rendered and applied as the
|
||||
* mask for the child element.
|
||||
*/
|
||||
maskElement: React.Element<*>,
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders the child view with a mask specified in the `maskElement` prop.
|
||||
*
|
||||
* ```
|
||||
* import React from 'react';
|
||||
* import { MaskedView, Text, View } from 'react-native';
|
||||
*
|
||||
* class MyMaskedView extends React.Component {
|
||||
* render() {
|
||||
* return (
|
||||
* <MaskedView
|
||||
* style={{ flex: 1 }}
|
||||
* maskElement={
|
||||
* <View style={styles.maskContainerStyle}>
|
||||
* <Text style={styles.maskTextStyle}>
|
||||
* Basic Mask
|
||||
* </Text>
|
||||
* </View>
|
||||
* }
|
||||
* >
|
||||
* <View style={{ flex: 1, backgroundColor: 'blue' }} />
|
||||
* </MaskedView>
|
||||
* );
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* The above example will render a view with a blue background that fills its
|
||||
* parent, and then mask that view with text that says "Basic Mask".
|
||||
*
|
||||
* The alpha channel of the view rendered by the `maskElement` prop determines how
|
||||
* much of the view's content and background shows through. Fully or partially
|
||||
* opaque pixels allow the underlying content to show through but fully
|
||||
* transparent pixels block that content.
|
||||
*
|
||||
*/
|
||||
class MaskedViewIOS extends React.Component {
|
||||
props: Props;
|
||||
|
||||
static propTypes = {
|
||||
...ViewPropTypes,
|
||||
maskElement: ReactPropTypes.element.isRequired,
|
||||
};
|
||||
|
||||
_hasWarnedInvalidRenderMask = false;
|
||||
|
||||
render() {
|
||||
const { maskElement, children, ...otherViewProps } = this.props;
|
||||
|
||||
if (!React.isValidElement(maskElement)) {
|
||||
if (!this._hasWarnedInvalidRenderMask) {
|
||||
console.warn(
|
||||
'MaskedView: Invalid `maskElement` prop was passed to MaskedView. ' +
|
||||
'Expected a React Element. No mask will render.'
|
||||
);
|
||||
this._hasWarnedInvalidRenderMask = true;
|
||||
}
|
||||
return <View {...otherViewProps}>{children}</View>;
|
||||
}
|
||||
|
||||
return (
|
||||
<RCTMaskedView {...otherViewProps}>
|
||||
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
|
||||
{maskElement}
|
||||
</View>
|
||||
{children}
|
||||
</RCTMaskedView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const RCTMaskedView = requireNativeComponent('RCTMaskedView', {
|
||||
name: 'RCTMaskedView',
|
||||
displayName: 'RCTMaskedView',
|
||||
propTypes: {
|
||||
...ViewPropTypes,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = MaskedViewIOS;
|
||||
@@ -23,6 +23,7 @@ var TVEventHandler = require('TVEventHandler');
|
||||
var View = require('View');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
var logError = require('logError');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
@@ -304,7 +305,8 @@ type Event = Object;
|
||||
* is pushed.
|
||||
*
|
||||
*/
|
||||
var NavigatorIOS = React.createClass({
|
||||
var NavigatorIOS = createReactClass({
|
||||
displayName: 'NavigatorIOS',
|
||||
|
||||
propTypes: {
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@ var View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
var processColor = require('processColor');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var itemStylePropType = StyleSheetPropType(TextStylePropTypes);
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
var PickerIOS = React.createClass({
|
||||
var PickerIOS = createReactClass({
|
||||
displayName: 'PickerIOS',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -16,6 +16,7 @@ var PropTypes = require('prop-types');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
var ColorPropType = require('ColorPropType');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
var STYLE_ATTRIBUTES = [
|
||||
@@ -63,7 +64,8 @@ var indeterminateType = function(props, propName, componentName, ...rest) {
|
||||
* },
|
||||
* ```
|
||||
*/
|
||||
var ProgressBarAndroid = React.createClass({
|
||||
var ProgressBarAndroid = createReactClass({
|
||||
displayName: 'ProgressBarAndroid',
|
||||
propTypes: {
|
||||
...ViewPropTypes,
|
||||
/**
|
||||
|
||||
@@ -18,13 +18,15 @@ var PropTypes = require('prop-types');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
/**
|
||||
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
var ProgressViewIOS = React.createClass({
|
||||
var ProgressViewIOS = createReactClass({
|
||||
displayName: 'ProgressViewIOS',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -18,6 +18,7 @@ const React = require('React');
|
||||
const PropTypes = require('prop-types');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
@@ -72,7 +73,8 @@ if (Platform.OS === 'android') {
|
||||
* in the `onRefresh` function otherwise the refresh indicator will stop immediately.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const RefreshControl = React.createClass({
|
||||
const RefreshControl = createReactClass({
|
||||
displayName: 'RefreshControl',
|
||||
statics: {
|
||||
SIZE: RefreshLayoutConsts.SIZE,
|
||||
},
|
||||
|
||||
@@ -27,6 +27,7 @@ const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
const ViewStylePropTypes = require('ViewStylePropTypes');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const dismissKeyboard = require('dismissKeyboard');
|
||||
const flattenStyle = require('flattenStyle');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
@@ -72,7 +73,8 @@ import type {NativeMethodsMixinType} from 'ReactNativeTypes';
|
||||
* supports out of the box.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const ScrollView = React.createClass({
|
||||
const ScrollView = createReactClass({
|
||||
displayName: 'ScrollView',
|
||||
propTypes: {
|
||||
...ViewPropTypes,
|
||||
/**
|
||||
@@ -257,6 +259,8 @@ const ScrollView = React.createClass({
|
||||
* When true, the scroll view stops on multiples of the scroll view's size
|
||||
* when scrolling. This can be used for horizontal pagination. The default
|
||||
* value is false.
|
||||
*
|
||||
* Note: Vertical pagination is not supported on Android.
|
||||
*/
|
||||
pagingEnabled: PropTypes.bool,
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ var PropTypes = require('prop-types');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type DefaultProps = {
|
||||
@@ -49,7 +50,8 @@ type Event = Object;
|
||||
* ````
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
var SegmentedControlIOS = React.createClass({
|
||||
var SegmentedControlIOS = createReactClass({
|
||||
displayName: 'SegmentedControlIOS',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -21,6 +21,7 @@ var PropTypes = require('prop-types');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type Event = Object;
|
||||
@@ -29,7 +30,8 @@ type Event = Object;
|
||||
* A component used to select a single value from a range of values.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
var Slider = React.createClass({
|
||||
var Slider = createReactClass({
|
||||
displayName: 'Slider',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -63,7 +63,10 @@ type DefaultProps = {
|
||||
/**
|
||||
* Merges the prop stack with the default values.
|
||||
*/
|
||||
function mergePropsStack(propsStack: Array<Object>, defaultValues: Object): Object {
|
||||
function mergePropsStack(
|
||||
propsStack: Array<Object>,
|
||||
defaultValues: Object
|
||||
): Object {
|
||||
return propsStack.reduce((prev, cur) => {
|
||||
for (const prop in cur) {
|
||||
if (cur[prop] != null) {
|
||||
@@ -80,20 +83,29 @@ function mergePropsStack(propsStack: Array<Object>, defaultValues: Object): Obje
|
||||
*/
|
||||
function createStackEntry(props: any): any {
|
||||
return {
|
||||
backgroundColor: props.backgroundColor != null ? {
|
||||
value: props.backgroundColor,
|
||||
animated: props.animated,
|
||||
} : null,
|
||||
barStyle: props.barStyle != null ? {
|
||||
value: props.barStyle,
|
||||
animated: props.animated,
|
||||
} : null,
|
||||
backgroundColor:
|
||||
props.backgroundColor != null
|
||||
? {
|
||||
value: props.backgroundColor,
|
||||
animated: props.animated,
|
||||
}
|
||||
: null,
|
||||
barStyle:
|
||||
props.barStyle != null
|
||||
? {
|
||||
value: props.barStyle,
|
||||
animated: props.animated,
|
||||
}
|
||||
: null,
|
||||
translucent: props.translucent,
|
||||
hidden: props.hidden != null ? {
|
||||
value: props.hidden,
|
||||
animated: props.animated,
|
||||
transition: props.showHideTransition,
|
||||
} : null,
|
||||
hidden:
|
||||
props.hidden != null
|
||||
? {
|
||||
value: props.hidden,
|
||||
animated: props.animated,
|
||||
transition: props.showHideTransition,
|
||||
}
|
||||
: null,
|
||||
networkActivityIndicatorVisible: props.networkActivityIndicatorVisible,
|
||||
};
|
||||
}
|
||||
@@ -141,7 +153,7 @@ class StatusBar extends React.Component {
|
||||
props: {
|
||||
hidden?: boolean,
|
||||
animated?: boolean,
|
||||
backgroundColor?: $FlowFixMe,
|
||||
backgroundColor?: string,
|
||||
translucent?: boolean,
|
||||
barStyle?: 'default' | 'light-content' | 'dark-content',
|
||||
networkActivityIndicatorVisible?: boolean,
|
||||
@@ -215,7 +227,9 @@ class StatusBar extends React.Component {
|
||||
*/
|
||||
static setNetworkActivityIndicatorVisible(visible: boolean) {
|
||||
if (Platform.OS !== 'ios') {
|
||||
console.warn('`setNetworkActivityIndicatorVisible` is only available on iOS');
|
||||
console.warn(
|
||||
'`setNetworkActivityIndicatorVisible` is only available on iOS'
|
||||
);
|
||||
return;
|
||||
}
|
||||
StatusBar._defaultProps.networkActivityIndicatorVisible = visible;
|
||||
@@ -276,11 +290,7 @@ class StatusBar extends React.Component {
|
||||
/**
|
||||
* Sets the color of the status bar text.
|
||||
*/
|
||||
barStyle: PropTypes.oneOf([
|
||||
'default',
|
||||
'light-content',
|
||||
'dark-content',
|
||||
]),
|
||||
barStyle: PropTypes.oneOf(['default', 'light-content', 'dark-content']),
|
||||
/**
|
||||
* If the network activity indicator should be visible.
|
||||
*
|
||||
@@ -293,10 +303,7 @@ class StatusBar extends React.Component {
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
showHideTransition: PropTypes.oneOf([
|
||||
'fade',
|
||||
'slide',
|
||||
]),
|
||||
showHideTransition: PropTypes.oneOf(['fade', 'slide']),
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -343,38 +350,52 @@ class StatusBar extends React.Component {
|
||||
clearImmediate(StatusBar._updateImmediate);
|
||||
StatusBar._updateImmediate = setImmediate(() => {
|
||||
const oldProps = StatusBar._currentValues;
|
||||
const mergedProps = mergePropsStack(StatusBar._propsStack, StatusBar._defaultProps);
|
||||
const mergedProps = mergePropsStack(
|
||||
StatusBar._propsStack,
|
||||
StatusBar._defaultProps
|
||||
);
|
||||
|
||||
// Update the props that have changed using the merged values from the props stack.
|
||||
if (Platform.OS === 'ios') {
|
||||
if (!oldProps || oldProps.barStyle.value !== mergedProps.barStyle.value) {
|
||||
if (
|
||||
!oldProps ||
|
||||
oldProps.barStyle.value !== mergedProps.barStyle.value
|
||||
) {
|
||||
StatusBarManager.setStyle(
|
||||
mergedProps.barStyle.value,
|
||||
mergedProps.barStyle.animated,
|
||||
mergedProps.barStyle.animated
|
||||
);
|
||||
}
|
||||
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
|
||||
StatusBarManager.setHidden(
|
||||
mergedProps.hidden.value,
|
||||
mergedProps.hidden.animated ?
|
||||
mergedProps.hidden.transition :
|
||||
'none',
|
||||
mergedProps.hidden.animated ? mergedProps.hidden.transition : 'none'
|
||||
);
|
||||
}
|
||||
|
||||
if (!oldProps || oldProps.networkActivityIndicatorVisible !== mergedProps.networkActivityIndicatorVisible) {
|
||||
if (
|
||||
!oldProps ||
|
||||
oldProps.networkActivityIndicatorVisible !==
|
||||
mergedProps.networkActivityIndicatorVisible
|
||||
) {
|
||||
StatusBarManager.setNetworkActivityIndicatorVisible(
|
||||
mergedProps.networkActivityIndicatorVisible
|
||||
);
|
||||
}
|
||||
} else if (Platform.OS === 'android') {
|
||||
if (!oldProps || oldProps.barStyle.value !== mergedProps.barStyle.value) {
|
||||
if (
|
||||
!oldProps ||
|
||||
oldProps.barStyle.value !== mergedProps.barStyle.value
|
||||
) {
|
||||
StatusBarManager.setStyle(mergedProps.barStyle.value);
|
||||
}
|
||||
if (!oldProps || oldProps.backgroundColor.value !== mergedProps.backgroundColor.value) {
|
||||
if (
|
||||
!oldProps ||
|
||||
oldProps.backgroundColor.value !== mergedProps.backgroundColor.value
|
||||
) {
|
||||
StatusBarManager.setColor(
|
||||
processColor(mergedProps.backgroundColor.value),
|
||||
mergedProps.backgroundColor.animated,
|
||||
mergedProps.backgroundColor.animated
|
||||
);
|
||||
}
|
||||
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
|
||||
|
||||
@@ -19,6 +19,7 @@ const PropTypes = require('prop-types');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type DefaultProps = {
|
||||
@@ -38,7 +39,8 @@ type DefaultProps = {
|
||||
* @keyword toggle
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
var Switch = React.createClass({
|
||||
var Switch = createReactClass({
|
||||
displayName: 'Switch',
|
||||
propTypes: {
|
||||
...ViewPropTypes,
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ const EventEmitter = require('EventEmitter');
|
||||
const NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
const Platform = require('Platform');
|
||||
const React = require('React');
|
||||
const createReactClass = require('create-react-class');
|
||||
const PropTypes = require('prop-types');
|
||||
const ReactNative = require('ReactNative');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
@@ -168,7 +169,8 @@ const DataDetectorTypes = [
|
||||
*
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const TextInput = React.createClass({
|
||||
const TextInput = createReactClass({
|
||||
displayName: 'TextInput',
|
||||
statics: {
|
||||
/* TODO(brentvatne) docs are needed for this */
|
||||
State: TextInputState,
|
||||
|
||||
@@ -20,6 +20,7 @@ var UIManager = require('UIManager');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
var ColorPropType = require('ColorPropType');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
var resolveAssetSource = require('resolveAssetSource');
|
||||
|
||||
@@ -65,7 +66,8 @@ var optionalImageSource = PropTypes.oneOfType([
|
||||
*
|
||||
* [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html
|
||||
*/
|
||||
var ToolbarAndroid = React.createClass({
|
||||
var ToolbarAndroid = createReactClass({
|
||||
displayName: 'ToolbarAndroid',
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -15,6 +15,7 @@ var Animated = require('Animated');
|
||||
var EdgeInsetsPropType = require('EdgeInsetsPropType');
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var React = require('React');
|
||||
var createReactClass = require('create-react-class');
|
||||
var PropTypes = require('prop-types');
|
||||
var Touchable = require('Touchable');
|
||||
|
||||
@@ -35,7 +36,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
* interesting interactions such as `handleTouchablePress`.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
var TouchableBounce = React.createClass({
|
||||
var TouchableBounce = createReactClass({
|
||||
displayName: 'TouchableBounce',
|
||||
mixins: [Touchable.Mixin, NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -7,37 +7,36 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule TouchableHighlight
|
||||
* @noflow
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
// Note (avik): add @flow when Flow supports spread properties in propTypes
|
||||
|
||||
var ColorPropType = require('ColorPropType');
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
const ColorPropType = require('ColorPropType');
|
||||
const NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
const PropTypes = require('prop-types');
|
||||
var React = require('React');
|
||||
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
var Touchable = require('Touchable');
|
||||
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
var View = require('View');
|
||||
const React = require('React');
|
||||
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const TimerMixin = require('react-timer-mixin');
|
||||
const Touchable = require('Touchable');
|
||||
const TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
var ensureComponentIsNative = require('ensureComponentIsNative');
|
||||
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
|
||||
var keyOf = require('fbjs/lib/keyOf');
|
||||
var merge = require('merge');
|
||||
const createReactClass = require('create-react-class');
|
||||
const ensureComponentIsNative = require('ensureComponentIsNative');
|
||||
const ensurePositiveDelayProps = require('ensurePositiveDelayProps');
|
||||
const keyOf = require('fbjs/lib/keyOf');
|
||||
const merge = require('merge');
|
||||
|
||||
type Event = Object;
|
||||
import type {Event} from 'TouchableWithoutFeedback';
|
||||
|
||||
var DEFAULT_PROPS = {
|
||||
const DEFAULT_PROPS = {
|
||||
activeOpacity: 0.85,
|
||||
underlayColor: 'black',
|
||||
};
|
||||
|
||||
var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
/**
|
||||
* A wrapper for making views respond properly to touches.
|
||||
@@ -68,7 +67,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
* ```
|
||||
*/
|
||||
|
||||
var TouchableHighlight = React.createClass({
|
||||
var TouchableHighlight = createReactClass({
|
||||
displayName: 'TouchableHighlight',
|
||||
propTypes: {
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
/**
|
||||
@@ -108,7 +108,6 @@ var TouchableHighlight = React.createClass({
|
||||
* @platform ios
|
||||
*/
|
||||
tvParallaxProperties: PropTypes.object,
|
||||
|
||||
},
|
||||
|
||||
mixins: [NativeMethodsMixin, TimerMixin, Touchable.Mixin],
|
||||
|
||||
@@ -18,6 +18,7 @@ var Touchable = require('Touchable');
|
||||
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
var UIManager = require('UIManager');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
|
||||
var processColor = require('processColor');
|
||||
|
||||
@@ -70,7 +71,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
* ```
|
||||
*/
|
||||
|
||||
var TouchableNativeFeedback = React.createClass({
|
||||
var TouchableNativeFeedback = createReactClass({
|
||||
displayName: 'TouchableNativeFeedback',
|
||||
propTypes: {
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ var TimerMixin = require('react-timer-mixin');
|
||||
var Touchable = require('Touchable');
|
||||
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
|
||||
var flattenStyle = require('flattenStyle');
|
||||
|
||||
@@ -51,7 +52,8 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
* },
|
||||
* ```
|
||||
*/
|
||||
var TouchableOpacity = React.createClass({
|
||||
var TouchableOpacity = createReactClass({
|
||||
displayName: 'TouchableOpacity',
|
||||
mixins: [TimerMixin, Touchable.Mixin, NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -17,6 +17,7 @@ const PropTypes = require('prop-types');
|
||||
const TimerMixin = require('react-timer-mixin');
|
||||
const Touchable = require('Touchable');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const ensurePositiveDelayProps = require('ensurePositiveDelayProps');
|
||||
const warning = require('fbjs/lib/warning');
|
||||
|
||||
@@ -25,7 +26,7 @@ const {
|
||||
AccessibilityTraits,
|
||||
} = require('ViewAccessibility');
|
||||
|
||||
type Event = Object;
|
||||
export type Event = Object;
|
||||
|
||||
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
@@ -36,8 +37,8 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
* TouchableWithoutFeedback supports only one child.
|
||||
* If you wish to have several child components, wrap them in a View.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const TouchableWithoutFeedback = React.createClass({
|
||||
const TouchableWithoutFeedback = createReactClass({
|
||||
displayName: 'TouchableWithoutFeedback',
|
||||
mixins: [TimerMixin, Touchable.Mixin],
|
||||
|
||||
propTypes: {
|
||||
@@ -88,6 +89,7 @@ const TouchableWithoutFeedback = React.createClass({
|
||||
* reactivated! Move it back and forth several times while the scroll view
|
||||
* is disabled. Ensure you pass in a constant to reduce memory allocations.
|
||||
*/
|
||||
// $FlowFixMe: Expected a React PropType instead
|
||||
pressRetentionOffset: EdgeInsetsPropType,
|
||||
/**
|
||||
* This defines how far your touch can start away from the button. This is
|
||||
@@ -97,6 +99,7 @@ const TouchableWithoutFeedback = React.createClass({
|
||||
* of sibling views always takes precedence if a touch hits two overlapping
|
||||
* views.
|
||||
*/
|
||||
// $FlowFixMe: Expected a React PropType instead
|
||||
hitSlop: EdgeInsetsPropType,
|
||||
},
|
||||
|
||||
|
||||
@@ -9,20 +9,21 @@
|
||||
* @providesModule View
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
const Platform = require('Platform');
|
||||
const PropTypes = require('prop-types');
|
||||
const React = require('React');
|
||||
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
const NativeMethodsMixin = require("NativeMethodsMixin");
|
||||
const Platform = require("Platform");
|
||||
const PropTypes = require("prop-types");
|
||||
const React = require("React");
|
||||
const ReactNativeStyleAttributes = require("ReactNativeStyleAttributes");
|
||||
const ReactNativeViewAttributes = require("ReactNativeViewAttributes");
|
||||
const ViewPropTypes = require("ViewPropTypes");
|
||||
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const createReactClass = require("create-react-class");
|
||||
const invariant = require("fbjs/lib/invariant");
|
||||
const requireNativeComponent = require("requireNativeComponent");
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type { ViewProps } from "ViewPropTypes";
|
||||
|
||||
export type Props = ViewProps;
|
||||
|
||||
@@ -73,7 +74,8 @@ export type Props = ViewProps;
|
||||
* - `touches` - Array of all current touches on the screen.
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const View = React.createClass({
|
||||
const View = createReactClass({
|
||||
displayName: "View",
|
||||
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
|
||||
// one of the props is of type AccessibilityComponentType. That is defined as a const[] above,
|
||||
// but it is not rendered by the docs, since `statics` below is not rendered. So its Possible
|
||||
@@ -91,42 +93,44 @@ const View = React.createClass({
|
||||
* make `this` look like an actual native component class.
|
||||
*/
|
||||
viewConfig: {
|
||||
uiViewClassName: 'RCTView',
|
||||
uiViewClassName: "RCTView",
|
||||
validAttributes: ReactNativeViewAttributes.RCTView
|
||||
},
|
||||
|
||||
contextTypes: {
|
||||
isInAParentText: PropTypes.bool,
|
||||
isInAParentText: PropTypes.bool
|
||||
},
|
||||
|
||||
render: function() {
|
||||
invariant(
|
||||
!(this.context.isInAParentText && Platform.OS === 'android'),
|
||||
'Nesting of <View> within <Text> is not supported on Android.');
|
||||
!(this.context.isInAParentText && Platform.OS === "android"),
|
||||
"Nesting of <View> within <Text> is not supported on Android."
|
||||
);
|
||||
|
||||
// WARNING: This method will not be used in production mode as in that mode we
|
||||
// replace wrapper component View with generated native wrapper RCTView. Avoid
|
||||
// adding functionality this component that you'd want to be available in both
|
||||
// dev and prod modes.
|
||||
return <RCTView {...this.props} />;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
const RCTView = requireNativeComponent('RCTView', View, {
|
||||
const RCTView = requireNativeComponent("RCTView", View, {
|
||||
nativeOnly: {
|
||||
nativeBackgroundAndroid: true,
|
||||
nativeForegroundAndroid: true,
|
||||
nativeForegroundAndroid: true
|
||||
}
|
||||
});
|
||||
|
||||
if (__DEV__) {
|
||||
const UIManager = require('UIManager');
|
||||
const viewConfig = UIManager.viewConfigs && UIManager.viewConfigs.RCTView || {};
|
||||
const UIManager = require("UIManager");
|
||||
const viewConfig =
|
||||
(UIManager.viewConfigs && UIManager.viewConfigs.RCTView) || {};
|
||||
for (const prop in viewConfig.nativeProps) {
|
||||
const viewAny: any = View; // Appease flow
|
||||
if (!viewAny.propTypes[prop] && !ReactNativeStyleAttributes[prop]) {
|
||||
throw new Error(
|
||||
'View is missing propType for native prop `' + prop + '`'
|
||||
"View is missing propType for native prop `" + prop + "`"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -138,4 +142,4 @@ if (__DEV__) {
|
||||
}
|
||||
|
||||
// No one should depend on the DEV-mode createClass View wrapper.
|
||||
module.exports = ((ViewToExport : any) : typeof RCTView);
|
||||
module.exports = ((ViewToExport: any): typeof RCTView);
|
||||
|
||||
@@ -36,6 +36,19 @@ import type {TVViewProps} from 'TVViewPropTypes';
|
||||
|
||||
const stylePropType = StyleSheetPropType(ViewStylePropTypes);
|
||||
|
||||
export type ViewLayout = {
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
}
|
||||
|
||||
export type ViewLayoutEvent = {
|
||||
nativeEvent: {
|
||||
layout: ViewLayout,
|
||||
}
|
||||
}
|
||||
|
||||
// There's no easy way to create a different type if(Platform.isTVOS):
|
||||
// so we must include TVViewProps
|
||||
export type ViewProps = {
|
||||
@@ -50,6 +63,7 @@ export type ViewProps = {
|
||||
onMagicTap?: Function,
|
||||
testID?: string,
|
||||
nativeID?: string,
|
||||
onLayout?: (event: ViewLayoutEvent) => void,
|
||||
onResponderGrant?: Function,
|
||||
onResponderMove?: Function,
|
||||
onResponderReject?: Function,
|
||||
|
||||
@@ -216,8 +216,6 @@ if (__DEV__) {
|
||||
require('setupDevtools');
|
||||
}
|
||||
|
||||
require('RCTDebugComponentOwnership');
|
||||
|
||||
// Set up inspector
|
||||
const JSInspector = require('JSInspector');
|
||||
JSInspector.registerAgent(require('NetworkAgent'));
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* Utility class to provide the component owner hierarchy to native code for
|
||||
* debugging purposes.
|
||||
*
|
||||
* @providesModule RCTDebugComponentOwnership
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
|
||||
var RCTDebugComponentOwnership = {
|
||||
/**
|
||||
* Asynchronously returns the owner hierarchy as an array of strings. Request id is
|
||||
* passed along to the native module so that the native module can identify the
|
||||
* particular call instance.
|
||||
*
|
||||
* Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text']
|
||||
*/
|
||||
getOwnerHierarchy: function(requestID: number, tag: number) {
|
||||
// Consider cleaning up these unused modules in a separate diff.
|
||||
throw new Error(
|
||||
'This seems to be unused. Will disable until it is needed again.'
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
BatchedBridge.registerCallableModule(
|
||||
'RCTDebugComponentOwnership',
|
||||
RCTDebugComponentOwnership
|
||||
);
|
||||
|
||||
module.exports = RCTDebugComponentOwnership;
|
||||
@@ -20,6 +20,7 @@ const StyleSheet = require('StyleSheet');
|
||||
const TimerMixin = require('react-timer-mixin');
|
||||
const View = require('View');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
|
||||
const IS_RTL = I18nManager.isRTL;
|
||||
@@ -61,7 +62,8 @@ const RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
|
||||
* used in a normal ListView. See the renderRow for SwipeableListView to see how
|
||||
* to use this component separately.
|
||||
*/
|
||||
const SwipeableRow = React.createClass({
|
||||
const SwipeableRow = createReactClass({
|
||||
displayName: 'SwipeableRow',
|
||||
_panResponder: {},
|
||||
_previousLeft: CLOSED_LEFT_POSITION,
|
||||
|
||||
@@ -70,6 +72,8 @@ const SwipeableRow = React.createClass({
|
||||
propTypes: {
|
||||
children: PropTypes.any,
|
||||
isOpen: PropTypes.bool,
|
||||
preventSwipeLeft: PropTypes.bool,
|
||||
preventSwipeRight: PropTypes.bool,
|
||||
maxSwipeDistance: PropTypes.number.isRequired,
|
||||
onOpen: PropTypes.func.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
@@ -106,6 +110,8 @@ const SwipeableRow = React.createClass({
|
||||
getDefaultProps(): Object {
|
||||
return {
|
||||
isOpen: false,
|
||||
preventSwipeLeft: false,
|
||||
preventSwipeRight: false,
|
||||
maxSwipeDistance: 0,
|
||||
onOpen: emptyFunction,
|
||||
onClose: emptyFunction,
|
||||
@@ -333,6 +339,12 @@ const SwipeableRow = React.createClass({
|
||||
|
||||
// Ignore swipes due to user's finger moving slightly when tapping
|
||||
_isValidSwipe(gestureState: Object): boolean {
|
||||
if (this.props.preventSwipeLeft && gestureState.dx < 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.props.preventSwipeRight && gestureState.dx > 0) {
|
||||
return false;
|
||||
}
|
||||
return Math.abs(gestureState.dx) > HORIZONTAL_SWIPE_DISTANCE_THRESHOLD;
|
||||
},
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ var View = require('View');
|
||||
var ViewPropTypes = require('ViewPropTypes');
|
||||
var ViewStylePropTypes = require('ViewStylePropTypes');
|
||||
|
||||
var createReactClass = require('create-react-class');
|
||||
var filterObject = require('fbjs/lib/filterObject');
|
||||
var flattenStyle = require('flattenStyle');
|
||||
var merge = require('merge');
|
||||
@@ -76,7 +77,8 @@ var ImageViewAttributes = merge(ReactNativeViewAttributes.UIView, {
|
||||
var ViewStyleKeys = new Set(Object.keys(ViewStylePropTypes));
|
||||
var ImageSpecificStyleKeys = new Set(Object.keys(ImageStylePropTypes).filter(x => !ViewStyleKeys.has(x)));
|
||||
|
||||
var Image = React.createClass({
|
||||
var Image = createReactClass({
|
||||
displayName: 'Image',
|
||||
propTypes: {
|
||||
...ViewPropTypes,
|
||||
style: StyleSheetPropType(ImageStylePropTypes),
|
||||
|
||||
@@ -23,6 +23,7 @@ const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const StyleSheetPropType = require('StyleSheetPropType');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const flattenStyle = require('flattenStyle');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const resolveAssetSource = require('resolveAssetSource');
|
||||
@@ -34,8 +35,10 @@ const ImageViewManager = NativeModules.ImageViewManager;
|
||||
* including network images, static resources, temporary local images, and
|
||||
* images from local disk, such as the camera roll.
|
||||
*
|
||||
* This example shows both fetching and displaying an image from local
|
||||
* storage as well as one from network.
|
||||
* This example shows fetching and displaying an image from local storage
|
||||
* as well as one from network and even from data provided in the `'data:'` uri scheme.
|
||||
*
|
||||
* > Note that for network and data images, you will need to manually specify the dimensions of your image!
|
||||
*
|
||||
* ```ReactNativeWebPlayer
|
||||
* import React, { Component } from 'react';
|
||||
@@ -52,6 +55,10 @@ const ImageViewManager = NativeModules.ImageViewManager;
|
||||
* style={{width: 50, height: 50}}
|
||||
* source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
|
||||
* />
|
||||
* <Image
|
||||
* style={{width: 66, height: 58}}
|
||||
* source={{uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='}}
|
||||
* />
|
||||
* </View>
|
||||
* );
|
||||
* }
|
||||
@@ -103,17 +110,17 @@ const ImageViewManager = NativeModules.ImageViewManager;
|
||||
* ```
|
||||
* dependencies {
|
||||
* // If your app supports Android versions before Ice Cream Sandwich (API level 14)
|
||||
* compile 'com.facebook.fresco:animated-base-support:1.0.1'
|
||||
* compile 'com.facebook.fresco:animated-base-support:1.3.0'
|
||||
*
|
||||
* // For animated GIF support
|
||||
* compile 'com.facebook.fresco:animated-gif:1.0.1'
|
||||
* compile 'com.facebook.fresco:animated-gif:1.3.0'
|
||||
*
|
||||
* // For WebP support, including animated WebP
|
||||
* compile 'com.facebook.fresco:animated-webp:1.0.1'
|
||||
* compile 'com.facebook.fresco:webpsupport:1.0.1'
|
||||
* compile 'com.facebook.fresco:animated-webp:1.3.0'
|
||||
* compile 'com.facebook.fresco:webpsupport:1.3.0'
|
||||
*
|
||||
* // For WebP support, without animations
|
||||
* compile 'com.facebook.fresco:webpsupport:1.0.1'
|
||||
* compile 'com.facebook.fresco:webpsupport:1.3.0'
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
@@ -126,7 +133,8 @@ const ImageViewManager = NativeModules.ImageViewManager;
|
||||
*
|
||||
*/
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const Image = React.createClass({
|
||||
const Image = createReactClass({
|
||||
displayName: 'Image',
|
||||
propTypes: {
|
||||
/**
|
||||
* > `ImageResizeMode` is an `Enum` for different image resizing modes, set via the
|
||||
|
||||
@@ -17,6 +17,10 @@ const React = require('React');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const View = require('View');
|
||||
|
||||
const ensureComponentIsNative = require('ensureComponentIsNative');
|
||||
|
||||
import type {NativeMethodsMixinType} from 'ReactNativeTypes';
|
||||
|
||||
/**
|
||||
* Very simple drop-in replacement for <Image> which supports nesting views.
|
||||
*
|
||||
@@ -42,11 +46,26 @@ const View = require('View');
|
||||
* ```
|
||||
*/
|
||||
class ImageBackground extends React.Component {
|
||||
setNativeProps(props: Object) {
|
||||
// Work-around flow
|
||||
const viewRef = this._viewRef;
|
||||
if (viewRef) {
|
||||
ensureComponentIsNative(viewRef);
|
||||
viewRef.setNativeProps(props);
|
||||
}
|
||||
}
|
||||
|
||||
_viewRef: ?NativeMethodsMixinType = null;
|
||||
|
||||
_captureRef = ref => {
|
||||
this._viewRef = ref;
|
||||
};
|
||||
|
||||
render() {
|
||||
const {children, style, imageStyle, imageRef, ...props} = this.props;
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<View style={style} ref={this._captureRef}>
|
||||
<Image
|
||||
{...props}
|
||||
style={[
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
// This is a stub for flow to make it understand require('./icon.png')
|
||||
// See packager/src/Bundler/index.js
|
||||
// See metro-bundler/src/Bundler/index.js
|
||||
|
||||
var AssetRegistry = require('AssetRegistry');
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ class BoxInspector extends React.Component {
|
||||
<BoxContainer title="padding" box={padding}>
|
||||
<View>
|
||||
<Text style={styles.innerText}>
|
||||
({frame.left}, {frame.top})
|
||||
({(frame.left || 0).toFixed(1)}, {(frame.top || 0).toFixed(1)})
|
||||
</Text>
|
||||
<Text style={styles.innerText}>
|
||||
{frame.width} × {frame.height}
|
||||
{(frame.width || 0).toFixed(1)} × {(frame.height || 0).toFixed(1)}
|
||||
</Text>
|
||||
</View>
|
||||
</BoxContainer>
|
||||
@@ -110,4 +110,3 @@ var styles = StyleSheet.create({
|
||||
});
|
||||
|
||||
module.exports = BoxInspector;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ type RequiredProps<ItemT> = {
|
||||
* onShowUnderlay={separators.highlight}
|
||||
* onHideUnderlay={separators.unhighlight}>
|
||||
* <View style={{backgroundColor: 'white'}}>
|
||||
* <Text>{item.title}}</Text>
|
||||
* <Text>{item.title}</Text>
|
||||
* </View>
|
||||
* </TouchableHighlight>
|
||||
* )}
|
||||
|
||||
@@ -25,6 +25,7 @@ var TimerMixin = require('react-timer-mixin');
|
||||
var View = require('View');
|
||||
|
||||
var cloneReferencedElement = require('react-clone-referenced-element');
|
||||
var createReactClass = require('create-react-class');
|
||||
var isEmpty = require('isEmpty');
|
||||
var merge = require('merge');
|
||||
|
||||
@@ -35,6 +36,12 @@ var DEFAULT_END_REACHED_THRESHOLD = 1000;
|
||||
var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
|
||||
|
||||
/**
|
||||
* DEPRECATED - use one of the new list components, such as [`FlatList`](docs/flatlist.html)
|
||||
* or [`SectionList`](docs/sectionlist.html) for bounded memory use, fewer bugs,
|
||||
* better performance, an easier to use API, and more features. Check out this
|
||||
* [blog post](https://facebook.github.io/react-native/blog/2017/03/13/better-list-views.html)
|
||||
* for more details.
|
||||
*
|
||||
* ListView - A core component designed for efficient display of vertically
|
||||
* scrolling lists of changing data. The minimal API is to create a
|
||||
* [`ListView.DataSource`](docs/listviewdatasource.html), populate it with a simple
|
||||
@@ -85,7 +92,8 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
|
||||
* rendering rows.
|
||||
*/
|
||||
|
||||
var ListView = React.createClass({
|
||||
var ListView = createReactClass({
|
||||
displayName: 'ListView',
|
||||
_childFrames: ([]: Array<Object>),
|
||||
_sentEndForContentLength: (null: ?number),
|
||||
_scrollComponent: (null: any),
|
||||
|
||||
@@ -129,7 +129,8 @@ type OptionalProps<SectionT: SectionBase<any>> = {
|
||||
/**
|
||||
* Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
* and as the react key to track item re-ordering. The default extractor checks item.key, then
|
||||
* falls back to using the index, like react does.
|
||||
* falls back to using the index, like react does. Note that this sets keys for each item, but
|
||||
* each overall section still needs its own key.
|
||||
*/
|
||||
keyExtractor: (item: Item, index: number) => string,
|
||||
/**
|
||||
|
||||
@@ -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.',
|
||||
);
|
||||
|
||||
@@ -60,9 +60,13 @@ module.exports = {
|
||||
];
|
||||
return (
|
||||
<FlatList
|
||||
renderItem={(
|
||||
info, // $FlowExpectedError - bad widgetCount type 6, should be Object
|
||||
) => <span>{info.item.widget.missingProp}</span>}
|
||||
renderItem={info =>
|
||||
<span>
|
||||
{
|
||||
// $FlowExpectedError - bad widgetCount type 6, should be Object
|
||||
info.item.widget.missingProp
|
||||
}
|
||||
</span>}
|
||||
data={data}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -95,7 +95,7 @@ class RCTNetworking extends NativeEventEmitter {
|
||||
if (__DEV__ && !RCTNetworkingNative) {
|
||||
class MissingNativeRCTNetworkingShim extends MissingNativeEventEmitterShim {
|
||||
constructor() {
|
||||
super('RCTAppState', 'AppState');
|
||||
super('RCTNetworking', 'Networking');
|
||||
}
|
||||
|
||||
sendRequest(...args: Array<any>) {
|
||||
|
||||
@@ -63,7 +63,7 @@ class RCTNetworking extends NativeEventEmitter {
|
||||
if (__DEV__ && !RCTNetworkingNative) {
|
||||
class MissingNativeRCTNetworkingShim extends MissingNativeEventEmitterShim {
|
||||
constructor() {
|
||||
super('RCTAppState', 'AppState');
|
||||
super('RCTNetworking', 'Networking');
|
||||
}
|
||||
|
||||
sendRequest(...args: Array<any>) {
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule fetch
|
||||
* @nolint
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'whatwg-fetch';
|
||||
|
||||
@@ -128,7 +128,7 @@ class PushNotificationIOS {
|
||||
_badgeCount: number;
|
||||
_notificationId: string;
|
||||
_isRemote: boolean;
|
||||
_remoteNotificationCompleteCalllbackCalled: boolean;
|
||||
_remoteNotificationCompleteCallbackCalled: boolean;
|
||||
|
||||
static FetchResult: FetchResult = {
|
||||
NewData: 'UIBackgroundFetchResultNewData',
|
||||
@@ -406,7 +406,7 @@ class PushNotificationIOS {
|
||||
*/
|
||||
constructor(nativeNotif: Object) {
|
||||
this._data = {};
|
||||
this._remoteNotificationCompleteCalllbackCalled = false;
|
||||
this._remoteNotificationCompleteCallbackCalled = false;
|
||||
this._isRemote = nativeNotif.remote;
|
||||
if (this._isRemote) {
|
||||
this._notificationId = nativeNotif.notificationId;
|
||||
@@ -451,10 +451,10 @@ class PushNotificationIOS {
|
||||
* be throttled, to read more about it see the above documentation link.
|
||||
*/
|
||||
finish(fetchResult: FetchResult) {
|
||||
if (!this._isRemote || !this._notificationId || this._remoteNotificationCompleteCalllbackCalled) {
|
||||
if (!this._isRemote || !this._notificationId || this._remoteNotificationCompleteCallbackCalled) {
|
||||
return;
|
||||
}
|
||||
this._remoteNotificationCompleteCalllbackCalled = true;
|
||||
this._remoteNotificationCompleteCallbackCalled = true;
|
||||
|
||||
RCTPushNotificationManager.onFinishRemoteNotification(this._notificationId, fetchResult);
|
||||
}
|
||||
|
||||
@@ -70,13 +70,19 @@ function requireNativeComponent(
|
||||
viewConfig.propTypes = null;
|
||||
}
|
||||
|
||||
// The ViewConfig doesn't contain any props inherited from the view manager's
|
||||
// superclass, so we manually merge in the RCTView ones. Other inheritance
|
||||
// patterns are currenty not supported.
|
||||
const nativeProps = {
|
||||
...UIManager.RCTView.NativeProps,
|
||||
...viewConfig.NativeProps,
|
||||
};
|
||||
let baseModuleName = viewConfig.baseModuleName;
|
||||
let nativeProps = { ...viewConfig.NativeProps };
|
||||
while (baseModuleName) {
|
||||
const baseModule = UIManager[baseModuleName];
|
||||
if (!baseModule) {
|
||||
warning(false, 'Base module "%s" does not exist', baseModuleName);
|
||||
baseModuleName = null;
|
||||
} else {
|
||||
nativeProps = { ...nativeProps, ...baseModule.NativeProps };
|
||||
baseModuleName = baseModule.baseModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
for (const key in nativeProps) {
|
||||
let useAttribute = false;
|
||||
const attribute = {};
|
||||
|
||||
@@ -1 +1 @@
|
||||
cb32253d2f0376de899edb1bc6ebbd1602eec074
|
||||
5495e495de0bd15cd96a76ee0d7ca823cc09cc71
|
||||
+4508
-4277
File diff suppressed because it is too large
Load Diff
@@ -1039,34 +1039,21 @@ var ReactNativeInjection = {
|
||||
HighPriority: 3,
|
||||
LowPriority: 4,
|
||||
OffscreenPriority: 5
|
||||
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority;
|
||||
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot;
|
||||
|
||||
function comparePriority(a, b) {
|
||||
return a !== TaskPriority && a !== SynchronousPriority || b !== TaskPriority && b !== SynchronousPriority ? a === NoWork && b !== NoWork ? -255 : a !== NoWork && b === NoWork ? 255 : a - b : 0;
|
||||
}
|
||||
|
||||
function ensureUpdateQueue(fiber) {
|
||||
if (null !== fiber.updateQueue) return fiber.updateQueue;
|
||||
var queue = void 0;
|
||||
return queue = {
|
||||
function createUpdateQueue() {
|
||||
return {
|
||||
first: null,
|
||||
last: null,
|
||||
hasForceUpdate: !1,
|
||||
callbackList: null
|
||||
}, fiber.updateQueue = queue, queue;
|
||||
};
|
||||
}
|
||||
|
||||
function cloneUpdateQueue(current, workInProgress) {
|
||||
var currentQueue = current.updateQueue;
|
||||
if (null === currentQueue) return workInProgress.updateQueue = null, null;
|
||||
var altQueue = null !== workInProgress.updateQueue ? workInProgress.updateQueue : {};
|
||||
return altQueue.first = currentQueue.first, altQueue.last = currentQueue.last, altQueue.hasForceUpdate = !1,
|
||||
altQueue.callbackList = null, altQueue.isProcessing = !1, workInProgress.updateQueue = altQueue,
|
||||
altQueue;
|
||||
}
|
||||
|
||||
var cloneUpdateQueue_1 = cloneUpdateQueue;
|
||||
|
||||
function cloneUpdate(update) {
|
||||
return {
|
||||
priorityLevel: update.priorityLevel,
|
||||
@@ -1091,17 +1078,23 @@ function findInsertionPosition(queue, update) {
|
||||
return insertAfter;
|
||||
}
|
||||
|
||||
function ensureUpdateQueues(fiber) {
|
||||
var alternateFiber = fiber.alternate, queue1 = fiber.updateQueue;
|
||||
null === queue1 && (queue1 = fiber.updateQueue = createUpdateQueue());
|
||||
var queue2 = void 0;
|
||||
return null !== alternateFiber ? null === (queue2 = alternateFiber.updateQueue) && (queue2 = alternateFiber.updateQueue = createUpdateQueue()) : queue2 = null,
|
||||
[ queue1, queue2 !== queue1 ? queue2 : null ];
|
||||
}
|
||||
|
||||
function insertUpdate(fiber, update) {
|
||||
var queue1 = ensureUpdateQueue(fiber), queue2 = null !== fiber.alternate ? ensureUpdateQueue(fiber.alternate) : null, insertAfter1 = findInsertionPosition(queue1, update), insertBefore1 = null !== insertAfter1 ? insertAfter1.next : queue1.first;
|
||||
var _ensureUpdateQueues = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues[0], queue2 = _ensureUpdateQueues[1], insertAfter1 = findInsertionPosition(queue1, update), insertBefore1 = null !== insertAfter1 ? insertAfter1.next : queue1.first;
|
||||
if (null === queue2) return insertUpdateIntoQueue(queue1, update, insertAfter1, insertBefore1),
|
||||
null;
|
||||
var insertAfter2 = findInsertionPosition(queue2, update), insertBefore2 = null !== insertAfter2 ? insertAfter2.next : queue2.first;
|
||||
if (insertUpdateIntoQueue(queue1, update, insertAfter1, insertBefore1), insertBefore1 !== insertBefore2) {
|
||||
var update2 = cloneUpdate(update);
|
||||
return insertUpdateIntoQueue(queue2, update2, insertAfter2, insertBefore2), update2;
|
||||
}
|
||||
return null === insertAfter2 && (queue2.first = update), null === insertBefore2 && (queue2.last = null),
|
||||
null;
|
||||
if (insertUpdateIntoQueue(queue1, update, insertAfter1, insertBefore1), insertBefore1 === insertBefore2 && null !== insertBefore1 || insertAfter1 === insertAfter2 && null !== insertAfter1) return null === insertAfter2 && (queue2.first = update),
|
||||
null === insertBefore2 && (queue2.last = null), null;
|
||||
var update2 = cloneUpdate(update);
|
||||
return insertUpdateIntoQueue(queue2, update2, insertAfter2, insertBefore2), update2;
|
||||
}
|
||||
|
||||
function addUpdate(fiber, partialState, callback, priorityLevel) {
|
||||
@@ -1146,11 +1139,12 @@ function addForceUpdate(fiber, callback, priorityLevel) {
|
||||
|
||||
var addForceUpdate_1 = addForceUpdate;
|
||||
|
||||
function getPendingPriority(queue) {
|
||||
return null !== queue.first ? queue.first.priorityLevel : NoWork;
|
||||
function getUpdatePriority(fiber) {
|
||||
var updateQueue = fiber.updateQueue;
|
||||
return null === updateQueue ? NoWork : fiber.tag !== ClassComponent && fiber.tag !== HostRoot ? NoWork : null !== updateQueue.first ? updateQueue.first.priorityLevel : NoWork;
|
||||
}
|
||||
|
||||
var getPendingPriority_1 = getPendingPriority;
|
||||
var getUpdatePriority_1 = getUpdatePriority;
|
||||
|
||||
function addTopLevelUpdate$1(fiber, partialState, callback, priorityLevel) {
|
||||
var isTopLevelUnmount = null === partialState.element, update = {
|
||||
@@ -1163,7 +1157,7 @@ function addTopLevelUpdate$1(fiber, partialState, callback, priorityLevel) {
|
||||
next: null
|
||||
}, update2 = insertUpdate(fiber, update);
|
||||
if (isTopLevelUnmount) {
|
||||
var queue1 = fiber.updateQueue, queue2 = null !== fiber.alternate ? fiber.alternate.updateQueue : null;
|
||||
var _ensureUpdateQueues2 = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues2[0], queue2 = _ensureUpdateQueues2[1];
|
||||
null !== queue1 && null !== update.next && (update.next = null, queue1.last = update),
|
||||
null !== queue2 && null !== update2 && null !== update2.next && (update2.next = null,
|
||||
queue2.last = update);
|
||||
@@ -1180,18 +1174,27 @@ function getStateFromUpdate(update, instance, prevState, props) {
|
||||
return partialState;
|
||||
}
|
||||
|
||||
function beginUpdateQueue(workInProgress, queue, instance, prevState, props, priorityLevel) {
|
||||
queue.hasForceUpdate = !1;
|
||||
for (var state = prevState, dontMutatePrevState = !0, callbackList = queue.callbackList, update = queue.first; null !== update && comparePriority(update.priorityLevel, priorityLevel) <= 0; ) {
|
||||
function beginUpdateQueue(current, workInProgress, queue, instance, prevState, props, priorityLevel) {
|
||||
if (null !== current && current.updateQueue === queue) {
|
||||
var currentQueue = queue;
|
||||
queue = workInProgress.updateQueue = {
|
||||
first: currentQueue.first,
|
||||
last: currentQueue.last,
|
||||
callbackList: null,
|
||||
hasForceUpdate: !1
|
||||
};
|
||||
}
|
||||
for (var callbackList = queue.callbackList, hasForceUpdate = queue.hasForceUpdate, state = prevState, dontMutatePrevState = !0, update = queue.first; null !== update && comparePriority(update.priorityLevel, priorityLevel) <= 0; ) {
|
||||
queue.first = update.next, null === queue.first && (queue.last = null);
|
||||
var _partialState = void 0;
|
||||
update.isReplace ? (state = getStateFromUpdate(update, instance, state, props),
|
||||
dontMutatePrevState = !0) : (_partialState = getStateFromUpdate(update, instance, state, props)) && (state = dontMutatePrevState ? Object.assign({}, state, _partialState) : Object.assign(state, _partialState),
|
||||
dontMutatePrevState = !1), update.isForced && (queue.hasForceUpdate = !0), null === update.callback || update.isTopLevelUnmount && null !== update.next || (callbackList = callbackList || [],
|
||||
dontMutatePrevState = !1), update.isForced && (hasForceUpdate = !0), null === update.callback || update.isTopLevelUnmount && null !== update.next || (callbackList = null !== callbackList ? callbackList : [],
|
||||
callbackList.push(update.callback), workInProgress.effectTag |= CallbackEffect),
|
||||
update = update.next;
|
||||
}
|
||||
return queue.callbackList = callbackList, null !== queue.first || null !== callbackList || queue.hasForceUpdate || (workInProgress.updateQueue = null),
|
||||
return queue.callbackList = callbackList, queue.hasForceUpdate = hasForceUpdate,
|
||||
null !== queue.first || null !== callbackList || hasForceUpdate || (workInProgress.updateQueue = null),
|
||||
state;
|
||||
}
|
||||
|
||||
@@ -1199,19 +1202,21 @@ var beginUpdateQueue_1 = beginUpdateQueue;
|
||||
|
||||
function commitCallbacks(finishedWork, queue, context) {
|
||||
var callbackList = queue.callbackList;
|
||||
if (null !== callbackList) for (var i = 0; i < callbackList.length; i++) {
|
||||
var _callback = callbackList[i];
|
||||
invariant("function" == typeof _callback, "Invalid argument passed as callback. Expected a function. Instead " + "received: %s", _callback),
|
||||
_callback.call(context);
|
||||
if (null !== callbackList) {
|
||||
queue.callbackList = null;
|
||||
for (var i = 0; i < callbackList.length; i++) {
|
||||
var _callback = callbackList[i];
|
||||
invariant("function" == typeof _callback, "Invalid argument passed as callback. Expected a function. Instead " + "received: %s", _callback),
|
||||
_callback.call(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var commitCallbacks_1 = commitCallbacks, ReactFiberUpdateQueue = {
|
||||
cloneUpdateQueue: cloneUpdateQueue_1,
|
||||
addUpdate: addUpdate_1,
|
||||
addReplaceUpdate: addReplaceUpdate_1,
|
||||
addForceUpdate: addForceUpdate_1,
|
||||
getPendingPriority: getPendingPriority_1,
|
||||
getUpdatePriority: getUpdatePriority_1,
|
||||
addTopLevelUpdate: addTopLevelUpdate_1,
|
||||
beginUpdateQueue: beginUpdateQueue_1,
|
||||
commitCallbacks: commitCallbacks_1
|
||||
@@ -1244,7 +1249,7 @@ var getComponentName_1 = getComponentName$1, ReactInstanceMap = {
|
||||
}
|
||||
}, ReactInstanceMap_1 = ReactInstanceMap, ReactInternals = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ReactGlobalSharedState = {
|
||||
ReactCurrentOwner: ReactInternals.ReactCurrentOwner
|
||||
}, ReactGlobalSharedState_1 = ReactGlobalSharedState, HostRoot$1 = ReactTypeOfWork.HostRoot, HostComponent$2 = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, NoEffect = ReactTypeOfSideEffect.NoEffect, Placement = ReactTypeOfSideEffect.Placement, MOUNTING = 1, MOUNTED = 2, UNMOUNTED = 3;
|
||||
}, ReactGlobalSharedState_1 = ReactGlobalSharedState, HostRoot$2 = ReactTypeOfWork.HostRoot, HostComponent$2 = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, NoEffect = ReactTypeOfSideEffect.NoEffect, Placement = ReactTypeOfSideEffect.Placement, MOUNTING = 1, MOUNTED = 2, UNMOUNTED = 3;
|
||||
|
||||
function isFiberMountedImpl(fiber) {
|
||||
var node = fiber;
|
||||
@@ -1252,7 +1257,7 @@ function isFiberMountedImpl(fiber) {
|
||||
if ((node.effectTag & Placement) !== NoEffect) return MOUNTING;
|
||||
for (;node.return; ) if (node = node.return, (node.effectTag & Placement) !== NoEffect) return MOUNTING;
|
||||
}
|
||||
return node.tag === HostRoot$1 ? MOUNTED : UNMOUNTED;
|
||||
return node.tag === HostRoot$2 ? MOUNTED : UNMOUNTED;
|
||||
}
|
||||
|
||||
var isFiberMounted$1 = function(fiber) {
|
||||
@@ -1313,7 +1318,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
||||
}
|
||||
invariant(a.alternate === b, "Return fibers should always be each others' alternates.");
|
||||
}
|
||||
return invariant(a.tag === HostRoot$1, "Unable to find node on an unmounted component."),
|
||||
return invariant(a.tag === HostRoot$2, "Unable to find node on an unmounted component."),
|
||||
a.stateNode.current === a ? fiber : alternate;
|
||||
}
|
||||
|
||||
@@ -1361,7 +1366,7 @@ var findCurrentFiberUsingSlowPath_1 = findCurrentFiberUsingSlowPath, findCurrent
|
||||
for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
||||
}
|
||||
return target;
|
||||
}, isFiberMounted = ReactFiberTreeReflection.isFiberMounted, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot, createCursor = ReactFiberStack.createCursor, pop = ReactFiberStack.pop, push = ReactFiberStack.push, contextStackCursor = createCursor(emptyObject), didPerformWorkStackCursor = createCursor(!1), previousContext = emptyObject;
|
||||
}, isFiberMounted = ReactFiberTreeReflection.isFiberMounted, ClassComponent$1 = ReactTypeOfWork.ClassComponent, HostRoot$1 = ReactTypeOfWork.HostRoot, createCursor = ReactFiberStack.createCursor, pop = ReactFiberStack.pop, push = ReactFiberStack.push, contextStackCursor = createCursor(emptyObject), didPerformWorkStackCursor = createCursor(!1), previousContext = emptyObject;
|
||||
|
||||
function getUnmaskedContext(workInProgress) {
|
||||
return isContextProvider$1(workInProgress) ? previousContext : contextStackCursor.current;
|
||||
@@ -1387,13 +1392,13 @@ var cacheContext_1 = cacheContext, getMaskedContext = function(workInProgress, u
|
||||
};
|
||||
|
||||
function isContextConsumer(fiber) {
|
||||
return fiber.tag === ClassComponent && null != fiber.type.contextTypes;
|
||||
return fiber.tag === ClassComponent$1 && null != fiber.type.contextTypes;
|
||||
}
|
||||
|
||||
var isContextConsumer_1 = isContextConsumer;
|
||||
|
||||
function isContextProvider$1(fiber) {
|
||||
return fiber.tag === ClassComponent && null != fiber.type.childContextTypes;
|
||||
return fiber.tag === ClassComponent$1 && null != fiber.type.childContextTypes;
|
||||
}
|
||||
|
||||
var isContextProvider_1 = isContextProvider$1;
|
||||
@@ -1431,8 +1436,8 @@ var processChildContext_1 = processChildContext$1, pushContextProvider = functio
|
||||
}, resetContext = function() {
|
||||
previousContext = emptyObject, contextStackCursor.current = emptyObject, didPerformWorkStackCursor.current = !1;
|
||||
}, findCurrentUnmaskedContext$1 = function(fiber) {
|
||||
invariant(isFiberMounted(fiber) && fiber.tag === ClassComponent, "Expected subtree parent to be a mounted class component");
|
||||
for (var node = fiber; node.tag !== HostRoot; ) {
|
||||
invariant(isFiberMounted(fiber) && fiber.tag === ClassComponent$1, "Expected subtree parent to be a mounted class component");
|
||||
for (var node = fiber; node.tag !== HostRoot$1; ) {
|
||||
if (isContextProvider$1(node)) return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
||||
var parent = node.return;
|
||||
invariant(parent, "Found unexpected detached subtree parent"), node = parent;
|
||||
@@ -1455,7 +1460,7 @@ var processChildContext_1 = processChildContext$1, pushContextProvider = functio
|
||||
}, ReactTypeOfInternalContext = {
|
||||
NoContext: 0,
|
||||
AsyncUpdates: 1
|
||||
}, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, ClassComponent$2 = ReactTypeOfWork.ClassComponent, HostRoot$2 = ReactTypeOfWork.HostRoot, HostComponent$3 = ReactTypeOfWork.HostComponent, HostText$1 = ReactTypeOfWork.HostText, HostPortal = ReactTypeOfWork.HostPortal, CoroutineComponent = ReactTypeOfWork.CoroutineComponent, YieldComponent = ReactTypeOfWork.YieldComponent, Fragment = ReactTypeOfWork.Fragment, NoWork$1 = ReactPriorityLevel.NoWork, NoContext = ReactTypeOfInternalContext.NoContext, NoEffect$1 = ReactTypeOfSideEffect.NoEffect, cloneUpdateQueue$1 = ReactFiberUpdateQueue.cloneUpdateQueue, createFiber = function(tag, key, internalContextTag) {
|
||||
}, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, ClassComponent$3 = ReactTypeOfWork.ClassComponent, HostRoot$3 = ReactTypeOfWork.HostRoot, HostComponent$3 = ReactTypeOfWork.HostComponent, HostText$1 = ReactTypeOfWork.HostText, HostPortal = ReactTypeOfWork.HostPortal, CoroutineComponent = ReactTypeOfWork.CoroutineComponent, YieldComponent = ReactTypeOfWork.YieldComponent, Fragment = ReactTypeOfWork.Fragment, NoWork$1 = ReactPriorityLevel.NoWork, NoContext = ReactTypeOfInternalContext.NoContext, NoEffect$1 = ReactTypeOfSideEffect.NoEffect, createFiber = function(tag, key, internalContextTag) {
|
||||
return {
|
||||
tag: tag,
|
||||
key: key,
|
||||
@@ -1476,10 +1481,6 @@ var processChildContext_1 = processChildContext$1, pushContextProvider = functio
|
||||
firstEffect: null,
|
||||
lastEffect: null,
|
||||
pendingWorkPriority: NoWork$1,
|
||||
progressedPriority: NoWork$1,
|
||||
progressedChild: null,
|
||||
progressedFirstDeletion: null,
|
||||
progressedLastDeletion: null,
|
||||
alternate: null
|
||||
};
|
||||
};
|
||||
@@ -1488,18 +1489,18 @@ function shouldConstruct(Component) {
|
||||
return !(!Component.prototype || !Component.prototype.isReactComponent);
|
||||
}
|
||||
|
||||
var cloneFiber = function(fiber, priorityLevel) {
|
||||
var alt = fiber.alternate;
|
||||
return null !== alt ? (alt.effectTag = NoEffect$1, alt.nextEffect = null, alt.firstEffect = null,
|
||||
alt.lastEffect = null) : (alt = createFiber(fiber.tag, fiber.key, fiber.internalContextTag),
|
||||
alt.type = fiber.type, alt.progressedChild = fiber.progressedChild, alt.progressedPriority = fiber.progressedPriority,
|
||||
alt.alternate = fiber, fiber.alternate = alt), alt.stateNode = fiber.stateNode,
|
||||
alt.child = fiber.child, alt.sibling = fiber.sibling, alt.index = fiber.index, alt.ref = fiber.ref,
|
||||
alt.pendingProps = fiber.pendingProps, cloneUpdateQueue$1(fiber, alt), alt.pendingWorkPriority = priorityLevel,
|
||||
alt.memoizedProps = fiber.memoizedProps, alt.memoizedState = fiber.memoizedState,
|
||||
alt;
|
||||
var createWorkInProgress = function(current, renderPriority) {
|
||||
var workInProgress = current.alternate;
|
||||
return null === workInProgress ? (workInProgress = createFiber(current.tag, current.key, current.internalContextTag),
|
||||
workInProgress.type = current.type, workInProgress.stateNode = current.stateNode,
|
||||
workInProgress.alternate = current, current.alternate = workInProgress) : (workInProgress.effectTag = NoWork$1,
|
||||
workInProgress.nextEffect = null, workInProgress.firstEffect = null, workInProgress.lastEffect = null),
|
||||
workInProgress.pendingWorkPriority = renderPriority, workInProgress.child = current.child,
|
||||
workInProgress.memoizedProps = current.memoizedProps, workInProgress.memoizedState = current.memoizedState,
|
||||
workInProgress.updateQueue = current.updateQueue, workInProgress.sibling = current.sibling,
|
||||
workInProgress.index = current.index, workInProgress.ref = current.ref, workInProgress;
|
||||
}, createHostRootFiber$1 = function() {
|
||||
return createFiber(HostRoot$2, null, NoContext);
|
||||
return createFiber(HostRoot$3, null, NoContext);
|
||||
}, createFiberFromElement = function(element, internalContextTag, priorityLevel) {
|
||||
var owner = null, fiber = createFiberFromElementType(element.type, element.key, internalContextTag, owner);
|
||||
return fiber.pendingProps = element.props, fiber.pendingWorkPriority = priorityLevel,
|
||||
@@ -1516,7 +1517,7 @@ var cloneFiber = function(fiber, priorityLevel) {
|
||||
|
||||
function createFiberFromElementType(type, key, internalContextTag, debugOwner) {
|
||||
var fiber = void 0;
|
||||
if ("function" == typeof type) fiber = shouldConstruct(type) ? createFiber(ClassComponent$2, key, internalContextTag) : createFiber(IndeterminateComponent, key, internalContextTag),
|
||||
if ("function" == typeof type) fiber = shouldConstruct(type) ? createFiber(ClassComponent$3, key, internalContextTag) : createFiber(IndeterminateComponent, key, internalContextTag),
|
||||
fiber.type = type; else if ("string" == typeof type) fiber = createFiber(HostComponent$3, key, internalContextTag),
|
||||
fiber.type = type; else if ("object" == typeof type && null !== type && "number" == typeof type.tag) fiber = type; else {
|
||||
var info = "";
|
||||
@@ -1541,8 +1542,10 @@ var createFiberFromElementType_1 = createFiberFromElementType, createFiberFromHo
|
||||
containerInfo: portal.containerInfo,
|
||||
implementation: portal.implementation
|
||||
}, fiber;
|
||||
}, largerPriority = function(p1, p2) {
|
||||
return p1 !== NoWork$1 && (p2 === NoWork$1 || p2 > p1) ? p1 : p2;
|
||||
}, ReactFiber = {
|
||||
cloneFiber: cloneFiber,
|
||||
createWorkInProgress: createWorkInProgress,
|
||||
createHostRootFiber: createHostRootFiber$1,
|
||||
createFiberFromElement: createFiberFromElement,
|
||||
createFiberFromFragment: createFiberFromFragment,
|
||||
@@ -1551,7 +1554,8 @@ var createFiberFromElementType_1 = createFiberFromElementType, createFiberFromHo
|
||||
createFiberFromHostInstanceForDeletion: createFiberFromHostInstanceForDeletion,
|
||||
createFiberFromCoroutine: createFiberFromCoroutine,
|
||||
createFiberFromYield: createFiberFromYield,
|
||||
createFiberFromPortal: createFiberFromPortal
|
||||
createFiberFromPortal: createFiberFromPortal,
|
||||
largerPriority: largerPriority
|
||||
}, createHostRootFiber = ReactFiber.createHostRootFiber, createFiberRoot$1 = function(containerInfo) {
|
||||
var uninitializedFiber = createHostRootFiber(), root = {
|
||||
current: uninitializedFiber,
|
||||
@@ -1564,7 +1568,7 @@ var createFiberFromElementType_1 = createFiberFromElementType, createFiberFromHo
|
||||
return uninitializedFiber.stateNode = root, root;
|
||||
}, ReactFiberRoot = {
|
||||
createFiberRoot: createFiberRoot$1
|
||||
}, IndeterminateComponent$1 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent = ReactTypeOfWork.FunctionalComponent, ClassComponent$4 = ReactTypeOfWork.ClassComponent, HostComponent$5 = ReactTypeOfWork.HostComponent;
|
||||
}, IndeterminateComponent$1 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent = ReactTypeOfWork.FunctionalComponent, ClassComponent$5 = ReactTypeOfWork.ClassComponent, HostComponent$5 = ReactTypeOfWork.HostComponent;
|
||||
|
||||
function describeComponentFrame(name, source, ownerName) {
|
||||
return "\n in " + (name || "Unknown") + (source ? " (at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + ")" : ownerName ? " (created by " + ownerName + ")" : "");
|
||||
@@ -1574,7 +1578,7 @@ function describeFiber(fiber) {
|
||||
switch (fiber.tag) {
|
||||
case IndeterminateComponent$1:
|
||||
case FunctionalComponent:
|
||||
case ClassComponent$4:
|
||||
case ClassComponent$5:
|
||||
case HostComponent$5:
|
||||
var owner = fiber._debugOwner, source = fiber._debugSource, name = getComponentName_1(fiber), ownerName = null;
|
||||
return owner && (ownerName = getComponentName_1(owner)), describeComponentFrame(name, source, ownerName);
|
||||
@@ -1626,7 +1630,7 @@ var createCoroutine = function(children, handler, props) {
|
||||
isYield: isYield,
|
||||
REACT_YIELD_TYPE: REACT_YIELD_TYPE_1,
|
||||
REACT_COROUTINE_TYPE: REACT_COROUTINE_TYPE_1
|
||||
}, REACT_COROUTINE_TYPE = ReactCoroutine.REACT_COROUTINE_TYPE, REACT_YIELD_TYPE = ReactCoroutine.REACT_YIELD_TYPE, REACT_PORTAL_TYPE$1 = ReactPortal.REACT_PORTAL_TYPE, cloneFiber$2 = ReactFiber.cloneFiber, createFiberFromElement$1 = ReactFiber.createFiberFromElement, createFiberFromFragment$1 = ReactFiber.createFiberFromFragment, createFiberFromText$1 = ReactFiber.createFiberFromText, createFiberFromCoroutine$1 = ReactFiber.createFiberFromCoroutine, createFiberFromYield$1 = ReactFiber.createFiberFromYield, createFiberFromPortal$1 = ReactFiber.createFiberFromPortal, isArray = Array.isArray, FunctionalComponent$2 = ReactTypeOfWork.FunctionalComponent, ClassComponent$6 = ReactTypeOfWork.ClassComponent, HostText$3 = ReactTypeOfWork.HostText, HostPortal$3 = ReactTypeOfWork.HostPortal, CoroutineComponent$2 = ReactTypeOfWork.CoroutineComponent, YieldComponent$2 = ReactTypeOfWork.YieldComponent, Fragment$2 = ReactTypeOfWork.Fragment, NoEffect$2 = ReactTypeOfSideEffect.NoEffect, Placement$3 = ReactTypeOfSideEffect.Placement, Deletion$1 = ReactTypeOfSideEffect.Deletion, ITERATOR_SYMBOL = "function" == typeof Symbol && Symbol.iterator, FAUX_ITERATOR_SYMBOL = "@@iterator", REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103;
|
||||
}, REACT_COROUTINE_TYPE = ReactCoroutine.REACT_COROUTINE_TYPE, REACT_YIELD_TYPE = ReactCoroutine.REACT_YIELD_TYPE, REACT_PORTAL_TYPE$1 = ReactPortal.REACT_PORTAL_TYPE, createWorkInProgress$2 = ReactFiber.createWorkInProgress, createFiberFromElement$1 = ReactFiber.createFiberFromElement, createFiberFromFragment$1 = ReactFiber.createFiberFromFragment, createFiberFromText$1 = ReactFiber.createFiberFromText, createFiberFromCoroutine$1 = ReactFiber.createFiberFromCoroutine, createFiberFromYield$1 = ReactFiber.createFiberFromYield, createFiberFromPortal$1 = ReactFiber.createFiberFromPortal, isArray = Array.isArray, FunctionalComponent$2 = ReactTypeOfWork.FunctionalComponent, ClassComponent$7 = ReactTypeOfWork.ClassComponent, HostText$3 = ReactTypeOfWork.HostText, HostPortal$3 = ReactTypeOfWork.HostPortal, CoroutineComponent$2 = ReactTypeOfWork.CoroutineComponent, YieldComponent$2 = ReactTypeOfWork.YieldComponent, Fragment$2 = ReactTypeOfWork.Fragment, NoEffect$2 = ReactTypeOfSideEffect.NoEffect, Placement$3 = ReactTypeOfSideEffect.Placement, Deletion$1 = ReactTypeOfSideEffect.Deletion, ITERATOR_SYMBOL = "function" == typeof Symbol && Symbol.iterator, FAUX_ITERATOR_SYMBOL = "@@iterator", REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103;
|
||||
|
||||
function getIteratorFn(maybeIterable) {
|
||||
if (null === maybeIterable || void 0 === maybeIterable) return null;
|
||||
@@ -1640,7 +1644,7 @@ function coerceRef(current, element) {
|
||||
var owner = element._owner, inst = void 0;
|
||||
if (owner) if ("number" == typeof owner.tag) {
|
||||
var ownerFiber = owner;
|
||||
invariant(ownerFiber.tag === ClassComponent$6, "Stateless function components cannot have refs."),
|
||||
invariant(ownerFiber.tag === ClassComponent$7, "Stateless function components cannot have refs."),
|
||||
inst = ownerFiber.stateNode;
|
||||
} else inst = owner.getPublicInstance();
|
||||
invariant(inst, "Missing owner for string ref %s. This error is likely caused by a " + "bug in React. Please file an issue.", mixedRef);
|
||||
@@ -1668,8 +1672,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
if (null === childToDelete.alternate) return;
|
||||
childToDelete = childToDelete.alternate;
|
||||
}
|
||||
var last = returnFiber.progressedLastDeletion;
|
||||
null !== last ? (last.nextEffect = childToDelete, returnFiber.progressedLastDeletion = childToDelete) : returnFiber.progressedFirstDeletion = returnFiber.progressedLastDeletion = childToDelete,
|
||||
var last = returnFiber.lastEffect;
|
||||
null !== last ? (last.nextEffect = childToDelete, returnFiber.lastEffect = childToDelete) : returnFiber.firstEffect = returnFiber.lastEffect = childToDelete,
|
||||
childToDelete.nextEffect = null, childToDelete.effectTag = Deletion$1;
|
||||
}
|
||||
}
|
||||
@@ -1686,7 +1690,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
}
|
||||
function useFiber(fiber, priority) {
|
||||
if (shouldClone) {
|
||||
var clone = cloneFiber$2(fiber, priority);
|
||||
var clone = createWorkInProgress$2(fiber, priority);
|
||||
return clone.index = 0, clone.sibling = null, clone;
|
||||
}
|
||||
return fiber.pendingWorkPriority = priority, fiber.effectTag = NoEffect$2, fiber.index = 0,
|
||||
@@ -2002,7 +2006,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
|
||||
}
|
||||
if (disableNewFiberFeatures) switch (returnFiber.tag) {
|
||||
case ClassComponent$6:
|
||||
case ClassComponent$7:
|
||||
var Component = returnFiber.type;
|
||||
invariant(null === newChild || !1 === newChild, "%s.render(): A valid React element (or null) must be returned. " + "You may have returned undefined, an array or some other " + "invalid object.", Component.displayName || Component.name || "Component");
|
||||
break;
|
||||
@@ -2015,7 +2019,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
if (isArray(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, priority);
|
||||
if (getIteratorFn(newChild)) return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, priority);
|
||||
if (isObject && throwOnInvalidObjectType(returnFiber, newChild), !disableNewFiberFeatures && void 0 === newChild) switch (returnFiber.tag) {
|
||||
case ClassComponent$6:
|
||||
case ClassComponent$7:
|
||||
case FunctionalComponent$2:
|
||||
var _Component2 = returnFiber.type;
|
||||
invariant(!1, "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null.", _Component2.displayName || _Component2.name || "Component");
|
||||
@@ -2026,14 +2030,15 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
}
|
||||
|
||||
var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlace$1 = ChildReconciler(!1, !0), mountChildFibersInPlace$1 = ChildReconciler(!1, !1), cloneChildFibers$1 = function(current, workInProgress) {
|
||||
if (workInProgress.child) if (null !== current && workInProgress.child === current.child) {
|
||||
var currentChild = workInProgress.child, newChild = cloneFiber$2(currentChild, currentChild.pendingWorkPriority);
|
||||
for (workInProgress.child = newChild, newChild.return = workInProgress; null !== currentChild.sibling; ) currentChild = currentChild.sibling,
|
||||
newChild = newChild.sibling = cloneFiber$2(currentChild, currentChild.pendingWorkPriority),
|
||||
newChild.return = workInProgress;
|
||||
if (invariant(null === current || workInProgress.child === current.child, "Resuming work not yet implemented."),
|
||||
null !== workInProgress.child) {
|
||||
var currentChild = workInProgress.child, newChild = createWorkInProgress$2(currentChild, currentChild.pendingWorkPriority);
|
||||
for (newChild.pendingProps = currentChild.pendingProps, workInProgress.child = newChild,
|
||||
newChild.return = workInProgress; null !== currentChild.sibling; ) currentChild = currentChild.sibling,
|
||||
newChild = newChild.sibling = createWorkInProgress$2(currentChild, currentChild.pendingWorkPriority),
|
||||
newChild.pendingProps = currentChild.pendingProps, newChild.return = workInProgress;
|
||||
newChild.sibling = null;
|
||||
} else for (var child = workInProgress.child; null !== child; ) child.return = workInProgress,
|
||||
child = child.sibling;
|
||||
}
|
||||
}, ReactChildFiber = {
|
||||
reconcileChildFibers: reconcileChildFibers$1,
|
||||
reconcileChildFibersInPlace: reconcileChildFibersInPlace$1,
|
||||
@@ -2086,7 +2091,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
instance.componentWillReceiveProps(newProps, newContext), instance.state !== oldState && updater.enqueueReplaceState(instance, instance.state, null);
|
||||
}
|
||||
function mountClassInstance(workInProgress, priorityLevel) {
|
||||
var instance = workInProgress.stateNode, state = instance.state || null, props = workInProgress.pendingProps;
|
||||
var current = workInProgress.alternate, instance = workInProgress.stateNode, state = instance.state || null, props = workInProgress.pendingProps;
|
||||
invariant(props, "There must be pending props for an initial mount. This error is " + "likely caused by a bug in React. Please file an issue.");
|
||||
var unmaskedContext = getUnmaskedContext$2(workInProgress);
|
||||
if (instance.props = props, instance.state = state, instance.refs = emptyObject,
|
||||
@@ -2094,30 +2099,10 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
"function" == typeof instance.componentWillMount) {
|
||||
callComponentWillMount(workInProgress, instance);
|
||||
var updateQueue = workInProgress.updateQueue;
|
||||
null !== updateQueue && (instance.state = beginUpdateQueue$2(workInProgress, updateQueue, instance, state, props, priorityLevel));
|
||||
null !== updateQueue && (instance.state = beginUpdateQueue$2(current, workInProgress, updateQueue, instance, state, props, priorityLevel));
|
||||
}
|
||||
"function" == typeof instance.componentDidMount && (workInProgress.effectTag |= Update$1);
|
||||
}
|
||||
function resumeMountClassInstance(workInProgress, priorityLevel) {
|
||||
var instance = workInProgress.stateNode;
|
||||
resetInputPointers(workInProgress, instance);
|
||||
var newState = workInProgress.memoizedState, newProps = workInProgress.pendingProps;
|
||||
newProps || (newProps = workInProgress.memoizedProps, invariant(null != newProps, "There should always be pending or memoized props. This error is " + "likely caused by a bug in React. Please file an issue."));
|
||||
var newUnmaskedContext = getUnmaskedContext$2(workInProgress), newContext = getMaskedContext$2(workInProgress, newUnmaskedContext), oldContext = instance.context, oldProps = workInProgress.memoizedProps;
|
||||
"function" != typeof instance.componentWillReceiveProps || oldProps === newProps && oldContext === newContext || callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
|
||||
var updateQueue = workInProgress.updateQueue;
|
||||
if (null !== updateQueue && (newState = beginUpdateQueue$2(workInProgress, updateQueue, instance, newState, newProps, priorityLevel)),
|
||||
!checkShouldComponentUpdate(workInProgress, workInProgress.memoizedProps, newProps, workInProgress.memoizedState, newState, newContext)) return instance.props = newProps,
|
||||
instance.state = newState, instance.context = newContext, !1;
|
||||
if (instance.props = newProps, instance.state = newState, instance.context = newContext,
|
||||
"function" == typeof instance.componentWillMount) {
|
||||
callComponentWillMount(workInProgress, instance);
|
||||
var newUpdateQueue = workInProgress.updateQueue;
|
||||
null !== newUpdateQueue && (newState = beginUpdateQueue$2(workInProgress, newUpdateQueue, instance, newState, newProps, priorityLevel));
|
||||
}
|
||||
return "function" == typeof instance.componentDidMount && (workInProgress.effectTag |= Update$1),
|
||||
instance.state = newState, !0;
|
||||
}
|
||||
function updateClassInstance(current, workInProgress, priorityLevel) {
|
||||
var instance = workInProgress.stateNode;
|
||||
resetInputPointers(workInProgress, instance);
|
||||
@@ -2125,9 +2110,9 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
newProps || (newProps = oldProps, invariant(null != newProps, "There should always be pending or memoized props. This error is " + "likely caused by a bug in React. Please file an issue."));
|
||||
var oldContext = instance.context, newUnmaskedContext = getUnmaskedContext$2(workInProgress), newContext = getMaskedContext$2(workInProgress, newUnmaskedContext);
|
||||
"function" != typeof instance.componentWillReceiveProps || oldProps === newProps && oldContext === newContext || callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
|
||||
var updateQueue = workInProgress.updateQueue, oldState = workInProgress.memoizedState, newState = void 0;
|
||||
if (newState = null !== updateQueue ? beginUpdateQueue$2(workInProgress, updateQueue, instance, oldState, newProps, priorityLevel) : oldState,
|
||||
!(oldProps !== newProps || oldState !== newState || hasContextChanged$2() || null !== updateQueue && updateQueue.hasForceUpdate)) return "function" == typeof instance.componentDidUpdate && (oldProps === current.memoizedProps && oldState === current.memoizedState || (workInProgress.effectTag |= Update$1)),
|
||||
var oldState = workInProgress.memoizedState, newState = void 0;
|
||||
if (newState = null !== workInProgress.updateQueue ? beginUpdateQueue$2(current, workInProgress, workInProgress.updateQueue, instance, oldState, newProps, priorityLevel) : oldState,
|
||||
!(oldProps !== newProps || oldState !== newState || hasContextChanged$2() || null !== workInProgress.updateQueue && workInProgress.updateQueue.hasForceUpdate)) return "function" == typeof instance.componentDidUpdate && (oldProps === current.memoizedProps && oldState === current.memoizedState || (workInProgress.effectTag |= Update$1)),
|
||||
!1;
|
||||
var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext);
|
||||
return shouldUpdate ? ("function" == typeof instance.componentWillUpdate && instance.componentWillUpdate(newProps, newState, newContext),
|
||||
@@ -2140,29 +2125,15 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
adoptClassInstance: adoptClassInstance,
|
||||
constructClassInstance: constructClassInstance,
|
||||
mountClassInstance: mountClassInstance,
|
||||
resumeMountClassInstance: resumeMountClassInstance,
|
||||
updateClassInstance: updateClassInstance
|
||||
};
|
||||
}, mountChildFibersInPlace = ReactChildFiber.mountChildFibersInPlace, reconcileChildFibers = ReactChildFiber.reconcileChildFibers, reconcileChildFibersInPlace = ReactChildFiber.reconcileChildFibersInPlace, cloneChildFibers = ReactChildFiber.cloneChildFibers, beginUpdateQueue$1 = ReactFiberUpdateQueue.beginUpdateQueue, getMaskedContext$1 = ReactFiberContext.getMaskedContext, getUnmaskedContext$1 = ReactFiberContext.getUnmaskedContext, hasContextChanged$1 = ReactFiberContext.hasContextChanged, pushContextProvider$1 = ReactFiberContext.pushContextProvider, pushTopLevelContextObject$1 = ReactFiberContext.pushTopLevelContextObject, invalidateContextProvider$1 = ReactFiberContext.invalidateContextProvider, IndeterminateComponent$2 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$1 = ReactTypeOfWork.FunctionalComponent, ClassComponent$5 = ReactTypeOfWork.ClassComponent, HostRoot$4 = ReactTypeOfWork.HostRoot, HostComponent$6 = ReactTypeOfWork.HostComponent, HostText$2 = ReactTypeOfWork.HostText, HostPortal$2 = ReactTypeOfWork.HostPortal, CoroutineComponent$1 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$1 = ReactTypeOfWork.YieldComponent, Fragment$1 = ReactTypeOfWork.Fragment, NoWork$3 = ReactPriorityLevel.NoWork, OffscreenPriority$1 = ReactPriorityLevel.OffscreenPriority, PerformedWork$1 = ReactTypeOfSideEffect.PerformedWork, Placement$2 = ReactTypeOfSideEffect.Placement, ContentReset$1 = ReactTypeOfSideEffect.ContentReset, Err$1 = ReactTypeOfSideEffect.Err, Ref$1 = ReactTypeOfSideEffect.Ref, ReactCurrentOwner$2 = ReactGlobalSharedState_1.ReactCurrentOwner, ReactFiberBeginWork = function(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext) {
|
||||
var shouldSetTextContent = config.shouldSetTextContent, useSyncScheduling = config.useSyncScheduling, shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree, pushHostContext = hostContext.pushHostContext, pushHostContainer = hostContext.pushHostContainer, enterHydrationState = hydrationContext.enterHydrationState, resetHydrationState = hydrationContext.resetHydrationState, tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance, _ReactFiberClassCompo = ReactFiberClassComponent(scheduleUpdate, getPriorityContext, memoizeProps, memoizeState), adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance, constructClassInstance = _ReactFiberClassCompo.constructClassInstance, mountClassInstance = _ReactFiberClassCompo.mountClassInstance, resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance, updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
|
||||
function markChildAsProgressed(current, workInProgress, priorityLevel) {
|
||||
workInProgress.progressedChild = workInProgress.child, workInProgress.progressedPriority = priorityLevel,
|
||||
null !== current && (current.progressedChild = workInProgress.progressedChild, current.progressedPriority = workInProgress.progressedPriority);
|
||||
}
|
||||
function clearDeletions(workInProgress) {
|
||||
workInProgress.progressedFirstDeletion = workInProgress.progressedLastDeletion = null;
|
||||
}
|
||||
function transferDeletions(workInProgress) {
|
||||
workInProgress.firstEffect = workInProgress.progressedFirstDeletion, workInProgress.lastEffect = workInProgress.progressedLastDeletion;
|
||||
}
|
||||
}, mountChildFibersInPlace = ReactChildFiber.mountChildFibersInPlace, reconcileChildFibers = ReactChildFiber.reconcileChildFibers, reconcileChildFibersInPlace = ReactChildFiber.reconcileChildFibersInPlace, cloneChildFibers = ReactChildFiber.cloneChildFibers, beginUpdateQueue$1 = ReactFiberUpdateQueue.beginUpdateQueue, getMaskedContext$1 = ReactFiberContext.getMaskedContext, getUnmaskedContext$1 = ReactFiberContext.getUnmaskedContext, hasContextChanged$1 = ReactFiberContext.hasContextChanged, pushContextProvider$1 = ReactFiberContext.pushContextProvider, pushTopLevelContextObject$1 = ReactFiberContext.pushTopLevelContextObject, invalidateContextProvider$1 = ReactFiberContext.invalidateContextProvider, IndeterminateComponent$2 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$1 = ReactTypeOfWork.FunctionalComponent, ClassComponent$6 = ReactTypeOfWork.ClassComponent, HostRoot$5 = ReactTypeOfWork.HostRoot, HostComponent$6 = ReactTypeOfWork.HostComponent, HostText$2 = ReactTypeOfWork.HostText, HostPortal$2 = ReactTypeOfWork.HostPortal, CoroutineComponent$1 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$1 = ReactTypeOfWork.YieldComponent, Fragment$1 = ReactTypeOfWork.Fragment, NoWork$3 = ReactPriorityLevel.NoWork, OffscreenPriority$1 = ReactPriorityLevel.OffscreenPriority, PerformedWork$1 = ReactTypeOfSideEffect.PerformedWork, Placement$2 = ReactTypeOfSideEffect.Placement, ContentReset$1 = ReactTypeOfSideEffect.ContentReset, Err$1 = ReactTypeOfSideEffect.Err, Ref$1 = ReactTypeOfSideEffect.Ref, ReactCurrentOwner$2 = ReactGlobalSharedState_1.ReactCurrentOwner, ReactFiberBeginWork = function(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext) {
|
||||
var shouldSetTextContent = config.shouldSetTextContent, useSyncScheduling = config.useSyncScheduling, shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree, pushHostContext = hostContext.pushHostContext, pushHostContainer = hostContext.pushHostContainer, enterHydrationState = hydrationContext.enterHydrationState, resetHydrationState = hydrationContext.resetHydrationState, tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance, _ReactFiberClassCompo = ReactFiberClassComponent(scheduleUpdate, getPriorityContext, memoizeProps, memoizeState), adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance, constructClassInstance = _ReactFiberClassCompo.constructClassInstance, mountClassInstance = _ReactFiberClassCompo.mountClassInstance, updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
|
||||
function reconcileChildren(current, workInProgress, nextChildren) {
|
||||
reconcileChildrenAtPriority(current, workInProgress, nextChildren, workInProgress.pendingWorkPriority);
|
||||
}
|
||||
function reconcileChildrenAtPriority(current, workInProgress, nextChildren, priorityLevel) {
|
||||
workInProgress.memoizedProps = null, null === current ? workInProgress.child = mountChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel) : current.child === workInProgress.child ? (clearDeletions(workInProgress),
|
||||
workInProgress.child = reconcileChildFibers(workInProgress, workInProgress.child, nextChildren, priorityLevel),
|
||||
transferDeletions(workInProgress)) : (workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel),
|
||||
transferDeletions(workInProgress)), markChildAsProgressed(current, workInProgress, priorityLevel);
|
||||
null === current ? workInProgress.child = mountChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel) : current.child === workInProgress.child ? workInProgress.child = reconcileChildFibers(workInProgress, workInProgress.child, nextChildren, priorityLevel) : workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel);
|
||||
}
|
||||
function updateFragment(current, workInProgress) {
|
||||
var nextChildren = workInProgress.pendingProps;
|
||||
@@ -2188,7 +2159,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
}
|
||||
function updateClassComponent(current, workInProgress, priorityLevel) {
|
||||
var hasContext = pushContextProvider$1(workInProgress), shouldUpdate = void 0;
|
||||
return null === current ? workInProgress.stateNode ? shouldUpdate = resumeMountClassInstance(workInProgress, priorityLevel) : (constructClassInstance(workInProgress, workInProgress.pendingProps),
|
||||
return null === current ? workInProgress.stateNode ? invariant(!1, "Resuming work not yet implemented.") : (constructClassInstance(workInProgress, workInProgress.pendingProps),
|
||||
mountClassInstance(workInProgress, priorityLevel), shouldUpdate = !0) : shouldUpdate = updateClassInstance(current, workInProgress, priorityLevel),
|
||||
finishClassComponent(current, workInProgress, shouldUpdate, hasContext);
|
||||
}
|
||||
@@ -2208,40 +2179,27 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
pushHostContainer(workInProgress, root.containerInfo);
|
||||
var updateQueue = workInProgress.updateQueue;
|
||||
if (null !== updateQueue) {
|
||||
var prevState = workInProgress.memoizedState, state = beginUpdateQueue$1(workInProgress, updateQueue, null, prevState, null, priorityLevel);
|
||||
var prevState = workInProgress.memoizedState, state = beginUpdateQueue$1(current, workInProgress, updateQueue, null, prevState, null, priorityLevel);
|
||||
if (prevState === state) return resetHydrationState(), bailoutOnAlreadyFinishedWork(current, workInProgress);
|
||||
var element = state.element;
|
||||
return null !== current && null !== current.child || !enterHydrationState(workInProgress) ? (resetHydrationState(),
|
||||
reconcileChildren(current, workInProgress, element)) : (workInProgress.effectTag |= Placement$2,
|
||||
workInProgress.child = mountChildFibersInPlace(workInProgress, workInProgress.child, element, priorityLevel),
|
||||
markChildAsProgressed(current, workInProgress, priorityLevel)), memoizeState(workInProgress, state),
|
||||
workInProgress.child;
|
||||
workInProgress.child = mountChildFibersInPlace(workInProgress, workInProgress.child, element, priorityLevel)),
|
||||
memoizeState(workInProgress, state), workInProgress.child;
|
||||
}
|
||||
return resetHydrationState(), bailoutOnAlreadyFinishedWork(current, workInProgress);
|
||||
}
|
||||
function updateHostComponent(current, workInProgress) {
|
||||
function updateHostComponent(current, workInProgress, renderPriority) {
|
||||
pushHostContext(workInProgress), null === current && tryToClaimNextHydratableInstance(workInProgress);
|
||||
var nextProps = workInProgress.pendingProps, type = workInProgress.type, prevProps = null !== current ? current.memoizedProps : null, memoizedProps = workInProgress.memoizedProps;
|
||||
if (hasContextChanged$1()) null === nextProps && (nextProps = memoizedProps, invariant(null !== nextProps, "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue.")); else if (null === nextProps || memoizedProps === nextProps) {
|
||||
if (!useSyncScheduling && shouldDeprioritizeSubtree(type, memoizedProps) && workInProgress.pendingWorkPriority !== OffscreenPriority$1) {
|
||||
for (var child = workInProgress.progressedChild; null !== child; ) child.pendingWorkPriority = OffscreenPriority$1,
|
||||
child = child.sibling;
|
||||
return null;
|
||||
}
|
||||
return bailoutOnAlreadyFinishedWork(current, workInProgress);
|
||||
}
|
||||
var type = workInProgress.type, memoizedProps = workInProgress.memoizedProps, nextProps = workInProgress.pendingProps;
|
||||
null === nextProps && (nextProps = memoizedProps, invariant(null !== nextProps, "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue."));
|
||||
var prevProps = null !== current ? current.memoizedProps : null;
|
||||
if (hasContextChanged$1()) ; else if (null === nextProps || memoizedProps === nextProps) return bailoutOnAlreadyFinishedWork(current, workInProgress);
|
||||
var nextChildren = nextProps.children;
|
||||
if (shouldSetTextContent(type, nextProps) ? nextChildren = null : prevProps && shouldSetTextContent(type, prevProps) && (workInProgress.effectTag |= ContentReset$1),
|
||||
markRef(current, workInProgress), !useSyncScheduling && shouldDeprioritizeSubtree(workInProgress.type, nextProps) && workInProgress.pendingWorkPriority !== OffscreenPriority$1) {
|
||||
if (workInProgress.progressedPriority === OffscreenPriority$1 && (workInProgress.child = workInProgress.progressedChild),
|
||||
reconcileChildrenAtPriority(current, workInProgress, nextChildren, OffscreenPriority$1),
|
||||
memoizeProps(workInProgress, nextProps), workInProgress.child = null !== current ? current.child : null,
|
||||
null === current) for (var _child = workInProgress.progressedChild; null !== _child; ) _child.effectTag = Placement$2,
|
||||
_child = _child.sibling;
|
||||
return null;
|
||||
}
|
||||
return reconcileChildren(current, workInProgress, nextChildren), memoizeProps(workInProgress, nextProps),
|
||||
workInProgress.child;
|
||||
return shouldSetTextContent(type, nextProps) ? nextChildren = null : prevProps && shouldSetTextContent(type, prevProps) && (workInProgress.effectTag |= ContentReset$1),
|
||||
markRef(current, workInProgress), renderPriority !== OffscreenPriority$1 && !useSyncScheduling && shouldDeprioritizeSubtree(type, nextProps) ? (workInProgress.pendingWorkPriority = OffscreenPriority$1,
|
||||
null) : (reconcileChildren(current, workInProgress, nextChildren), memoizeProps(workInProgress, nextProps),
|
||||
workInProgress.child);
|
||||
}
|
||||
function updateHostText(current, workInProgress) {
|
||||
null === current && tryToClaimNextHydratableInstance(workInProgress);
|
||||
@@ -2253,7 +2211,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
invariant(null === current, "An indeterminate component should never have mounted. This error is " + "likely caused by a bug in React. Please file an issue.");
|
||||
var value, fn = workInProgress.type, props = workInProgress.pendingProps, unmaskedContext = getUnmaskedContext$1(workInProgress), context = getMaskedContext$1(workInProgress, unmaskedContext);
|
||||
if (value = fn(props, context), workInProgress.effectTag |= PerformedWork$1, "object" == typeof value && null !== value && "function" == typeof value.render) {
|
||||
workInProgress.tag = ClassComponent$5;
|
||||
workInProgress.tag = ClassComponent$6;
|
||||
var hasContext = pushContextProvider$1(workInProgress);
|
||||
return adoptClassInstance(workInProgress, value), mountClassInstance(workInProgress, priorityLevel),
|
||||
finishClassComponent(current, workInProgress, !0, hasContext);
|
||||
@@ -2266,11 +2224,8 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
hasContextChanged$1() ? null === nextCoroutine && (nextCoroutine = current && current.memoizedProps,
|
||||
invariant(null !== nextCoroutine, "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue.")) : null !== nextCoroutine && workInProgress.memoizedProps !== nextCoroutine || (nextCoroutine = workInProgress.memoizedProps);
|
||||
var nextChildren = nextCoroutine.children, priorityLevel = workInProgress.pendingWorkPriority;
|
||||
return workInProgress.memoizedProps = null, null === current ? workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel) : current.child === workInProgress.child ? (clearDeletions(workInProgress),
|
||||
workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel),
|
||||
transferDeletions(workInProgress)) : (workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel),
|
||||
transferDeletions(workInProgress)), memoizeProps(workInProgress, nextCoroutine),
|
||||
workInProgress.stateNode;
|
||||
return null === current ? workInProgress.stateNode = mountChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel) : current.child === workInProgress.child ? workInProgress.stateNode = reconcileChildFibers(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel) : workInProgress.stateNode = reconcileChildFibersInPlace(workInProgress, workInProgress.stateNode, nextChildren, priorityLevel),
|
||||
memoizeProps(workInProgress, nextCoroutine), workInProgress.stateNode;
|
||||
}
|
||||
function updatePortalComponent(current, workInProgress) {
|
||||
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
||||
@@ -2278,18 +2233,15 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
if (hasContextChanged$1()) null === nextChildren && (nextChildren = current && current.memoizedProps,
|
||||
invariant(null != nextChildren, "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue.")); else if (null === nextChildren || workInProgress.memoizedProps === nextChildren) return bailoutOnAlreadyFinishedWork(current, workInProgress);
|
||||
return null === current ? (workInProgress.child = reconcileChildFibersInPlace(workInProgress, workInProgress.child, nextChildren, priorityLevel),
|
||||
memoizeProps(workInProgress, nextChildren), markChildAsProgressed(current, workInProgress, priorityLevel)) : (reconcileChildren(current, workInProgress, nextChildren),
|
||||
memoizeProps(workInProgress, nextChildren)) : (reconcileChildren(current, workInProgress, nextChildren),
|
||||
memoizeProps(workInProgress, nextChildren)), workInProgress.child;
|
||||
}
|
||||
function bailoutOnAlreadyFinishedWork(current, workInProgress) {
|
||||
var priorityLevel = workInProgress.pendingWorkPriority;
|
||||
return current && workInProgress.child === current.child && clearDeletions(workInProgress),
|
||||
cloneChildFibers(current, workInProgress), markChildAsProgressed(current, workInProgress, priorityLevel),
|
||||
workInProgress.child;
|
||||
return cloneChildFibers(current, workInProgress), workInProgress.child;
|
||||
}
|
||||
function bailoutOnLowPriority(current, workInProgress) {
|
||||
switch (workInProgress.tag) {
|
||||
case ClassComponent$5:
|
||||
case ClassComponent$6:
|
||||
pushContextProvider$1(workInProgress);
|
||||
break;
|
||||
|
||||
@@ -2299,29 +2251,28 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
return null;
|
||||
}
|
||||
function memoizeProps(workInProgress, nextProps) {
|
||||
workInProgress.memoizedProps = nextProps, workInProgress.pendingProps = null;
|
||||
workInProgress.memoizedProps = nextProps;
|
||||
}
|
||||
function memoizeState(workInProgress, nextState) {
|
||||
workInProgress.memoizedState = nextState;
|
||||
}
|
||||
function beginWork(current, workInProgress, priorityLevel) {
|
||||
if (workInProgress.pendingWorkPriority === NoWork$3 || workInProgress.pendingWorkPriority > priorityLevel) return bailoutOnLowPriority(current, workInProgress);
|
||||
switch (workInProgress.firstEffect = null, workInProgress.lastEffect = null, workInProgress.progressedPriority === priorityLevel && (workInProgress.child = workInProgress.progressedChild),
|
||||
workInProgress.tag) {
|
||||
switch (workInProgress.tag) {
|
||||
case IndeterminateComponent$2:
|
||||
return mountIndeterminateComponent(current, workInProgress, priorityLevel);
|
||||
|
||||
case FunctionalComponent$1:
|
||||
return updateFunctionalComponent(current, workInProgress);
|
||||
|
||||
case ClassComponent$5:
|
||||
case ClassComponent$6:
|
||||
return updateClassComponent(current, workInProgress, priorityLevel);
|
||||
|
||||
case HostRoot$4:
|
||||
case HostRoot$5:
|
||||
return updateHostRoot(current, workInProgress, priorityLevel);
|
||||
|
||||
case HostComponent$6:
|
||||
return updateHostComponent(current, workInProgress);
|
||||
return updateHostComponent(current, workInProgress, priorityLevel);
|
||||
|
||||
case HostText$2:
|
||||
return updateHostText(current, workInProgress);
|
||||
@@ -2346,13 +2297,13 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
}
|
||||
}
|
||||
function beginFailedWork(current, workInProgress, priorityLevel) {
|
||||
if (invariant(workInProgress.tag === ClassComponent$5 || workInProgress.tag === HostRoot$4, "Invalid type of work. This error is likely caused by a bug in React. " + "Please file an issue."),
|
||||
workInProgress.effectTag |= Err$1, workInProgress.pendingWorkPriority === NoWork$3 || workInProgress.pendingWorkPriority > priorityLevel) return bailoutOnLowPriority(current, workInProgress);
|
||||
if (workInProgress.firstEffect = null, workInProgress.lastEffect = null, reconcileChildren(current, workInProgress, null),
|
||||
workInProgress.tag === ClassComponent$5) {
|
||||
if (invariant(workInProgress.tag === ClassComponent$6 || workInProgress.tag === HostRoot$5, "Invalid type of work. This error is likely caused by a bug in React. " + "Please file an issue."),
|
||||
workInProgress.effectTag |= Err$1, null === current ? workInProgress.child = null : workInProgress.child !== current.child && (workInProgress.child = current.child),
|
||||
workInProgress.pendingWorkPriority === NoWork$3 || workInProgress.pendingWorkPriority > priorityLevel) return bailoutOnLowPriority(current, workInProgress);
|
||||
if (workInProgress.firstEffect = null, workInProgress.lastEffect = null, reconcileChildrenAtPriority(current, workInProgress, null, priorityLevel),
|
||||
workInProgress.tag === ClassComponent$6) {
|
||||
var instance = workInProgress.stateNode;
|
||||
workInProgress.memoizedProps = instance.props, workInProgress.memoizedState = instance.state,
|
||||
workInProgress.pendingProps = null;
|
||||
workInProgress.memoizedProps = instance.props, workInProgress.memoizedState = instance.state;
|
||||
}
|
||||
return workInProgress.child;
|
||||
}
|
||||
@@ -2360,12 +2311,8 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
beginWork: beginWork,
|
||||
beginFailedWork: beginFailedWork
|
||||
};
|
||||
}, reconcileChildFibers$2 = ReactChildFiber.reconcileChildFibers, popContextProvider$2 = ReactFiberContext.popContextProvider, IndeterminateComponent$3 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$3 = ReactTypeOfWork.FunctionalComponent, ClassComponent$7 = ReactTypeOfWork.ClassComponent, HostRoot$5 = ReactTypeOfWork.HostRoot, HostComponent$7 = ReactTypeOfWork.HostComponent, HostText$4 = ReactTypeOfWork.HostText, HostPortal$4 = ReactTypeOfWork.HostPortal, CoroutineComponent$3 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase$1 = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$3 = ReactTypeOfWork.YieldComponent, Fragment$3 = ReactTypeOfWork.Fragment, Placement$4 = ReactTypeOfSideEffect.Placement, Ref$2 = ReactTypeOfSideEffect.Ref, Update$2 = ReactTypeOfSideEffect.Update, ReactFiberCompleteWork = function(config, hostContext, hydrationContext) {
|
||||
}, reconcileChildFibers$2 = ReactChildFiber.reconcileChildFibers, popContextProvider$2 = ReactFiberContext.popContextProvider, IndeterminateComponent$3 = ReactTypeOfWork.IndeterminateComponent, FunctionalComponent$3 = ReactTypeOfWork.FunctionalComponent, ClassComponent$8 = ReactTypeOfWork.ClassComponent, HostRoot$6 = ReactTypeOfWork.HostRoot, HostComponent$7 = ReactTypeOfWork.HostComponent, HostText$4 = ReactTypeOfWork.HostText, HostPortal$4 = ReactTypeOfWork.HostPortal, CoroutineComponent$3 = ReactTypeOfWork.CoroutineComponent, CoroutineHandlerPhase$1 = ReactTypeOfWork.CoroutineHandlerPhase, YieldComponent$3 = ReactTypeOfWork.YieldComponent, Fragment$3 = ReactTypeOfWork.Fragment, Placement$4 = ReactTypeOfSideEffect.Placement, Ref$2 = ReactTypeOfSideEffect.Ref, Update$2 = ReactTypeOfSideEffect.Update, OffscreenPriority$2 = ReactPriorityLevel.OffscreenPriority, ReactFiberCompleteWork = function(config, hostContext, hydrationContext) {
|
||||
var createInstance = config.createInstance, createTextInstance = config.createTextInstance, appendInitialChild = config.appendInitialChild, finalizeInitialChildren = config.finalizeInitialChildren, prepareUpdate = config.prepareUpdate, getRootHostContainer = hostContext.getRootHostContainer, popHostContext = hostContext.popHostContext, getHostContext = hostContext.getHostContext, popHostContainer = hostContext.popHostContainer, prepareToHydrateHostInstance = hydrationContext.prepareToHydrateHostInstance, prepareToHydrateHostTextInstance = hydrationContext.prepareToHydrateHostTextInstance, popHydrationState = hydrationContext.popHydrationState;
|
||||
function markChildAsProgressed(current, workInProgress, priorityLevel) {
|
||||
workInProgress.progressedChild = workInProgress.child, workInProgress.progressedPriority = priorityLevel,
|
||||
null !== current && (current.progressedChild = workInProgress.progressedChild, current.progressedPriority = workInProgress.progressedPriority);
|
||||
}
|
||||
function markUpdate(workInProgress) {
|
||||
workInProgress.effectTag |= Update$2;
|
||||
}
|
||||
@@ -2394,7 +2341,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
appendAllYields(yields, workInProgress);
|
||||
var fn = coroutine.handler, props = coroutine.props, nextChildren = fn(props, yields), currentFirstChild = null !== current ? current.child : null, priority = workInProgress.pendingWorkPriority;
|
||||
return workInProgress.child = reconcileChildFibers$2(workInProgress, currentFirstChild, nextChildren, priority),
|
||||
markChildAsProgressed(current, workInProgress, priority), workInProgress.child;
|
||||
workInProgress.child;
|
||||
}
|
||||
function appendAllChildren(parent, workInProgress) {
|
||||
for (var node = workInProgress.child; null !== node; ) {
|
||||
@@ -2410,15 +2357,17 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
node = node.sibling;
|
||||
}
|
||||
}
|
||||
function completeWork(current, workInProgress) {
|
||||
switch (workInProgress.tag) {
|
||||
function completeWork(current, workInProgress, renderPriority) {
|
||||
var newProps = workInProgress.pendingProps;
|
||||
switch (null === newProps ? newProps = workInProgress.memoizedProps : workInProgress.pendingWorkPriority === OffscreenPriority$2 && renderPriority !== OffscreenPriority$2 || (workInProgress.pendingProps = null),
|
||||
workInProgress.tag) {
|
||||
case FunctionalComponent$3:
|
||||
return null;
|
||||
|
||||
case ClassComponent$7:
|
||||
case ClassComponent$8:
|
||||
return popContextProvider$2(workInProgress), null;
|
||||
|
||||
case HostRoot$5:
|
||||
case HostRoot$6:
|
||||
var fiberRoot = workInProgress.stateNode;
|
||||
return fiberRoot.pendingContext && (fiberRoot.context = fiberRoot.pendingContext,
|
||||
fiberRoot.pendingContext = null), null !== current && null !== current.child || (popHydrationState(workInProgress),
|
||||
@@ -2426,7 +2375,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
|
||||
case HostComponent$7:
|
||||
popHostContext(workInProgress);
|
||||
var rootContainerInstance = getRootHostContainer(), type = workInProgress.type, newProps = workInProgress.memoizedProps;
|
||||
var rootContainerInstance = getRootHostContainer(), type = workInProgress.type;
|
||||
if (null !== current && null != workInProgress.stateNode) {
|
||||
var oldProps = current.memoizedProps, instance = workInProgress.stateNode, currentHostContext = getHostContext(), updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
||||
workInProgress.updateQueue = updatePayload, updatePayload && markUpdate(workInProgress),
|
||||
@@ -2445,7 +2394,7 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
|
||||
return null;
|
||||
|
||||
case HostText$4:
|
||||
var newText = workInProgress.memoizedProps;
|
||||
var newText = newProps;
|
||||
if (current && null != workInProgress.stateNode) {
|
||||
current.memoizedProps !== newText && markUpdate(workInProgress);
|
||||
} else {
|
||||
@@ -2500,7 +2449,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
injectInternals: injectInternals_1,
|
||||
onCommitRoot: onCommitRoot_1,
|
||||
onCommitUnmount: onCommitUnmount_1
|
||||
}, ClassComponent$8 = ReactTypeOfWork.ClassComponent, HostRoot$6 = ReactTypeOfWork.HostRoot, HostComponent$8 = ReactTypeOfWork.HostComponent, HostText$5 = ReactTypeOfWork.HostText, HostPortal$5 = ReactTypeOfWork.HostPortal, CoroutineComponent$4 = ReactTypeOfWork.CoroutineComponent, commitCallbacks$1 = ReactFiberUpdateQueue.commitCallbacks, onCommitUnmount = ReactFiberDevToolsHook.onCommitUnmount, Placement$5 = ReactTypeOfSideEffect.Placement, Update$3 = ReactTypeOfSideEffect.Update, Callback$1 = ReactTypeOfSideEffect.Callback, ContentReset$2 = ReactTypeOfSideEffect.ContentReset, ReactFiberCommitWork = function(config, captureError) {
|
||||
}, ClassComponent$9 = ReactTypeOfWork.ClassComponent, HostRoot$7 = ReactTypeOfWork.HostRoot, HostComponent$8 = ReactTypeOfWork.HostComponent, HostText$5 = ReactTypeOfWork.HostText, HostPortal$5 = ReactTypeOfWork.HostPortal, CoroutineComponent$4 = ReactTypeOfWork.CoroutineComponent, commitCallbacks$1 = ReactFiberUpdateQueue.commitCallbacks, onCommitUnmount = ReactFiberDevToolsHook.onCommitUnmount, Placement$5 = ReactTypeOfSideEffect.Placement, Update$3 = ReactTypeOfSideEffect.Update, Callback$1 = ReactTypeOfSideEffect.Callback, ContentReset$2 = ReactTypeOfSideEffect.ContentReset, ReactFiberCommitWork = function(config, captureError) {
|
||||
var commitMount = config.commitMount, commitUpdate = config.commitUpdate, resetTextContent = config.resetTextContent, commitTextUpdate = config.commitTextUpdate, appendChild = config.appendChild, appendChildToContainer = config.appendChildToContainer, insertBefore = config.insertBefore, insertInContainerBefore = config.insertInContainerBefore, removeChild = config.removeChild, removeChildFromContainer = config.removeChildFromContainer, getPublicInstance = config.getPublicInstance;
|
||||
function safelyCallComponentWillUnmount(current, instance) {
|
||||
try {
|
||||
@@ -2527,7 +2476,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
invariant(!1, "Expected to find a host parent. This error is likely caused by a bug " + "in React. Please file an issue.");
|
||||
}
|
||||
function isHostParent(fiber) {
|
||||
return fiber.tag === HostComponent$8 || fiber.tag === HostRoot$6 || fiber.tag === HostPortal$5;
|
||||
return fiber.tag === HostComponent$8 || fiber.tag === HostRoot$7 || fiber.tag === HostPortal$5;
|
||||
}
|
||||
function getHostSibling(fiber) {
|
||||
var node = fiber;
|
||||
@@ -2551,7 +2500,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
parent = parentFiber.stateNode, isContainer = !1;
|
||||
break;
|
||||
|
||||
case HostRoot$6:
|
||||
case HostRoot$7:
|
||||
case HostPortal$5:
|
||||
parent = parentFiber.stateNode.containerInfo, isContainer = !0;
|
||||
break;
|
||||
@@ -2594,7 +2543,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
currentParent = parent.stateNode, currentParentIsContainer = !1;
|
||||
break findParent;
|
||||
|
||||
case HostRoot$6:
|
||||
case HostRoot$7:
|
||||
case HostPortal$5:
|
||||
currentParent = parent.stateNode.containerInfo, currentParentIsContainer = !0;
|
||||
break findParent;
|
||||
@@ -2627,7 +2576,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
}
|
||||
function commitUnmount(current) {
|
||||
switch ("function" == typeof onCommitUnmount && onCommitUnmount(current), current.tag) {
|
||||
case ClassComponent$8:
|
||||
case ClassComponent$9:
|
||||
safelyDetachRef(current);
|
||||
var instance = current.stateNode;
|
||||
return void ("function" == typeof instance.componentWillUnmount && safelyCallComponentWillUnmount(current, instance));
|
||||
@@ -2644,7 +2593,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
}
|
||||
function commitWork(current, finishedWork) {
|
||||
switch (finishedWork.tag) {
|
||||
case ClassComponent$8:
|
||||
case ClassComponent$9:
|
||||
return;
|
||||
|
||||
case HostComponent$8:
|
||||
@@ -2660,7 +2609,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
var textInstance = finishedWork.stateNode, newText = finishedWork.memoizedProps, oldText = null !== current ? current.memoizedProps : newText;
|
||||
return void commitTextUpdate(textInstance, oldText, newText);
|
||||
|
||||
case HostRoot$6:
|
||||
case HostRoot$7:
|
||||
case HostPortal$5:
|
||||
return;
|
||||
|
||||
@@ -2670,7 +2619,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
}
|
||||
function commitLifeCycles(current, finishedWork) {
|
||||
switch (finishedWork.tag) {
|
||||
case ClassComponent$8:
|
||||
case ClassComponent$9:
|
||||
var instance = finishedWork.stateNode;
|
||||
if (finishedWork.effectTag & Update$3) if (null === current) instance.componentDidMount(); else {
|
||||
var prevProps = current.memoizedProps, prevState = current.memoizedState;
|
||||
@@ -2678,7 +2627,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
}
|
||||
return void (finishedWork.effectTag & Callback$1 && null !== finishedWork.updateQueue && commitCallbacks$1(finishedWork, finishedWork.updateQueue, instance));
|
||||
|
||||
case HostRoot$6:
|
||||
case HostRoot$7:
|
||||
var updateQueue = finishedWork.updateQueue;
|
||||
if (null !== updateQueue) {
|
||||
var _instance = finishedWork.child && finishedWork.child.stateNode;
|
||||
@@ -2768,9 +2717,9 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
pushHostContext: pushHostContext,
|
||||
resetHostContainer: resetHostContainer
|
||||
};
|
||||
}, HostComponent$9 = ReactTypeOfWork.HostComponent, HostText$6 = ReactTypeOfWork.HostText, HostRoot$7 = ReactTypeOfWork.HostRoot, Deletion$2 = ReactTypeOfSideEffect.Deletion, Placement$6 = ReactTypeOfSideEffect.Placement, createFiberFromHostInstanceForDeletion$1 = ReactFiber.createFiberFromHostInstanceForDeletion, ReactFiberHydrationContext = function(config) {
|
||||
var shouldSetTextContent = config.shouldSetTextContent, canHydrateInstance = config.canHydrateInstance, canHydrateTextInstance = config.canHydrateTextInstance, getNextHydratableSibling = config.getNextHydratableSibling, getFirstHydratableChild = config.getFirstHydratableChild, hydrateInstance = config.hydrateInstance, hydrateTextInstance = config.hydrateTextInstance;
|
||||
if (!(canHydrateInstance && canHydrateTextInstance && getNextHydratableSibling && getFirstHydratableChild && hydrateInstance && hydrateTextInstance)) return {
|
||||
}, HostComponent$9 = ReactTypeOfWork.HostComponent, HostText$6 = ReactTypeOfWork.HostText, HostRoot$8 = ReactTypeOfWork.HostRoot, Deletion$2 = ReactTypeOfSideEffect.Deletion, Placement$6 = ReactTypeOfSideEffect.Placement, createFiberFromHostInstanceForDeletion$1 = ReactFiber.createFiberFromHostInstanceForDeletion, ReactFiberHydrationContext = function(config) {
|
||||
var shouldSetTextContent = config.shouldSetTextContent, canHydrateInstance = config.canHydrateInstance, canHydrateTextInstance = config.canHydrateTextInstance, getNextHydratableSibling = config.getNextHydratableSibling, getFirstHydratableChild = config.getFirstHydratableChild, hydrateInstance = config.hydrateInstance, hydrateTextInstance = config.hydrateTextInstance, didNotHydrateInstance = config.didNotHydrateInstance, didNotFindHydratableInstance = config.didNotFindHydratableInstance, didNotFindHydratableTextInstance = config.didNotFindHydratableTextInstance;
|
||||
if (!(canHydrateInstance && canHydrateTextInstance && getNextHydratableSibling && getFirstHydratableChild && hydrateInstance && hydrateTextInstance && didNotHydrateInstance && didNotFindHydratableInstance && didNotFindHydratableTextInstance)) return {
|
||||
enterHydrationState: function() {
|
||||
return !1;
|
||||
},
|
||||
@@ -2798,14 +2747,18 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
null !== returnFiber.lastEffect ? (returnFiber.lastEffect.nextEffect = childToDelete,
|
||||
returnFiber.lastEffect = childToDelete) : returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
|
||||
}
|
||||
function insertNonHydratedInstance(returnFiber, fiber) {
|
||||
fiber.effectTag |= Placement$6;
|
||||
}
|
||||
function canHydrate(fiber, nextInstance) {
|
||||
switch (fiber.tag) {
|
||||
case HostComponent$9:
|
||||
var type = fiber.type, props = fiber.memoizedProps;
|
||||
var type = fiber.type, props = fiber.pendingProps;
|
||||
return canHydrateInstance(nextInstance, type, props);
|
||||
|
||||
case HostText$6:
|
||||
return canHydrateTextInstance(nextInstance);
|
||||
var text = fiber.pendingProps;
|
||||
return canHydrateTextInstance(nextInstance, text);
|
||||
|
||||
default:
|
||||
return !1;
|
||||
@@ -2814,9 +2767,10 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
function tryToClaimNextHydratableInstance(fiber) {
|
||||
if (isHydrating) {
|
||||
var nextInstance = nextHydratableInstance;
|
||||
if (!nextInstance) return fiber.effectTag |= Placement$6, isHydrating = !1, void (hydrationParentFiber = fiber);
|
||||
if (!nextInstance) return insertNonHydratedInstance(hydrationParentFiber, fiber),
|
||||
isHydrating = !1, void (hydrationParentFiber = fiber);
|
||||
if (!canHydrate(fiber, nextInstance)) {
|
||||
if (!(nextInstance = getNextHydratableSibling(nextInstance)) || !canHydrate(fiber, nextInstance)) return fiber.effectTag |= Placement$6,
|
||||
if (!(nextInstance = getNextHydratableSibling(nextInstance)) || !canHydrate(fiber, nextInstance)) return insertNonHydratedInstance(hydrationParentFiber, fiber),
|
||||
isHydrating = !1, void (hydrationParentFiber = fiber);
|
||||
deleteHydratableInstance(hydrationParentFiber, nextHydratableInstance);
|
||||
}
|
||||
@@ -2832,7 +2786,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
return hydrateTextInstance(textInstance, fiber.memoizedProps, fiber);
|
||||
}
|
||||
function popToNextHostParent(fiber) {
|
||||
for (var parent = fiber.return; null !== parent && parent.tag !== HostComponent$9 && parent.tag !== HostRoot$7; ) parent = parent.return;
|
||||
for (var parent = fiber.return; null !== parent && parent.tag !== HostComponent$9 && parent.tag !== HostRoot$8; ) parent = parent.return;
|
||||
hydrationParentFiber = parent;
|
||||
}
|
||||
function popHydrationState(fiber) {
|
||||
@@ -2855,7 +2809,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
prepareToHydrateHostTextInstance: prepareToHydrateHostTextInstance,
|
||||
popHydrationState: popHydrationState
|
||||
};
|
||||
}, popContextProvider$1 = ReactFiberContext.popContextProvider, reset$1 = ReactFiberStack.reset, getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber, logCapturedError$1 = ReactFiberErrorLogger.logCapturedError, ReactCurrentOwner$1 = ReactGlobalSharedState_1.ReactCurrentOwner, cloneFiber$1 = ReactFiber.cloneFiber, onCommitRoot = ReactFiberDevToolsHook.onCommitRoot, NoWork$2 = ReactPriorityLevel.NoWork, SynchronousPriority$1 = ReactPriorityLevel.SynchronousPriority, TaskPriority$1 = ReactPriorityLevel.TaskPriority, HighPriority = ReactPriorityLevel.HighPriority, LowPriority = ReactPriorityLevel.LowPriority, OffscreenPriority = ReactPriorityLevel.OffscreenPriority, AsyncUpdates = ReactTypeOfInternalContext.AsyncUpdates, PerformedWork = ReactTypeOfSideEffect.PerformedWork, Placement$1 = ReactTypeOfSideEffect.Placement, Update = ReactTypeOfSideEffect.Update, PlacementAndUpdate = ReactTypeOfSideEffect.PlacementAndUpdate, Deletion = ReactTypeOfSideEffect.Deletion, ContentReset = ReactTypeOfSideEffect.ContentReset, Callback = ReactTypeOfSideEffect.Callback, Err = ReactTypeOfSideEffect.Err, Ref = ReactTypeOfSideEffect.Ref, HostRoot$3 = ReactTypeOfWork.HostRoot, HostComponent$4 = ReactTypeOfWork.HostComponent, HostPortal$1 = ReactTypeOfWork.HostPortal, ClassComponent$3 = ReactTypeOfWork.ClassComponent, getPendingPriority$1 = ReactFiberUpdateQueue.getPendingPriority, _require14 = ReactFiberContext, resetContext$1 = _require14.resetContext, ReactFiberInstrumentation$1, timeHeuristicForUnitOfWork = 1, ReactFiberScheduler = function(config) {
|
||||
}, popContextProvider$1 = ReactFiberContext.popContextProvider, reset$1 = ReactFiberStack.reset, getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber, logCapturedError$1 = ReactFiberErrorLogger.logCapturedError, ReactCurrentOwner$1 = ReactGlobalSharedState_1.ReactCurrentOwner, createWorkInProgress$1 = ReactFiber.createWorkInProgress, largerPriority$1 = ReactFiber.largerPriority, onCommitRoot = ReactFiberDevToolsHook.onCommitRoot, NoWork$2 = ReactPriorityLevel.NoWork, SynchronousPriority$1 = ReactPriorityLevel.SynchronousPriority, TaskPriority$1 = ReactPriorityLevel.TaskPriority, HighPriority = ReactPriorityLevel.HighPriority, LowPriority = ReactPriorityLevel.LowPriority, OffscreenPriority = ReactPriorityLevel.OffscreenPriority, AsyncUpdates = ReactTypeOfInternalContext.AsyncUpdates, PerformedWork = ReactTypeOfSideEffect.PerformedWork, Placement$1 = ReactTypeOfSideEffect.Placement, Update = ReactTypeOfSideEffect.Update, PlacementAndUpdate = ReactTypeOfSideEffect.PlacementAndUpdate, Deletion = ReactTypeOfSideEffect.Deletion, ContentReset = ReactTypeOfSideEffect.ContentReset, Callback = ReactTypeOfSideEffect.Callback, Err = ReactTypeOfSideEffect.Err, Ref = ReactTypeOfSideEffect.Ref, HostRoot$4 = ReactTypeOfWork.HostRoot, HostComponent$4 = ReactTypeOfWork.HostComponent, HostPortal$1 = ReactTypeOfWork.HostPortal, ClassComponent$4 = ReactTypeOfWork.ClassComponent, getUpdatePriority$1 = ReactFiberUpdateQueue.getUpdatePriority, _require14 = ReactFiberContext, resetContext$1 = _require14.resetContext, ReactFiberInstrumentation$1, timeHeuristicForUnitOfWork = 1, ReactFiberScheduler = function(config) {
|
||||
var hostContext = ReactFiberHostContext(config), hydrationContext = ReactFiberHydrationContext(config), popHostContainer = hostContext.popHostContainer, popHostContext = hostContext.popHostContext, resetHostContainer = hostContext.resetHostContainer, _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext), beginWork = _ReactFiberBeginWork.beginWork, beginFailedWork = _ReactFiberBeginWork.beginFailedWork, _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext), completeWork = _ReactFiberCompleteWo.completeWork, _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError), commitPlacement = _ReactFiberCommitWork.commitPlacement, commitDeletion = _ReactFiberCommitWork.commitDeletion, commitWork = _ReactFiberCommitWork.commitWork, commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, commitAttachRef = _ReactFiberCommitWork.commitAttachRef, commitDetachRef = _ReactFiberCommitWork.commitDetachRef, scheduleDeferredCallback = config.scheduleDeferredCallback, useSyncScheduling = config.useSyncScheduling, prepareForCommit = config.prepareForCommit, resetAfterCommit = config.resetAfterCommit, priorityContext = NoWork$2, priorityContextBeforeReconciliation = NoWork$2, isPerformingWork = !1, deadlineHasExpired = !1, isBatchingUpdates = !1, isUnbatchingUpdates = !1, nextUnitOfWork = null, nextPriorityLevel = NoWork$2, nextEffect = null, pendingCommit = null, nextScheduledRoot = null, lastScheduledRoot = null, isCallbackScheduled = !1, capturedErrors = null, failedBoundaries = null, commitPhaseBoundaries = null, firstUncaughtError = null, fatalError = null, isCommitting = !1, isUnmounting = !1;
|
||||
function resetContextStack() {
|
||||
reset$1(), resetContext$1(), resetHostContainer();
|
||||
@@ -2871,7 +2825,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
for (var root = nextScheduledRoot, highestPriorityRoot = null, highestPriorityLevel = NoWork$2; null !== root; ) root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority) && (highestPriorityLevel = root.current.pendingWorkPriority,
|
||||
highestPriorityRoot = root), root = root.nextScheduledRoot;
|
||||
return null !== highestPriorityRoot ? (nextPriorityLevel = highestPriorityLevel,
|
||||
priorityContext = nextPriorityLevel, resetContextStack(), cloneFiber$1(highestPriorityRoot.current, highestPriorityLevel)) : (nextPriorityLevel = NoWork$2,
|
||||
priorityContext = nextPriorityLevel, resetContextStack(), createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel)) : (nextPriorityLevel = NoWork$2,
|
||||
null);
|
||||
}
|
||||
function commitAllHostEffects() {
|
||||
@@ -2950,17 +2904,17 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
commitPhaseBoundaries && (commitPhaseBoundaries.forEach(scheduleErrorRecovery),
|
||||
commitPhaseBoundaries = null), priorityContext = previousPriorityContext;
|
||||
}
|
||||
function resetWorkPriority(workInProgress) {
|
||||
var newPriority = NoWork$2, queue = workInProgress.updateQueue, tag = workInProgress.tag;
|
||||
null === queue || tag !== ClassComponent$3 && tag !== HostRoot$3 || (newPriority = getPendingPriority$1(queue));
|
||||
for (var child = workInProgress.progressedChild; null !== child; ) child.pendingWorkPriority !== NoWork$2 && (newPriority === NoWork$2 || newPriority > child.pendingWorkPriority) && (newPriority = child.pendingWorkPriority),
|
||||
child = child.sibling;
|
||||
workInProgress.pendingWorkPriority = newPriority;
|
||||
function resetWorkPriority(workInProgress, renderPriority) {
|
||||
if (!(workInProgress.pendingWorkPriority !== NoWork$2 && workInProgress.pendingWorkPriority > renderPriority)) {
|
||||
for (var newPriority = getUpdatePriority$1(workInProgress), child = workInProgress.child; null !== child; ) newPriority = largerPriority$1(newPriority, child.pendingWorkPriority),
|
||||
child = child.sibling;
|
||||
workInProgress.pendingWorkPriority = newPriority;
|
||||
}
|
||||
}
|
||||
function completeUnitOfWork(workInProgress) {
|
||||
for (;!0; ) {
|
||||
var current = workInProgress.alternate, next = completeWork(current, workInProgress), returnFiber = workInProgress.return, siblingFiber = workInProgress.sibling;
|
||||
if (resetWorkPriority(workInProgress), null !== next) return !1 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onCompleteWork(workInProgress),
|
||||
var current = workInProgress.alternate, next = completeWork(current, workInProgress, nextPriorityLevel), returnFiber = workInProgress.return, siblingFiber = workInProgress.sibling;
|
||||
if (resetWorkPriority(workInProgress, nextPriorityLevel), null !== next) return !1 && ReactFiberInstrumentation$1.debugTool && ReactFiberInstrumentation$1.debugTool.onCompleteWork(workInProgress),
|
||||
next;
|
||||
if (null !== returnFiber) {
|
||||
null === returnFiber.firstEffect && (returnFiber.firstEffect = workInProgress.firstEffect),
|
||||
@@ -3065,12 +3019,12 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
function captureError(failedWork, error) {
|
||||
ReactCurrentOwner$1.current = null, nextUnitOfWork = null;
|
||||
var boundary = null, errorBoundaryFound = !1, willRetry = !1, errorBoundaryName = null;
|
||||
if (failedWork.tag === HostRoot$3) boundary = failedWork, isFailedBoundary(failedWork) && (fatalError = error); else for (var node = failedWork.return; null !== node && null === boundary; ) {
|
||||
if (node.tag === ClassComponent$3) {
|
||||
if (failedWork.tag === HostRoot$4) boundary = failedWork, isFailedBoundary(failedWork) && (fatalError = error); else for (var node = failedWork.return; null !== node && null === boundary; ) {
|
||||
if (node.tag === ClassComponent$4) {
|
||||
var instance = node.stateNode;
|
||||
"function" == typeof instance.unstable_handleError && (errorBoundaryFound = !0,
|
||||
errorBoundaryName = getComponentName_1(node), boundary = node, willRetry = !0);
|
||||
} else node.tag === HostRoot$3 && (boundary = node);
|
||||
} else node.tag === HostRoot$4 && (boundary = node);
|
||||
if (isFailedBoundary(node)) {
|
||||
if (isUnmounting) return null;
|
||||
if (null !== commitPhaseBoundaries && (commitPhaseBoundaries.has(node) || null !== node.alternate && commitPhaseBoundaries.has(node.alternate))) return null;
|
||||
@@ -3113,13 +3067,13 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
console.error(e);
|
||||
}
|
||||
switch (effectfulFiber.tag) {
|
||||
case ClassComponent$3:
|
||||
case ClassComponent$4:
|
||||
var instance = effectfulFiber.stateNode, info = {
|
||||
componentStack: capturedError.componentStack
|
||||
};
|
||||
return void instance.unstable_handleError(error, info);
|
||||
|
||||
case HostRoot$3:
|
||||
case HostRoot$4:
|
||||
return void (null === firstUncaughtError && (firstUncaughtError = error));
|
||||
|
||||
default:
|
||||
@@ -3129,7 +3083,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
function unwindContexts(from, to) {
|
||||
for (var node = from; null !== node && node !== to && node.alternate !== to; ) {
|
||||
switch (node.tag) {
|
||||
case ClassComponent$3:
|
||||
case ClassComponent$4:
|
||||
popContextProvider$1(node);
|
||||
break;
|
||||
|
||||
@@ -3137,7 +3091,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
popHostContext(node);
|
||||
break;
|
||||
|
||||
case HostRoot$3:
|
||||
case HostRoot$4:
|
||||
case HostPortal$1:
|
||||
popHostContainer(node);
|
||||
}
|
||||
@@ -3154,7 +3108,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
|
||||
if (shouldContinue = !1, (node.pendingWorkPriority === NoWork$2 || node.pendingWorkPriority > priorityLevel) && (shouldContinue = !0,
|
||||
node.pendingWorkPriority = priorityLevel), null !== node.alternate && (node.alternate.pendingWorkPriority === NoWork$2 || node.alternate.pendingWorkPriority > priorityLevel) && (shouldContinue = !0,
|
||||
node.alternate.pendingWorkPriority = priorityLevel), null === node.return) {
|
||||
if (node.tag !== HostRoot$3) return;
|
||||
if (node.tag !== HostRoot$4) return;
|
||||
if (scheduleRoot(node.stateNode, priorityLevel), !isPerformingWork) switch (priorityLevel) {
|
||||
case SynchronousPriority$1:
|
||||
isUnbatchingUpdates ? performWork(SynchronousPriority$1, null) : performWork(TaskPriority$1, null);
|
||||
|
||||
+3181
-2921
File diff suppressed because it is too large
Load Diff
@@ -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() {
|
||||
@@ -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 = {
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var PropTypes = require('prop-types');
|
||||
const PropTypes = require('prop-types');
|
||||
|
||||
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
||||
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
||||
|
||||
var EdgeInsetsPropType = createStrictShapeTypeChecker({
|
||||
const EdgeInsetsPropType = createStrictShapeTypeChecker({
|
||||
top: PropTypes.number,
|
||||
left: PropTypes.number,
|
||||
bottom: PropTypes.number,
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <RCTText/RCTTextInput.h>
|
||||
#import <React/RCTComponent.h>
|
||||
#import <React/RCTView.h>
|
||||
|
||||
#import "RCTTextInput.h"
|
||||
|
||||
@class RCTUITextField;
|
||||
|
||||
@interface RCTTextField : RCTTextInput
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <RCTText/RCTBackedTextInputViewProtocol.h>
|
||||
#import <React/RCTView.h>
|
||||
|
||||
#import "RCTBackedTextInputViewProtocol.h"
|
||||
|
||||
@class RCTBridge;
|
||||
@class RCTEventDispatcher;
|
||||
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <RCTText/RCTTextInput.h>
|
||||
#import <React/RCTView.h>
|
||||
#import <React/UIView+React.h>
|
||||
|
||||
#import "RCTTextInput.h"
|
||||
|
||||
@class RCTBridge;
|
||||
|
||||
@interface RCTTextView : RCTTextInput <UITextViewDelegate>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <RCTText/RCTBackedTextInputViewProtocol.h>
|
||||
#import "RCTBackedTextInputViewProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <RCTText/RCTBackedTextInputViewProtocol.h>
|
||||
#import "RCTBackedTextInputViewProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ const StyleSheetPropType = require('StyleSheetPropType');
|
||||
const TextStylePropTypes = require('TextStylePropTypes');
|
||||
const Touchable = require('Touchable');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
const mergeFast = require('mergeFast');
|
||||
const processColor = require('processColor');
|
||||
@@ -96,7 +97,8 @@ const viewConfig = {
|
||||
*/
|
||||
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
const Text = React.createClass({
|
||||
const Text = createReactClass({
|
||||
displayName: 'Text',
|
||||
propTypes: {
|
||||
/**
|
||||
* When `numberOfLines` is set, this prop defines how text will be truncated.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
var {
|
||||
@@ -22,7 +23,8 @@ var {
|
||||
|
||||
var TestManager = NativeModules.TestManager || NativeModules.SnapshotTestManager;
|
||||
|
||||
var TextUpdateTest = React.createClass({
|
||||
var TextUpdateTest = createReactClass({
|
||||
displayName: 'TextUpdateTest',
|
||||
mixins: [TimerMixin],
|
||||
getInitialState: function() {
|
||||
return {seeMore: true};
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* Creates an array from array like objects.
|
||||
*
|
||||
* https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
|
||||
*/
|
||||
if (!Array.from) {
|
||||
Array.from = function(arrayLike /*, mapFn, thisArg */) {
|
||||
if (arrayLike == null) {
|
||||
throw new TypeError('Object is null or undefined');
|
||||
}
|
||||
|
||||
// Optional args.
|
||||
var mapFn = arguments[1];
|
||||
var thisArg = arguments[2];
|
||||
|
||||
var C = this;
|
||||
var items = Object(arrayLike);
|
||||
var symbolIterator = typeof Symbol === 'function'
|
||||
? Symbol.iterator
|
||||
: '@@iterator';
|
||||
var mapping = typeof mapFn === 'function';
|
||||
var usingIterator = typeof items[symbolIterator] === 'function';
|
||||
var key = 0;
|
||||
var ret;
|
||||
var value;
|
||||
|
||||
if (usingIterator) {
|
||||
ret = typeof C === 'function'
|
||||
? new C()
|
||||
: [];
|
||||
var it = items[symbolIterator]();
|
||||
var next;
|
||||
|
||||
while (!(next = it.next()).done) {
|
||||
value = next.value;
|
||||
|
||||
if (mapping) {
|
||||
value = mapFn.call(thisArg, value, key);
|
||||
}
|
||||
|
||||
ret[key] = value;
|
||||
key += 1;
|
||||
}
|
||||
|
||||
ret.length = key;
|
||||
return ret;
|
||||
}
|
||||
|
||||
var len = items.length;
|
||||
if (isNaN(len) || len < 0) {
|
||||
len = 0;
|
||||
}
|
||||
|
||||
ret = typeof C === 'function'
|
||||
? new C(len)
|
||||
: new Array(len);
|
||||
|
||||
while (key < len) {
|
||||
value = items[key];
|
||||
|
||||
if (mapping) {
|
||||
value = mapFn.call(thisArg, value, key);
|
||||
}
|
||||
|
||||
ret[key] = value;
|
||||
|
||||
key += 1;
|
||||
}
|
||||
|
||||
ret.length = key;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
|
||||
function findIndex(predicate, context) {
|
||||
if (this == null) {
|
||||
throw new TypeError(
|
||||
'Array.prototype.findIndex called on null or undefined'
|
||||
);
|
||||
}
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
var list = Object(this);
|
||||
var length = list.length >>> 0;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (predicate.call(context, list[i], i, list)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Array.prototype.findIndex) {
|
||||
Object.defineProperty(Array.prototype, 'findIndex', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
value: findIndex
|
||||
});
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
|
||||
if (!Array.prototype.find) {
|
||||
Object.defineProperty(Array.prototype, 'find', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
value: function(predicate, context) {
|
||||
if (this == null) {
|
||||
throw new TypeError(
|
||||
'Array.prototype.find called on null or undefined'
|
||||
);
|
||||
}
|
||||
var index = findIndex.call(this, predicate, context);
|
||||
return index === -1 ? undefined : this[index];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
|
||||
if (!Array.prototype.includes) {
|
||||
Object.defineProperty(Array.prototype, 'includes', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
value: function (searchElement) {
|
||||
var O = Object(this);
|
||||
var len = parseInt(O.length) || 0;
|
||||
if (len === 0) {
|
||||
return false;
|
||||
}
|
||||
var n = parseInt(arguments[1]) || 0;
|
||||
var k;
|
||||
if (n >= 0) {
|
||||
k = n;
|
||||
} else {
|
||||
k = len + n;
|
||||
if (k < 0) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
var currentElement;
|
||||
while (k < len) {
|
||||
currentElement = O[k];
|
||||
if (searchElement === currentElement ||
|
||||
(searchElement !== searchElement && currentElement !== currentElement)) {
|
||||
return true;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable strict */
|
||||
|
||||
if (Number.EPSILON === undefined) {
|
||||
Object.defineProperty(Number, 'EPSILON', {
|
||||
value: Math.pow(2, -52),
|
||||
});
|
||||
}
|
||||
if (Number.MAX_SAFE_INTEGER === undefined) {
|
||||
Object.defineProperty(Number, 'MAX_SAFE_INTEGER', {
|
||||
value: Math.pow(2, 53) - 1,
|
||||
});
|
||||
}
|
||||
if (Number.MIN_SAFE_INTEGER === undefined) {
|
||||
Object.defineProperty(Number, 'MIN_SAFE_INTEGER', {
|
||||
value: -(Math.pow(2, 53) - 1),
|
||||
});
|
||||
}
|
||||
if (!Number.isNaN) {
|
||||
// eslint-disable-next-line max-len
|
||||
// https://github.com/dherman/tc39-codex-wiki/blob/master/data/es6/number/index.md#polyfill-for-numberisnan
|
||||
const globalIsNaN = global.isNaN;
|
||||
Object.defineProperty(Number, 'isNaN', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value: function isNaN(value) {
|
||||
return typeof value === 'number' && globalIsNaN(value);
|
||||
},
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable strict */
|
||||
|
||||
// WARNING: This is an optimized version that fails on hasOwnProperty checks
|
||||
// and non objects. It's not spec-compliant. It's a perf optimization.
|
||||
// This is only needed for iOS 8 and current Android JSC.
|
||||
|
||||
Object.assign = function(target, sources) {
|
||||
if (__DEV__) {
|
||||
if (target == null) {
|
||||
throw new TypeError('Object.assign target cannot be null or undefined');
|
||||
}
|
||||
if (typeof target !== 'object' && typeof target !== 'function') {
|
||||
throw new TypeError(
|
||||
'In this environment the target of assign MUST be an object.' +
|
||||
'This error is a performance optimization and not spec compliant.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
|
||||
var nextSource = arguments[nextIndex];
|
||||
if (nextSource == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (typeof nextSource !== 'object' &&
|
||||
typeof nextSource !== 'function') {
|
||||
throw new TypeError(
|
||||
'In this environment the sources for assign MUST be an object.' +
|
||||
'This error is a performance optimization and not spec compliant.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// We don't currently support accessors nor proxies. Therefore this
|
||||
// copy cannot throw. If we ever supported this then we must handle
|
||||
// exceptions and side-effects.
|
||||
|
||||
for (var key in nextSource) {
|
||||
if (__DEV__) {
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
if (!hasOwnProperty.call(nextSource, key)) {
|
||||
throw new TypeError(
|
||||
'One of the sources for assign has an enumerable key on the ' +
|
||||
'prototype chain. Are you trying to assign a prototype property? ' +
|
||||
'We don\'t allow it, as this is an edge case that we do not support. ' +
|
||||
'This error is a performance optimization and not spec compliant.'
|
||||
);
|
||||
}
|
||||
}
|
||||
target[key] = nextSource[key];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Returns an array of the given object's own enumerable entries.
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
||||
*/
|
||||
if (typeof Object.entries !== 'function') {
|
||||
Object.entries = function(object) {
|
||||
// `null` and `undefined` values are not allowed.
|
||||
if (object == null) {
|
||||
throw new TypeError('Object.entries called on non-object');
|
||||
}
|
||||
|
||||
const entries = [];
|
||||
for (const key in object) {
|
||||
if (hasOwnProperty.call(object, key)) {
|
||||
entries.push([key, object[key]]);
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the given object's own enumerable entries.
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
|
||||
*/
|
||||
if (typeof Object.values !== 'function') {
|
||||
Object.values = function(object) {
|
||||
// `null` and `undefined` values are not allowed.
|
||||
if (object == null) {
|
||||
throw new TypeError('Object.values called on non-object');
|
||||
}
|
||||
|
||||
const values = [];
|
||||
for (const key in object) {
|
||||
if (hasOwnProperty.call(object, key)) {
|
||||
values.push(object[key]);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable strict, no-extend-native, no-bitwise */
|
||||
|
||||
/*
|
||||
* NOTE: We use (Number(x) || 0) to replace NaN values with zero.
|
||||
*/
|
||||
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(search) {
|
||||
'use strict';
|
||||
if (this == null) {
|
||||
throw TypeError();
|
||||
}
|
||||
var string = String(this);
|
||||
var pos = arguments.length > 1 ?
|
||||
(Number(arguments[1]) || 0) : 0;
|
||||
var start = Math.min(Math.max(pos, 0), string.length);
|
||||
return string.indexOf(String(search), pos) === start;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.endsWith) {
|
||||
String.prototype.endsWith = function(search) {
|
||||
'use strict';
|
||||
if (this == null) {
|
||||
throw TypeError();
|
||||
}
|
||||
var string = String(this);
|
||||
var stringLength = string.length;
|
||||
var searchString = String(search);
|
||||
var pos = arguments.length > 1 ?
|
||||
(Number(arguments[1]) || 0) : stringLength;
|
||||
var end = Math.min(Math.max(pos, 0), stringLength);
|
||||
var start = end - searchString.length;
|
||||
if (start < 0) {
|
||||
return false;
|
||||
}
|
||||
return string.lastIndexOf(searchString, start) === start;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.repeat) {
|
||||
String.prototype.repeat = function(count) {
|
||||
'use strict';
|
||||
if (this == null) {
|
||||
throw TypeError();
|
||||
}
|
||||
var string = String(this);
|
||||
count = Number(count) || 0;
|
||||
if (count < 0 || count === Infinity) {
|
||||
throw RangeError();
|
||||
}
|
||||
if (count === 1) {
|
||||
return string;
|
||||
}
|
||||
var result = '';
|
||||
while (count) {
|
||||
if (count & 1) {
|
||||
result += string;
|
||||
}
|
||||
if ((count >>= 1)) {
|
||||
string += string;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function(search, start) {
|
||||
'use strict';
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > this.length) {
|
||||
return false;
|
||||
} else {
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @emails oncall+jsinfra
|
||||
*/
|
||||
|
||||
/* eslint-disable fb-www/object-create-only-one-param */
|
||||
|
||||
'use strict';
|
||||
|
||||
describe('Object (ES7)', () => {
|
||||
beforeEach(() => {
|
||||
delete Object.entries;
|
||||
delete Object.values;
|
||||
jest.resetModules();
|
||||
require('../Object.es7');
|
||||
});
|
||||
|
||||
describe('Object.entries', () => {
|
||||
it('should have a length of 1', () => {
|
||||
expect(Object.entries.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should check for type', () => {
|
||||
expect(Object.entries.bind(null, null)).toThrow(TypeError(
|
||||
'Object.entries called on non-object'
|
||||
));
|
||||
expect(Object.entries.bind(null, undefined)).toThrow(TypeError(
|
||||
'Object.entries called on non-object'
|
||||
));
|
||||
expect(Object.entries.bind(null, [])).not.toThrow();
|
||||
expect(Object.entries.bind(null, () => {})).not.toThrow();
|
||||
expect(Object.entries.bind(null, {})).not.toThrow();
|
||||
expect(Object.entries.bind(null, 'abc')).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return enumerable entries', () => {
|
||||
const foo = Object.defineProperties({}, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.entries(foo)).toEqual([['x', 10]]);
|
||||
|
||||
const bar = {x: 10, y: 20};
|
||||
expect(Object.entries(bar)).toEqual([['x', 10], ['y', 20]]);
|
||||
});
|
||||
|
||||
it('should work with proto-less objects', () => {
|
||||
const foo = Object.create(null, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.entries(foo)).toEqual([['x', 10]]);
|
||||
});
|
||||
|
||||
it('should return only own entries', () => {
|
||||
const foo = Object.create({z: 30}, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.entries(foo)).toEqual([['x', 10]]);
|
||||
});
|
||||
|
||||
it('should convert to object primitive string', () => {
|
||||
expect(Object.entries('ab')).toEqual([['0', 'a'], ['1', 'b']]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Object.values', () => {
|
||||
it('should have a length of 1', () => {
|
||||
expect(Object.values.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should check for type', () => {
|
||||
expect(Object.values.bind(null, null)).toThrow(TypeError(
|
||||
'Object.values called on non-object'
|
||||
));
|
||||
expect(Object.values.bind(null, [])).not.toThrow();
|
||||
expect(Object.values.bind(null, () => {})).not.toThrow();
|
||||
expect(Object.values.bind(null, {})).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return enumerable values', () => {
|
||||
const foo = Object.defineProperties({}, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.values(foo)).toEqual([10]);
|
||||
|
||||
const bar = {x: 10, y: 20};
|
||||
expect(Object.values(bar)).toEqual([10, 20]);
|
||||
});
|
||||
|
||||
it('should work with proto-less objects', () => {
|
||||
const foo = Object.create(null, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.values(foo)).toEqual([10]);
|
||||
});
|
||||
|
||||
it('should return only own values', () => {
|
||||
const foo = Object.create({z: 30}, {
|
||||
x: {value: 10, enumerable: true},
|
||||
y: {value: 20},
|
||||
});
|
||||
|
||||
expect(Object.values(foo)).toEqual([10]);
|
||||
});
|
||||
|
||||
it('should convert to object primitive string', () => {
|
||||
expect(Object.values('ab')).toEqual(['a', 'b']);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// Created by running:
|
||||
// require('babel-core').buildExternalHelpers('_extends classCallCheck createClass createRawReactElement defineProperty get inherits interopRequireDefault interopRequireWildcard objectWithoutProperties possibleConstructorReturn slicedToArray taggedTemplateLiteral toArray toConsumableArray '.split(' '))
|
||||
// then replacing the `global` reference in the last line to also use `this`.
|
||||
//
|
||||
// actually, that's a lie, because babel6 omits _extends and createRawReactElement
|
||||
|
||||
var babelHelpers = global.babelHelpers = {};
|
||||
|
||||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
babelHelpers.createRawReactElement = (function () {
|
||||
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
|
||||
return function createRawReactElement(type, key, props) {
|
||||
return {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
ref: null,
|
||||
props: props,
|
||||
_owner: null
|
||||
};
|
||||
};
|
||||
})();
|
||||
|
||||
babelHelpers.classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
babelHelpers.createClass = (function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
})();
|
||||
|
||||
babelHelpers.defineEnumerableProperties = function(obj, descs) {
|
||||
for (var key in descs) {
|
||||
var desc = descs[key];
|
||||
desc.configurable = (desc.enumerable = true);
|
||||
if ('value' in desc) desc.writable = true;
|
||||
Object.defineProperty(obj, key, desc);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
babelHelpers.defineProperty = function (obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
babelHelpers._extends = babelHelpers.extends = Object.assign || function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
babelHelpers.get = function get(object, property, receiver) {
|
||||
if (object === null) object = Function.prototype;
|
||||
var desc = Object.getOwnPropertyDescriptor(object, property);
|
||||
|
||||
if (desc === undefined) {
|
||||
var parent = Object.getPrototypeOf(object);
|
||||
|
||||
if (parent === null) {
|
||||
return undefined;
|
||||
} else {
|
||||
return get(parent, property, receiver);
|
||||
}
|
||||
} else if ("value" in desc) {
|
||||
return desc.value;
|
||||
} else {
|
||||
var getter = desc.get;
|
||||
|
||||
if (getter === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getter.call(receiver);
|
||||
}
|
||||
};
|
||||
|
||||
babelHelpers.inherits = function (subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
};
|
||||
|
||||
babelHelpers.interopRequireDefault = function (obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
};
|
||||
|
||||
babelHelpers.interopRequireWildcard = function (obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
};
|
||||
|
||||
babelHelpers.objectWithoutProperties = function (obj, keys) {
|
||||
var target = {};
|
||||
|
||||
for (var i in obj) {
|
||||
if (keys.indexOf(i) >= 0) continue;
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
||||
target[i] = obj[i];
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
babelHelpers.possibleConstructorReturn = function (self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||||
};
|
||||
|
||||
babelHelpers.slicedToArray = (function () {
|
||||
function sliceIterator(arr, i) {
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
var _e = undefined;
|
||||
|
||||
try {
|
||||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
||||
_arr.push(_s.value);
|
||||
|
||||
if (i && _arr.length === i) break;
|
||||
}
|
||||
} catch (err) {
|
||||
_d = true;
|
||||
_e = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_n && _i["return"]) _i["return"]();
|
||||
} finally {
|
||||
if (_d) throw _e;
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
}
|
||||
|
||||
return function (arr, i) {
|
||||
if (Array.isArray(arr)) {
|
||||
return arr;
|
||||
} else if (Symbol.iterator in Object(arr)) {
|
||||
return sliceIterator(arr, i);
|
||||
} else {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
babelHelpers.taggedTemplateLiteral = function (strings, raw) {
|
||||
return Object.freeze(Object.defineProperties(strings, {
|
||||
raw: {
|
||||
value: Object.freeze(raw)
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
babelHelpers.toArray = function (arr) {
|
||||
return Array.isArray(arr) ? arr : Array.from(arr);
|
||||
};
|
||||
|
||||
babelHelpers.toConsumableArray = function (arr) {
|
||||
if (Array.isArray(arr)) {
|
||||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
||||
|
||||
return arr2;
|
||||
} else {
|
||||
return Array.from(arr);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,515 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
* @nolint
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* This pipes all of our console logging functions to native logging so that
|
||||
* JavaScript errors in required modules show up in Xcode via NSLog.
|
||||
*/
|
||||
const inspect = (function() {
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// https://github.com/joyent/node/blob/master/lib/util.js
|
||||
|
||||
function inspect(obj, opts) {
|
||||
var ctx = {
|
||||
seen: [],
|
||||
stylize: stylizeNoColor
|
||||
};
|
||||
return formatValue(ctx, obj, opts.depth);
|
||||
}
|
||||
|
||||
function stylizeNoColor(str, styleType) {
|
||||
return str;
|
||||
}
|
||||
|
||||
function arrayToHash(array) {
|
||||
var hash = {};
|
||||
|
||||
array.forEach(function(val, idx) {
|
||||
hash[val] = true;
|
||||
});
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
function formatValue(ctx, value, recurseTimes) {
|
||||
// Primitive types cannot have properties
|
||||
var primitive = formatPrimitive(ctx, value);
|
||||
if (primitive) {
|
||||
return primitive;
|
||||
}
|
||||
|
||||
// Look up the keys of the object.
|
||||
var keys = Object.keys(value);
|
||||
var visibleKeys = arrayToHash(keys);
|
||||
|
||||
// IE doesn't make error fields non-enumerable
|
||||
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
||||
if (isError(value)
|
||||
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
||||
return formatError(value);
|
||||
}
|
||||
|
||||
// Some type of object without properties can be shortcutted.
|
||||
if (keys.length === 0) {
|
||||
if (isFunction(value)) {
|
||||
var name = value.name ? ': ' + value.name : '';
|
||||
return ctx.stylize('[Function' + name + ']', 'special');
|
||||
}
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
}
|
||||
if (isDate(value)) {
|
||||
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
}
|
||||
if (isError(value)) {
|
||||
return formatError(value);
|
||||
}
|
||||
}
|
||||
|
||||
var base = '', array = false, braces = ['{', '}'];
|
||||
|
||||
// Make Array say that they are Array
|
||||
if (isArray(value)) {
|
||||
array = true;
|
||||
braces = ['[', ']'];
|
||||
}
|
||||
|
||||
// Make functions say that they are functions
|
||||
if (isFunction(value)) {
|
||||
var n = value.name ? ': ' + value.name : '';
|
||||
base = ' [Function' + n + ']';
|
||||
}
|
||||
|
||||
// Make RegExps say that they are RegExps
|
||||
if (isRegExp(value)) {
|
||||
base = ' ' + RegExp.prototype.toString.call(value);
|
||||
}
|
||||
|
||||
// Make dates with properties first say the date
|
||||
if (isDate(value)) {
|
||||
base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
}
|
||||
|
||||
// Make error with message first say the error
|
||||
if (isError(value)) {
|
||||
base = ' ' + formatError(value);
|
||||
}
|
||||
|
||||
if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
return braces[0] + base + braces[1];
|
||||
}
|
||||
|
||||
if (recurseTimes < 0) {
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
} else {
|
||||
return ctx.stylize('[Object]', 'special');
|
||||
}
|
||||
}
|
||||
|
||||
ctx.seen.push(value);
|
||||
|
||||
var output;
|
||||
if (array) {
|
||||
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
} else {
|
||||
output = keys.map(function(key) {
|
||||
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
});
|
||||
}
|
||||
|
||||
ctx.seen.pop();
|
||||
|
||||
return reduceToSingleString(output, base, braces);
|
||||
}
|
||||
|
||||
|
||||
function formatPrimitive(ctx, value) {
|
||||
if (isUndefined(value))
|
||||
return ctx.stylize('undefined', 'undefined');
|
||||
if (isString(value)) {
|
||||
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"') + '\'';
|
||||
return ctx.stylize(simple, 'string');
|
||||
}
|
||||
if (isNumber(value))
|
||||
return ctx.stylize('' + value, 'number');
|
||||
if (isBoolean(value))
|
||||
return ctx.stylize('' + value, 'boolean');
|
||||
// For some reason typeof null is "object", so special case here.
|
||||
if (isNull(value))
|
||||
return ctx.stylize('null', 'null');
|
||||
}
|
||||
|
||||
|
||||
function formatError(value) {
|
||||
return '[' + Error.prototype.toString.call(value) + ']';
|
||||
}
|
||||
|
||||
|
||||
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
var output = [];
|
||||
for (var i = 0, l = value.length; i < l; ++i) {
|
||||
if (hasOwnProperty(value, String(i))) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
String(i), true));
|
||||
} else {
|
||||
output.push('');
|
||||
}
|
||||
}
|
||||
keys.forEach(function(key) {
|
||||
if (!key.match(/^\d+$/)) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
key, true));
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
var name, str, desc;
|
||||
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
if (desc.get) {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
} else {
|
||||
str = ctx.stylize('[Getter]', 'special');
|
||||
}
|
||||
} else {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Setter]', 'special');
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(visibleKeys, key)) {
|
||||
name = '[' + key + ']';
|
||||
}
|
||||
if (!str) {
|
||||
if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
if (isNull(recurseTimes)) {
|
||||
str = formatValue(ctx, desc.value, null);
|
||||
} else {
|
||||
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
}
|
||||
if (str.indexOf('\n') > -1) {
|
||||
if (array) {
|
||||
str = str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n').substr(2);
|
||||
} else {
|
||||
str = '\n' + str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
str = ctx.stylize('[Circular]', 'special');
|
||||
}
|
||||
}
|
||||
if (isUndefined(name)) {
|
||||
if (array && key.match(/^\d+$/)) {
|
||||
return str;
|
||||
}
|
||||
name = JSON.stringify('' + key);
|
||||
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
name = name.substr(1, name.length - 2);
|
||||
name = ctx.stylize(name, 'name');
|
||||
} else {
|
||||
name = name.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/(^"|"$)/g, "'");
|
||||
name = ctx.stylize(name, 'string');
|
||||
}
|
||||
}
|
||||
|
||||
return name + ': ' + str;
|
||||
}
|
||||
|
||||
|
||||
function reduceToSingleString(output, base, braces) {
|
||||
var numLinesEst = 0;
|
||||
var length = output.reduce(function(prev, cur) {
|
||||
numLinesEst++;
|
||||
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
}, 0);
|
||||
|
||||
if (length > 60) {
|
||||
return braces[0] +
|
||||
(base === '' ? '' : base + '\n ') +
|
||||
' ' +
|
||||
output.join(',\n ') +
|
||||
' ' +
|
||||
braces[1];
|
||||
}
|
||||
|
||||
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
}
|
||||
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
return Array.isArray(ar);
|
||||
}
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
|
||||
function isRegExp(re) {
|
||||
return isObject(re) && objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
|
||||
function isDate(d) {
|
||||
return isObject(d) && objectToString(d) === '[object Date]';
|
||||
}
|
||||
|
||||
function isError(e) {
|
||||
return isObject(e) &&
|
||||
(objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
|
||||
function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
return inspect;
|
||||
})();
|
||||
|
||||
|
||||
const OBJECT_COLUMN_NAME = '(index)';
|
||||
const LOG_LEVELS = {
|
||||
trace: 0,
|
||||
info: 1,
|
||||
warn: 2,
|
||||
error: 3
|
||||
};
|
||||
const INSPECTOR_LEVELS = [];
|
||||
INSPECTOR_LEVELS[LOG_LEVELS.trace] = 'debug';
|
||||
INSPECTOR_LEVELS[LOG_LEVELS.info] = 'log';
|
||||
INSPECTOR_LEVELS[LOG_LEVELS.warn] = 'warning';
|
||||
INSPECTOR_LEVELS[LOG_LEVELS.error] = 'error';
|
||||
|
||||
// Strip the inner function in getNativeLogFunction(), if in dev also
|
||||
// strip method printing to originalConsole.
|
||||
const INSPECTOR_FRAMES_TO_SKIP = __DEV__ ? 2 : 1;
|
||||
|
||||
if (global.nativeLoggingHook) {
|
||||
function getNativeLogFunction(level) {
|
||||
return function() {
|
||||
let str;
|
||||
if (arguments.length === 1 && typeof arguments[0] === 'string') {
|
||||
str = arguments[0];
|
||||
} else {
|
||||
str = Array.prototype.map.call(arguments, function(arg) {
|
||||
return inspect(arg, {depth: 10});
|
||||
}).join(', ');
|
||||
}
|
||||
|
||||
let logLevel = level;
|
||||
if (str.slice(0, 9) === 'Warning: ' && logLevel >= LOG_LEVELS.error) {
|
||||
// React warnings use console.error so that a stack trace is shown,
|
||||
// but we don't (currently) want these to show a redbox
|
||||
// (Note: Logic duplicated in ExceptionsManager.js.)
|
||||
logLevel = LOG_LEVELS.warn;
|
||||
}
|
||||
if (global.__inspectorLog) {
|
||||
global.__inspectorLog(
|
||||
INSPECTOR_LEVELS[logLevel],
|
||||
str,
|
||||
[].slice.call(arguments),
|
||||
INSPECTOR_FRAMES_TO_SKIP);
|
||||
}
|
||||
global.nativeLoggingHook(str, logLevel);
|
||||
};
|
||||
}
|
||||
|
||||
function repeat(element, n) {
|
||||
return Array.apply(null, Array(n)).map(function() { return element; });
|
||||
};
|
||||
|
||||
function consoleTablePolyfill(rows) {
|
||||
// convert object -> array
|
||||
if (!Array.isArray(rows)) {
|
||||
var data = rows;
|
||||
rows = [];
|
||||
for (var key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
var row = data[key];
|
||||
row[OBJECT_COLUMN_NAME] = key;
|
||||
rows.push(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rows.length === 0) {
|
||||
global.nativeLoggingHook('', LOG_LEVELS.info);
|
||||
return;
|
||||
}
|
||||
|
||||
var columns = Object.keys(rows[0]).sort();
|
||||
var stringRows = [];
|
||||
var columnWidths = [];
|
||||
|
||||
// Convert each cell to a string. Also
|
||||
// figure out max cell width for each column
|
||||
columns.forEach(function(k, i) {
|
||||
columnWidths[i] = k.length;
|
||||
for (var j = 0; j < rows.length; j++) {
|
||||
var cellStr = (rows[j][k] || '?').toString();
|
||||
stringRows[j] = stringRows[j] || [];
|
||||
stringRows[j][i] = cellStr;
|
||||
columnWidths[i] = Math.max(columnWidths[i], cellStr.length);
|
||||
}
|
||||
});
|
||||
|
||||
// Join all elements in the row into a single string with | separators
|
||||
// (appends extra spaces to each cell to make separators | alligned)
|
||||
function joinRow(row, space) {
|
||||
var cells = row.map(function(cell, i) {
|
||||
var extraSpaces = repeat(' ', columnWidths[i] - cell.length).join('');
|
||||
return cell + extraSpaces;
|
||||
});
|
||||
space = space || ' ';
|
||||
return cells.join(space + '|' + space);
|
||||
};
|
||||
|
||||
var separators = columnWidths.map(function(columnWidth) {
|
||||
return repeat('-', columnWidth).join('');
|
||||
});
|
||||
var separatorRow = joinRow(separators, '-');
|
||||
var header = joinRow(columns);
|
||||
var table = [header, separatorRow];
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
table.push(joinRow(stringRows[i]));
|
||||
}
|
||||
|
||||
// Notice extra empty line at the beginning.
|
||||
// Native logging hook adds "RCTLog >" at the front of every
|
||||
// logged string, which would shift the header and screw up
|
||||
// the table
|
||||
global.nativeLoggingHook('\n' + table.join('\n'), LOG_LEVELS.info);
|
||||
}
|
||||
|
||||
const originalConsole = global.console;
|
||||
global.console = {
|
||||
error: getNativeLogFunction(LOG_LEVELS.error),
|
||||
info: getNativeLogFunction(LOG_LEVELS.info),
|
||||
log: getNativeLogFunction(LOG_LEVELS.info),
|
||||
warn: getNativeLogFunction(LOG_LEVELS.warn),
|
||||
trace: getNativeLogFunction(LOG_LEVELS.trace),
|
||||
debug: getNativeLogFunction(LOG_LEVELS.trace),
|
||||
table: consoleTablePolyfill
|
||||
};
|
||||
|
||||
// If available, also call the original `console` method since that is
|
||||
// sometimes useful. Ex: on OS X, this will let you see rich output in
|
||||
// the Safari Web Inspector console.
|
||||
if (__DEV__ && originalConsole) {
|
||||
// Preserve the original `console` as `originalConsole`
|
||||
const descriptor = Object.getOwnPropertyDescriptor(global, 'console');
|
||||
if (descriptor) {
|
||||
Object.defineProperty(global, 'originalConsole', descriptor);
|
||||
}
|
||||
|
||||
Object.keys(console).forEach(methodName => {
|
||||
const reactNativeMethod = console[methodName];
|
||||
if (originalConsole[methodName]) {
|
||||
console[methodName] = function() {
|
||||
originalConsole[methodName](...arguments);
|
||||
reactNativeMethod.apply(console, arguments);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (!global.console) {
|
||||
function consoleLoggingStub() {};
|
||||
global.console = {
|
||||
error: consoleLoggingStub,
|
||||
info: consoleLoggingStub,
|
||||
log: consoleLoggingStub,
|
||||
warn: consoleLoggingStub,
|
||||
trace: consoleLoggingStub,
|
||||
debug: consoleLoggingStub,
|
||||
table: consoleLoggingStub
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @polyfill
|
||||
*/
|
||||
|
||||
/* eslint-disable strict */
|
||||
|
||||
let _inGuard = 0;
|
||||
|
||||
/**
|
||||
* This is the error handler that is called when we encounter an exception
|
||||
* when loading a module. This will report any errors encountered before
|
||||
* ExceptionsManager is configured.
|
||||
*/
|
||||
let _globalHandler = function onError(e) {
|
||||
throw e;
|
||||
};
|
||||
|
||||
/**
|
||||
* The particular require runtime that we are using looks for a global
|
||||
* `ErrorUtils` object and if it exists, then it requires modules with the
|
||||
* error handler specified via ErrorUtils.setGlobalHandler by calling the
|
||||
* require function with applyWithGuard. Since the require module is loaded
|
||||
* before any of the modules, this ErrorUtils must be defined (and the handler
|
||||
* set) globally before requiring anything.
|
||||
*/
|
||||
const ErrorUtils = {
|
||||
setGlobalHandler(fun) {
|
||||
_globalHandler = fun;
|
||||
},
|
||||
getGlobalHandler() {
|
||||
return _globalHandler;
|
||||
},
|
||||
reportError(error) {
|
||||
_globalHandler && _globalHandler(error);
|
||||
},
|
||||
reportFatalError(error) {
|
||||
_globalHandler && _globalHandler(error, true);
|
||||
},
|
||||
applyWithGuard(fun, context, args) {
|
||||
try {
|
||||
_inGuard++;
|
||||
return fun.apply(context, args);
|
||||
} catch (e) {
|
||||
ErrorUtils.reportError(e);
|
||||
} finally {
|
||||
_inGuard--;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
applyWithGuardIfNeeded(fun, context, args) {
|
||||
if (ErrorUtils.inGuard()) {
|
||||
return fun.apply(context, args);
|
||||
} else {
|
||||
ErrorUtils.applyWithGuard(fun, context, args);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
inGuard() {
|
||||
return _inGuard;
|
||||
},
|
||||
guard(fun, name, context) {
|
||||
if (typeof fun !== 'function') {
|
||||
console.warn('A function must be passed to ErrorUtils.guard, got ', fun);
|
||||
return null;
|
||||
}
|
||||
name = name || fun.name || '<generated guard>';
|
||||
function guarded() {
|
||||
return (
|
||||
ErrorUtils.applyWithGuard(
|
||||
fun,
|
||||
context || this,
|
||||
arguments,
|
||||
null,
|
||||
name
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return guarded;
|
||||
},
|
||||
};
|
||||
|
||||
global.ErrorUtils = ErrorUtils;
|
||||
@@ -29,6 +29,7 @@ const ReactNative = {
|
||||
get ImageStore() { return require('ImageStore'); },
|
||||
get KeyboardAvoidingView() { return require('KeyboardAvoidingView'); },
|
||||
get ListView() { return require('ListView'); },
|
||||
get MaskedViewIOS() { return require('MaskedViewIOS'); },
|
||||
get Modal() { return require('Modal'); },
|
||||
get NavigatorIOS() { return require('NavigatorIOS'); },
|
||||
get Picker() { return require('Picker'); },
|
||||
|
||||
@@ -15,6 +15,7 @@ android_library(
|
||||
deps = [
|
||||
":res",
|
||||
react_native_dep("third-party/android/support/v4:lib-support-v4"),
|
||||
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react:react"),
|
||||
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
const PropTypes = require('prop-types');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
@@ -71,7 +72,8 @@ var propTypes = {
|
||||
|
||||
};
|
||||
|
||||
var CameraRollView = React.createClass({
|
||||
var CameraRollView = createReactClass({
|
||||
displayName: 'CameraRollView',
|
||||
// $FlowFixMe(>=0.41.0)
|
||||
propTypes: propTypes,
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
ActivityIndicator,
|
||||
@@ -29,7 +30,8 @@ var ImageCapInsetsExample = require('./ImageCapInsetsExample');
|
||||
const IMAGE_PREFETCH_URL = 'http://origami.design/public/images/bird-logo.png?r=1&t=' + Date.now();
|
||||
var prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL);
|
||||
|
||||
var NetworkImageCallbackExample = React.createClass({
|
||||
var NetworkImageCallbackExample = createReactClass({
|
||||
displayName: 'NetworkImageCallbackExample',
|
||||
getInitialState: function() {
|
||||
return {
|
||||
events: [],
|
||||
@@ -102,7 +104,7 @@ var NetworkImageCallbackExample = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var NetworkImageExample = React.createClass({
|
||||
var NetworkImageExample = createReactClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
error: false,
|
||||
@@ -130,7 +132,7 @@ var NetworkImageExample = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var ImageSizeExample = React.createClass({
|
||||
var ImageSizeExample = createReactClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
width: 0,
|
||||
@@ -162,7 +164,7 @@ var ImageSizeExample = React.createClass({
|
||||
},
|
||||
});
|
||||
|
||||
var MultipleSourcesExample = React.createClass({
|
||||
var MultipleSourcesExample = createReactClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
width: 30,
|
||||
|
||||
@@ -21,25 +21,14 @@ var {
|
||||
View,
|
||||
} = ReactNative;
|
||||
|
||||
type Layout = {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
type LayoutEvent = {
|
||||
nativeEvent: {
|
||||
layout: Layout,
|
||||
};
|
||||
};
|
||||
import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes';
|
||||
|
||||
type State = {
|
||||
containerStyle?: { width: number },
|
||||
extraText?: string,
|
||||
imageLayout?: Layout,
|
||||
textLayout?: Layout,
|
||||
viewLayout?: Layout,
|
||||
imageLayout?: ViewLayout,
|
||||
textLayout?: ViewLayout,
|
||||
viewLayout?: ViewLayout,
|
||||
viewStyle: { margin: number },
|
||||
};
|
||||
|
||||
@@ -76,17 +65,17 @@ class LayoutEventExample extends React.Component {
|
||||
this.setState({containerStyle: {width: 280}});
|
||||
};
|
||||
|
||||
onViewLayout = (e: LayoutEvent) => {
|
||||
onViewLayout = (e: ViewLayoutEvent) => {
|
||||
console.log('received view layout event\n', e.nativeEvent);
|
||||
this.setState({viewLayout: e.nativeEvent.layout});
|
||||
};
|
||||
|
||||
onTextLayout = (e: LayoutEvent) => {
|
||||
onTextLayout = (e: ViewLayoutEvent) => {
|
||||
console.log('received text layout event\n', e.nativeEvent);
|
||||
this.setState({textLayout: e.nativeEvent.layout});
|
||||
};
|
||||
|
||||
onImageLayout = (e: LayoutEvent) => {
|
||||
onImageLayout = (e: ViewLayoutEvent) => {
|
||||
console.log('received image layout event\n', e.nativeEvent);
|
||||
this.setState({imageLayout: e.nativeEvent.layout});
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
Image,
|
||||
@@ -24,7 +25,8 @@ var {
|
||||
|
||||
var RNTesterPage = require('./RNTesterPage');
|
||||
|
||||
var ListViewSimpleExample = React.createClass({
|
||||
var ListViewSimpleExample = createReactClass({
|
||||
displayName: 'ListViewSimpleExample',
|
||||
statics: {
|
||||
title: '<ListView>',
|
||||
description: 'Performant, scrollable list of data.'
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
Image,
|
||||
@@ -37,7 +38,8 @@ var THUMB_URLS = [
|
||||
require('./Thumbnails/victory.png'),
|
||||
];
|
||||
|
||||
var ListViewGridLayoutExample = React.createClass({
|
||||
var ListViewGridLayoutExample = createReactClass({
|
||||
displayName: 'ListViewGridLayoutExample',
|
||||
|
||||
statics: {
|
||||
title: '<ListView> - Grid Layout',
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @flow
|
||||
* @providesModule MaskedViewExample
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const RNTesterBlock = require('RNTesterBlock');
|
||||
const RNTesterPage = require('RNTesterPage');
|
||||
const {
|
||||
Animated,
|
||||
Image,
|
||||
MaskedViewIOS,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} = require('react-native');
|
||||
|
||||
class MaskedViewExample extends React.Component {
|
||||
static title = '<MaskedViewIOS>';
|
||||
static description = 'Renders the child view with a mask specified in the `renderMask` prop.';
|
||||
|
||||
state = {
|
||||
alternateChildren: true,
|
||||
};
|
||||
|
||||
_maskRotateAnimatedValue = new Animated.Value(0);
|
||||
_maskScaleAnimatedValue = new Animated.Value(1);
|
||||
|
||||
componentDidMount() {
|
||||
setInterval(() => {
|
||||
this.setState(state => ({
|
||||
alternateChildren: !state.alternateChildren,
|
||||
}));
|
||||
}, 1000);
|
||||
|
||||
Animated.loop(
|
||||
Animated.sequence([
|
||||
Animated.timing(this._maskScaleAnimatedValue, {
|
||||
toValue: 1.3,
|
||||
timing: 750,
|
||||
useNativeDriver: true,
|
||||
}),
|
||||
Animated.timing(this._maskScaleAnimatedValue, {
|
||||
toValue: 1,
|
||||
timing: 750,
|
||||
useNativeDriver: true,
|
||||
}),
|
||||
])
|
||||
).start();
|
||||
|
||||
Animated.loop(
|
||||
Animated.timing(this._maskRotateAnimatedValue, {
|
||||
toValue: 360,
|
||||
timing: 2000,
|
||||
useNativeDriver: true,
|
||||
})
|
||||
).start();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<RNTesterPage title="<MaskedViewIOS>">
|
||||
<RNTesterBlock title="Basic Mask">
|
||||
<View style={{ width: 300, height: 300, alignSelf: 'center' }}>
|
||||
<MaskedViewIOS
|
||||
style={{ flex: 1 }}
|
||||
maskElement={
|
||||
<View style={styles.maskContainerStyle}>
|
||||
<Text style={styles.maskTextStyle}>
|
||||
Basic Mask
|
||||
</Text>
|
||||
</View>
|
||||
}>
|
||||
<View style={{ flex: 1, backgroundColor: 'blue' }} />
|
||||
<View style={{ flex: 1, backgroundColor: 'red' }} />
|
||||
</MaskedViewIOS>
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Image Mask">
|
||||
<View
|
||||
style={{
|
||||
width: 300,
|
||||
height: 300,
|
||||
alignSelf: 'center',
|
||||
backgroundColor: '#eeeeee',
|
||||
}}>
|
||||
<MaskedViewIOS
|
||||
style={{ flex: 1 }}
|
||||
maskElement={
|
||||
<View style={styles.maskContainerStyle}>
|
||||
<Image
|
||||
style={{ height: 200, width: 200 }}
|
||||
source={require('./imageMask.png')}
|
||||
/>
|
||||
</View>
|
||||
}>
|
||||
<View style={styles.maskContainerStyle}>
|
||||
<Image
|
||||
resizeMode="cover"
|
||||
style={{ width: 200, height: 200 }}
|
||||
source={{
|
||||
uri:
|
||||
'https://38.media.tumblr.com/9e9bd08c6e2d10561dd1fb4197df4c4e/tumblr_mfqekpMktw1rn90umo1_500.gif',
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</MaskedViewIOS>
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Animated Mask">
|
||||
<View style={{ width: 300, height: 300, alignSelf: 'center' }}>
|
||||
<MaskedViewIOS
|
||||
style={{ flex: 1 }}
|
||||
maskElement={
|
||||
<Animated.View
|
||||
style={[
|
||||
styles.maskContainerStyle,
|
||||
{ transform: [{ scale: this._maskScaleAnimatedValue }] },
|
||||
]}>
|
||||
<Text style={styles.maskTextStyle}>
|
||||
Basic Mask
|
||||
</Text>
|
||||
</Animated.View>
|
||||
}>
|
||||
<Animated.View
|
||||
style={{
|
||||
flex: 1,
|
||||
transform: [
|
||||
{
|
||||
rotate: this._maskRotateAnimatedValue.interpolate({
|
||||
inputRange: [0, 360],
|
||||
outputRange: ['0deg', '360deg'],
|
||||
}),
|
||||
},
|
||||
],
|
||||
}}>
|
||||
<View style={{ flex: 1, backgroundColor: 'blue' }} />
|
||||
<View style={{ flex: 1, backgroundColor: 'red' }} />
|
||||
</Animated.View>
|
||||
</MaskedViewIOS>
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
<RNTesterBlock title="Mask w/ Changing Children">
|
||||
<View style={{ width: 300, height: 300, alignSelf: 'center' }}>
|
||||
<MaskedViewIOS
|
||||
style={{ flex: 1 }}
|
||||
maskElement={
|
||||
<View style={styles.maskContainerStyle}>
|
||||
<Text style={styles.maskTextStyle}>
|
||||
Basic Mask
|
||||
</Text>
|
||||
</View>
|
||||
}>
|
||||
{this.state.alternateChildren
|
||||
? [
|
||||
<View
|
||||
key={1}
|
||||
style={{ flex: 1, backgroundColor: 'blue' }}
|
||||
/>,
|
||||
<View
|
||||
key={2}
|
||||
style={{ flex: 1, backgroundColor: 'red' }}
|
||||
/>,
|
||||
]
|
||||
: null}
|
||||
</MaskedViewIOS>
|
||||
</View>
|
||||
</RNTesterBlock>
|
||||
</RNTesterPage>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
maskContainerStyle: {
|
||||
flex: 1,
|
||||
backgroundColor: 'transparent',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
maskTextStyle: {
|
||||
backgroundColor: 'transparent',
|
||||
fontSize: 40,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = MaskedViewExample;
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
PanResponder,
|
||||
@@ -21,7 +22,8 @@ var {
|
||||
|
||||
var CIRCLE_SIZE = 80;
|
||||
|
||||
var PanResponderExample = React.createClass({
|
||||
var PanResponderExample = createReactClass({
|
||||
displayName: 'PanResponderExample',
|
||||
|
||||
statics: {
|
||||
title: 'PanResponder Sample',
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
|
||||
var ProgressBar = require('ProgressBarAndroid');
|
||||
var React = require('React');
|
||||
var createReactClass = require('create-react-class');
|
||||
var RNTesterBlock = require('RNTesterBlock');
|
||||
var RNTesterPage = require('RNTesterPage');
|
||||
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
|
||||
var MovingBar = React.createClass({
|
||||
var MovingBar = createReactClass({
|
||||
displayName: 'MovingBar',
|
||||
mixins: [TimerMixin],
|
||||
|
||||
getInitialState: function() {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
ProgressViewIOS,
|
||||
@@ -20,7 +21,8 @@ var {
|
||||
} = ReactNative;
|
||||
var TimerMixin = require('react-timer-mixin');
|
||||
|
||||
var ProgressViewExample = React.createClass({
|
||||
var ProgressViewExample = createReactClass({
|
||||
displayName: 'ProgressViewExample',
|
||||
mixins: [TimerMixin],
|
||||
|
||||
getInitialState() {
|
||||
|
||||
@@ -73,6 +73,11 @@ const ComponentExamples: Array<RNTesterExample> = [
|
||||
module: require('./ListViewPagingExample'),
|
||||
supportsTVOS: true,
|
||||
},
|
||||
{
|
||||
key: 'MaskedViewExample',
|
||||
module: require('./MaskedViewExample'),
|
||||
supportsTVOS: true,
|
||||
},
|
||||
{
|
||||
key: 'ModalExample',
|
||||
module: require('./ModalExample'),
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
Image,
|
||||
@@ -25,7 +26,8 @@ var {
|
||||
|
||||
var RNTesterPage = require('./RNTesterPage');
|
||||
|
||||
var SwipeableListViewSimpleExample = React.createClass({
|
||||
var SwipeableListViewSimpleExample = createReactClass({
|
||||
displayName: 'SwipeableListViewSimpleExample',
|
||||
statics: {
|
||||
title: '<SwipeableListView>',
|
||||
description: 'Performant, scrollable, swipeable list of data.'
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
const Platform = require('Platform');
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
Image,
|
||||
@@ -72,7 +73,8 @@ class AttributeToggler extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
var AdjustingFontSize = React.createClass({
|
||||
var AdjustingFontSize = createReactClass({
|
||||
displayName: 'AdjustingFontSize',
|
||||
getInitialState: function() {
|
||||
return {dynamicText:'', shouldRender: true,};
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var createReactClass = require('create-react-class');
|
||||
var ReactNative = require('react-native');
|
||||
var {
|
||||
AlertIOS,
|
||||
@@ -111,7 +112,8 @@ class RequestIdleCallbackTester extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
var TimerTester = React.createClass({
|
||||
var TimerTester = createReactClass({
|
||||
displayName: 'TimerTester',
|
||||
mixins: [TimerMixin],
|
||||
|
||||
_ii: 0,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
+19
-4
@@ -44,7 +44,16 @@ Pod::Spec.new do |s|
|
||||
s.subspec "Core" do |ss|
|
||||
ss.dependency "Yoga", "#{package["version"]}.React"
|
||||
ss.source_files = "React/**/*.{c,h,m,mm,S}"
|
||||
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/DevSupport/*", "React/**/RCTTVView.*", "ReactCommon/yoga/*", "React/Cxx*/*", "React/Base/RCTBatchedBridge.mm", "React/Executors/*"
|
||||
ss.exclude_files = "**/__tests__/*",
|
||||
"IntegrationTests/*",
|
||||
"React/DevSupport/*",
|
||||
"React/Inspector/*",
|
||||
"React/**/RCTTVView.*",
|
||||
"ReactCommon/yoga/*",
|
||||
"React/Cxx*/*",
|
||||
"React/Base/RCTBatchedBridge.mm",
|
||||
"React/Executors/*"
|
||||
ss.header_dir = "React"
|
||||
ss.framework = "JavaScriptCore"
|
||||
ss.libraries = "stdc++"
|
||||
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
|
||||
@@ -68,7 +77,8 @@ Pod::Spec.new do |s|
|
||||
s.subspec "DevSupport" do |ss|
|
||||
ss.dependency "React/Core"
|
||||
ss.dependency "React/RCTWebSocket"
|
||||
ss.source_files = "React/DevSupport/*"
|
||||
ss.source_files = "React/DevSupport/*",
|
||||
"React/Inspector/*"
|
||||
end
|
||||
|
||||
s.subspec "tvOS" do |ss|
|
||||
@@ -77,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
|
||||
@@ -188,4 +198,9 @@ Pod::Spec.new do |s|
|
||||
ss.source_files = "Libraries/RCTTest/**/*.{h,m}"
|
||||
ss.frameworks = "XCTest"
|
||||
end
|
||||
|
||||
s.subspec "_ignore_me_subspec_for_linting_" do |ss|
|
||||
ss.dependency "React/Core"
|
||||
ss.dependency "React/CxxBridge"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,12 +93,6 @@ typedef void (^RCTFatalHandler)(NSError *error);
|
||||
#define RCTAssertNotMainQueue() RCTAssert(!RCTIsMainQueue(), \
|
||||
@"This function must not be called on the main queue")
|
||||
|
||||
/**
|
||||
* Deprecated, do not use
|
||||
*/
|
||||
#define RCTAssertMainThread() RCTAssertMainQueue()
|
||||
#define RCTAssertNotMainThread() RCTAssertNotMainQueue()
|
||||
|
||||
/**
|
||||
* These methods get and set the current assert function called by the RCTAssert
|
||||
* macros. You can use these to replace the standard behavior with custom assert
|
||||
|
||||
@@ -112,8 +112,8 @@ extern NSString *const RCTContentDidAppearNotification;
|
||||
|
||||
/**
|
||||
* Calling this will result in emitting a "touches cancelled" event to js,
|
||||
* which effectively cancels all js "gesture recognizers" such as as touchable
|
||||
* (unless they explicitely ignore cancellation events, but noone should do that).
|
||||
* which effectively cancels all js "gesture recognizers" such as touchable components
|
||||
* (unless they explicitely ignore cancellation events, but no one should do that).
|
||||
*
|
||||
* This API is exposed for integration purposes where you embed RN rootView
|
||||
* in a native view with a native gesture recognizer,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user