diff --git a/types/react-native/LaunchScreen.d.ts b/types/react-native/LaunchScreen.d.ts new file mode 100644 index 0000000000..a3e93dfc6d --- /dev/null +++ b/types/react-native/LaunchScreen.d.ts @@ -0,0 +1,9 @@ +// Adds the JSX elements used in the launch screen. + +declare module 'react-native/Libraries/NewAppScreen' { + export const Header: any + export const LearnMoreLinks: any + export const Colors: any + export const DebugInstructions: any + export const ReloadInstructions: any +} diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index c5c91c76df..fa5992a0c8 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -40,6 +40,7 @@ /// /// /// +/// import * as PropTypes from "prop-types"; import * as React from "react"; @@ -9496,4 +9497,6 @@ declare global { * if (__DEV__) console.log('Running in dev mode') */ const __DEV__: boolean; + + const HermesInternal: null | {}; } diff --git a/types/react-native/test/init-example.tsx b/types/react-native/test/init-example.tsx index fc0d66e3fb..c1788fa594 100644 --- a/types/react-native/test/init-example.tsx +++ b/types/react-native/test/init-example.tsx @@ -1,36 +1,104 @@ -import * as React from "react"; -import { AppRegistry, StyleSheet, Text, View } from "react-native"; +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + * @flow + */ -export default class AwesomeProject extends React.Component { - render() { - return ( - - Welcome to React Native! - To get started, edit index.ios.js - - Press Cmd+R to reload,{"\n"} - Cmd+D or shake for dev menu - - - ); - } -} +import * as React from 'react'; +import { SafeAreaView, StyleSheet, ScrollView, View, Text, StatusBar } from 'react-native'; + +import { + Header, + LearnMoreLinks, + Colors, + DebugInstructions, + ReloadInstructions, +} from 'react-native/Libraries/NewAppScreen'; + +const App = () => { + const hasHermes = typeof HermesInternal === 'object' && HermesInternal !== null; + return ( + <> + + + +
+ {!hasHermes ? null : ( + + Engine: Hermes + + )} + + + Step One + + Edit App.js to change this screen and then come + back to see your edits. + + + + See Your Changes + + + + + + Debug + + + + + + Learn More + Read the docs to discover what to do next: + + + + + + + ); +}; const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: "center", - alignItems: "center", - backgroundColor: "#F5FCFF", + scrollView: { + backgroundColor: Colors.lighter, }, - welcome: { - fontSize: 20, - textAlign: "center", - margin: 10, + engine: { + position: 'absolute', + right: 0, }, - instructions: { - textAlign: "center", - color: "#333333", - marginBottom: 5, + body: { + backgroundColor: Colors.white, + }, + sectionContainer: { + marginTop: 32, + paddingHorizontal: 24, + }, + sectionTitle: { + fontSize: 24, + fontWeight: '600', + color: Colors.black, + }, + sectionDescription: { + marginTop: 8, + fontSize: 18, + fontWeight: '400', + color: Colors.dark, + }, + highlight: { + fontWeight: '700', + }, + footer: { + color: Colors.dark, + fontSize: 12, + fontWeight: '600', + padding: 4, + paddingRight: 12, + textAlign: 'right', }, }); + +export default App; diff --git a/types/react-native/tslint.json b/types/react-native/tslint.json index f4e06d9245..d3e99728e8 100644 --- a/types/react-native/tslint.json +++ b/types/react-native/tslint.json @@ -25,6 +25,7 @@ "space-within-parens": false, "strict-export-declare-modifiers": false, "use-default-type-parameter": false, - "no-unnecessary-generics": false + "no-unnecessary-generics": false, + "no-single-declare-module": false } }