mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1142efae44 | ||
|
|
2d3fcf245b | ||
|
|
d282168548 | ||
|
|
a69581a073 | ||
|
|
4b1731727a | ||
|
|
4f50fc8392 |
@@ -11,20 +11,41 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const NativeEventEmitter = require('NativeEventEmitter');
|
||||
const KeyboardObserver = require('NativeModules').KeyboardObserver;
|
||||
const dismissKeyboard = require('dismissKeyboard');
|
||||
const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver);
|
||||
|
||||
type KeyboardEventName =
|
||||
| 'keyboardWillShow'
|
||||
| 'keyboardDidShow'
|
||||
| 'keyboardWillHide'
|
||||
| 'keyboardDidHide'
|
||||
| 'keyboardWillChangeFrame'
|
||||
| 'keyboardDidChangeFrame';
|
||||
|
||||
type KeyboardEventData = {
|
||||
endCoordinates: {
|
||||
width: number,
|
||||
height: number,
|
||||
screenX: number,
|
||||
screenY: number,
|
||||
},
|
||||
};
|
||||
|
||||
type KeyboardEventListener = (e: KeyboardEventData) => void;
|
||||
|
||||
// The following object exists for documentation purposes
|
||||
// Actual work happens in
|
||||
// https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/NativeEventEmitter.js
|
||||
|
||||
/**
|
||||
* `Keyboard` component to control keyboard events.
|
||||
* `Keyboard` module to control keyboard events.
|
||||
*
|
||||
* ### Usage
|
||||
*
|
||||
* The Keyboard component allows you to listen for native events and react to them, as
|
||||
* The Keyboard module allows you to listen for native events and react to them, as
|
||||
* well as make changes to the keyboard, like dismissing it.
|
||||
*
|
||||
*```
|
||||
@@ -60,16 +81,17 @@ const KeyboardEventEmitter = new NativeEventEmitter(KeyboardObserver);
|
||||
* }
|
||||
*```
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
let Keyboard = {
|
||||
/**
|
||||
* The `addListener` function connects a JavaScript function to an identified native
|
||||
* keyboard notification event.
|
||||
*
|
||||
* This function then returns the reference to the listener.
|
||||
*
|
||||
* @param {string} nativeEvent The `nativeEvent` is the string that identifies the event you're listening for. This
|
||||
* @param {string} eventName The `nativeEvent` is the string that identifies the event you're listening for. This
|
||||
*can be any of the following:
|
||||
*
|
||||
* - `keyboardWillShow`
|
||||
* - `keyboardDidShow`
|
||||
* - `keyboardWillHide`
|
||||
@@ -77,10 +99,20 @@ module.exports = {
|
||||
* - `keyboardWillChangeFrame`
|
||||
* - `keyboardDidChangeFrame`
|
||||
*
|
||||
* @param {function} jsFunction function to be called when the event fires.
|
||||
* @param {function} callback function to be called when the event fires.
|
||||
*/
|
||||
addListener (nativeEvent: string, jsFunction: Function) {
|
||||
return KeyboardEventEmitter.addListener(nativeEvent, jsFunction);
|
||||
addListener(eventName: KeyboardEventName, callback: KeyboardEventListener) {
|
||||
invariant(false, 'Dummy method used for documentation');
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a specific listener.
|
||||
*
|
||||
* @param {string} eventName The `nativeEvent` is the string that identifies the event you're listening for.
|
||||
* @param {function} callback function to be called when the event fires.
|
||||
*/
|
||||
removeListener(eventName: KeyboardEventName, callback: Function) {
|
||||
invariant(false, 'Dummy method used for documentation');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -88,24 +120,21 @@ module.exports = {
|
||||
*
|
||||
* @param {string} eventType The native event string listeners are watching which will be removed.
|
||||
*/
|
||||
removeAllListeners (eventType: string) {
|
||||
KeyboardEventEmitter.removeAllListeners(eventType);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a specific subscription.
|
||||
*
|
||||
* @param {EmitterSubscription} subscription The subscription emitter to be removed.
|
||||
*/
|
||||
removeSubscription (subscription: Object) {
|
||||
KeyboardEventEmitter.removeSubscription(subscription);
|
||||
removeAllListeners(eventName: KeyboardEventName) {
|
||||
invariant(false, 'Dummy method used for documentation');
|
||||
},
|
||||
|
||||
/**
|
||||
* Dismisses the active keyboard and removes focus.
|
||||
*/
|
||||
dismiss () {
|
||||
dismissKeyboard();
|
||||
dismiss() {
|
||||
invariant(false, 'Dummy method used for documentation');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Throw away the dummy object and reassign it to original module
|
||||
Keyboard = KeyboardEventEmitter;
|
||||
Keyboard.dismiss = dismissKeyboard;
|
||||
|
||||
module.exports = Keyboard;
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React"
|
||||
s.version = package['version']
|
||||
s.version = "0.37.0-rc.2"
|
||||
s.summary = package['description']
|
||||
s.description = <<-DESC
|
||||
React Native apps are built using the React JS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.37.0-rc.2
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
@@ -54,6 +54,14 @@ def configureReactNativePom(def pom) {
|
||||
}
|
||||
}
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
allprojects {
|
||||
tasks.withType(Javadoc) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate { project ->
|
||||
|
||||
task androidJavadoc(type: Javadoc) {
|
||||
@@ -84,8 +92,7 @@ afterEvaluate { project ->
|
||||
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
// TODO Make Javadoc generation work with Java 1.8, currently only works with 1.7
|
||||
// archives androidJavadocJar
|
||||
archives androidJavadocJar
|
||||
}
|
||||
|
||||
version = VERSION_NAME
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"version": "1000.0.0",
|
||||
"version": "0.37.0-rc.2",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
@@ -223,4 +223,4 @@
|
||||
"eslint-plugin-flowtype": "^2.20.0",
|
||||
"eslint-plugin-react": "^6.4.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,6 @@
|
||||
require(`shelljs/global`);
|
||||
|
||||
const buildBranch = process.env.CIRCLE_BRANCH;
|
||||
const requiredJavaVersion = `1.7`;
|
||||
|
||||
let branchVersion;
|
||||
if (buildBranch.indexOf(`-stable`) !== -1) {
|
||||
@@ -88,19 +87,6 @@ if (tagsWithVersion[0].indexOf(`-rc`) === -1) {
|
||||
}
|
||||
|
||||
// -------- Generating Android Artifacts with JavaDoc
|
||||
// Java -version outputs to stderr 0_o
|
||||
const javaVersion = exec(`java -version`).stderr;
|
||||
if (javaVersion.indexOf(requiredJavaVersion) === -1) {
|
||||
echo(`Java version must be 1.7.x in order to generate Javadoc. Check: java -version`);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Uncomment Javadoc generation
|
||||
if (sed(`-i`, `// archives androidJavadocJar`, `archives androidJavadocJar`, `ReactAndroid/release.gradle`).code) {
|
||||
echo(`Couldn't enable Javadoc generation`);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (exec(`./gradlew :ReactAndroid:installArchives`).code) {
|
||||
echo(`Couldn't generate artifacts`);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user