mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
@types/react-native: fix StyleSheet.create() styles parameter (#36554)
* Fix StyleSheet.create() styles parameter * Add tests
This commit is contained in:
2
types/react-native/index.d.ts
vendored
2
types/react-native/index.d.ts
vendored
@@ -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.
|
||||
|
||||
15
types/react-native/test/stylesheet-create.tsx
Normal file
15
types/react-native/test/stylesheet-create.tsx
Normal 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%',
|
||||
},
|
||||
});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user