Skip to content

Commit

Permalink
[Patches] Patch RN to use import typeof
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Feb 16, 2020
1 parent dbfa3ef commit 6ba4b28
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions patches/react-native+0.62.0-rc.2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ index 0bc51bb..ce24b46 100644
// Will cause sticky headers to stick at the bottom of the ScrollView instead
// of the top.
inverted: ?boolean,
diff --git a/node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.js
index 67d314c..7779b1a 100644
--- a/node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.js
+++ b/node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.js
@@ -10,13 +10,13 @@

'use strict';

-const DeprecatedColorPropType = require('../../DeprecatedPropTypes/DeprecatedColorPropType');
const Platform = require('../../Utilities/Platform');
const React = require('react');
const StyleSheet = require('../../StyleSheet/StyleSheet');

import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';

+import typeof DeprecatedColorPropType from '../../DeprecatedPropTypes/DeprecatedColorPropType';
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';

/**
diff --git a/node_modules/react-native/Libraries/Components/View/ReactNativeStyleAttributes.js b/node_modules/react-native/Libraries/Components/View/ReactNativeStyleAttributes.js
index ebd3c63..949b757 100644
--- a/node_modules/react-native/Libraries/Components/View/ReactNativeStyleAttributes.js
Expand Down
77 changes: 77 additions & 0 deletions workbench/Libraries/Components/TextInput/InputAccessoryView.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from 'react';
import { ClassOrType } from "flow-builtin-types";
import { $ReadOnly } from "utility-types";
import _Import_DeprecatedColorPropType from "../../DeprecatedPropTypes/DeprecatedColorPropType";
declare type DeprecatedColorPropType = ClassOrType<typeof _Import_DeprecatedColorPropType>;
/**
* Note: iOS only
*
* A component which enables customization of the keyboard input accessory view.
* The input accessory view is displayed above the keyboard whenever a TextInput
* has focus. This component can be used to create custom toolbars.
*
* To use this component wrap your custom toolbar with the
* InputAccessoryView component, and set a nativeID. Then, pass that nativeID
* as the inputAccessoryViewID of whatever TextInput you desire. A simple
* example:
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, TextInput, InputAccessoryView, Button } from 'react-native';
*
* export default class UselessTextInput extends Component {
* constructor(props) {
* super(props);
* this.state = {text: 'Placeholder Text'};
* }
*
* render() {
* const inputAccessoryViewID = "uniqueID";
* return (
* <View>
* <ScrollView keyboardDismissMode="interactive">
* <TextInput
* style={{
* padding: 10,
* paddingTop: 50,
* }}
* inputAccessoryViewID=inputAccessoryViewID
* onChangeText={text => this.setState({text})}
* value={this.state.text}
* />
* </ScrollView>
* <InputAccessoryView nativeID=inputAccessoryViewID>
* <Button
* onPress={() => this.setState({text: 'Placeholder Text'})}
* title="Reset Text"
* />
* </InputAccessoryView>
* </View>
* );
* }
* }
*
* // skip this line if using Create React Native App
* AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput);
* ```
*
* This component can also be used to create sticky text inputs (text inputs
* which are anchored to the top of the keyboard). To do this, wrap a
* TextInput with the InputAccessoryView component, and don't set a nativeID.
* For an example, look at InputAccessoryViewExample.js in RNTester.
*/
import { ViewStyleProp } from "../../StyleSheet/StyleSheet";
declare type Props = $ReadOnly<{
readonly children: React.ReactNode;
/**
* An ID which is used to associate this `InputAccessoryView` to
* specified TextInput(s).
*/
nativeID?: string | null | undefined;
style?: ViewStyleProp | null | undefined;
backgroundColor?: DeprecatedColorPropType | null | undefined;

This comment has been minimized.

Copy link
@elicwhite

elicwhite Feb 18, 2020

Interesting. This is a bug in React Native. Instead of backgroundColor?: ?DeprecatedColorPropType, it should be backgroundColor?: ?ColorValue. We never want to be using prop-types as Flow types. Wanna send a PR to core?

This comment has been minimized.

Copy link
@alloy

alloy Feb 18, 2020

Author Owner

Ah great, yeah this did feel weird. Will do 👍

}>;
declare class InputAccessoryView extends React.Component<Props> {
render(): React.ReactNode;
}
export default InputAccessoryView;

0 comments on commit 6ba4b28

Please sign in to comment.