[change] React 16 support

Fix #364
This commit is contained in:
Nicolas Gallagher
2017-09-18 20:43:40 -07:00
parent df16c24d68
commit d6df440987
8 changed files with 177 additions and 165 deletions

View File

@@ -366,12 +366,12 @@ describe('components/TextInput', () => {
);
// default selection is 0
expect(inputDefaultSelection.node.selectionStart).toEqual(0);
expect(inputDefaultSelection.node.selectionEnd).toEqual(0);
expect(inputDefaultSelection.instance().selectionStart).toEqual(0);
expect(inputDefaultSelection.instance().selectionEnd).toEqual(0);
// custom selection sets cursor at custom position
expect(inputCustomSelection.node.selectionStart).toEqual(cursorLocation.start);
expect(inputCustomSelection.node.selectionEnd).toEqual(cursorLocation.end);
expect(inputCustomSelection.instance().selectionStart).toEqual(cursorLocation.start);
expect(inputCustomSelection.instance().selectionEnd).toEqual(cursorLocation.end);
});
});
});

View File

@@ -1,6 +1,7 @@
import {
// top-level API
findNodeHandle,
hydrate,
render,
unmountComponentAtNode,
@@ -67,6 +68,7 @@ import {
const ReactNative = {
// top-level API
findNodeHandle,
hydrate,
render,
unmountComponentAtNode,

View File

@@ -2,7 +2,7 @@ export { default as createElement } from './modules/createElement';
export { default as findNodeHandle } from './modules/findNodeHandle';
export { default as NativeModules } from './modules/NativeModules';
export { default as processColor } from './modules/processColor';
export { render, unmountComponentAtNode } from 'react-dom';
export { hydrate, render, unmountComponentAtNode } from 'react-dom';
// APIs
export { default as Animated } from './apis/Animated';

View File

@@ -1,9 +1,11 @@
// based on https://github.com/facebook/react/pull/4303/files
import EventPluginHub from 'react-dom/lib/EventPluginHub';
import normalizeNativeEvent from '../normalizeNativeEvent';
import ResponderEventPlugin from 'react-dom/lib/ResponderEventPlugin';
import ResponderTouchHistoryStore from 'react-dom/lib/ResponderTouchHistoryStore';
import ReactDOM from 'react-dom';
import ReactDOMUnstableNativeDependencies from 'react-dom/unstable-native-dependencies';
const { EventPluginHub } = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
const { ResponderEventPlugin, ResponderTouchHistoryStore } = ReactDOMUnstableNativeDependencies;
const topMouseDown = 'topMouseDown';
const topMouseMove = 'topMouseMove';