@types/react-native: fix StyleSheet.create() styles parameter (#36554)

* Fix StyleSheet.create() styles parameter

* Add tests
This commit is contained in:
Benas Svipas
2019-07-01 12:53:00 +03:00
committed by Eloy Durán
parent c2f6a819e1
commit 9761062ec2
3 changed files with 18 additions and 2 deletions

View File

@@ -5320,7 +5320,7 @@ export namespace StyleSheet {
/**
* Creates a StyleSheet style reference from the given object.
*/
export function create<T extends NamedStyles<T> | NamedStyles<any>>(styles: T): T;
export function create<T extends NamedStyles<T> | NamedStyles<any>>(styles: T | NamedStyles<T>): T;
/**
* Flattens an array of style objects, into one aggregated style object.

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
export function App() {
return <View style={styles.container} />;
}
const styles = StyleSheet.create({
container: {
position: 'absolute',
backgroundColor: 'red',
width: '100%',
height: '100%',
},
});

View File

@@ -22,6 +22,7 @@
"test/animated.tsx",
"test/init-example.tsx",
"test/ART.tsx",
"test/legacy-properties.tsx"
"test/legacy-properties.tsx",
"test/stylesheet-create.tsx"
]
}